This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 236089

Summary: Allow easy / one click fixing of broken imports
Product: java Reporter: digitman222
Component: EditorAssignee: Dusan Balek <dbalek>
Status: REOPENED ---    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:

Description digitman222 2013-09-18 03:22:00 UTC
In Netbeans, if you have a broken import, you have to specifically go into Source -> fix imports, or press ctrl + alt + i in order to bring up the menu to fix them.

In eclipse, if you have a broken import, then in the error message for it, there's a link right within it for adding the import. You don't have to press any keys or go into any menu, you can add the import from right within the error message. Its much more user friendly and time saving.

Can the same method for fixing imports be added to Netbeans?
Comment 1 Jiri Prox 2013-09-18 08:03:39 UTC
As far as I know the Netbeans hints works the same as in Eclipse.
If not, please describe exactly the requested behavior.
Thanks
Comment 2 digitman222 2013-09-18 17:03:40 UTC
Just open eclipse, add a test package, add a class to the test package, then in your main class, do:

TestClass foo = new TestClass();

You will see the error for the broken import, but when you hover your mouse over the error, then within the error tooltip that shows up, there will be a link saying 'Add import for testpackage.TestClass`. If you click it, then the import will be added.
Comment 3 Jiri Prox 2013-09-19 09:34:21 UTC
Thanks for description. But the Netbeans works in the same way. There is yellow light bulb over the line number with the unresolved import. Just click on it (or hit alt-enter) and the small popup will open - where you can select Add Import ...

(This way it works for all errors which can be fixed or suggestions, see Options -> Editor -> Hints for list of all hints)
Comment 4 digitman222 2013-09-19 16:17:16 UTC
But, it would be more user friendly if the link to add the import is shown when you hover your mouse over the error, rather than clicking it or hitting alt + enter