Excluding Proposals from Code Completion in NetBeans 8

Finding the place in the Options window where you can list the classes you'd like to exclude from the Code Completion box is not easy.

Therefore, in NetBeans 8, you can exclude the classes you don't need right from within the Code Completion box. Below, notice the lightbulb at the far right in the currently selected item in the Code Completion box, which appears the second time you call up code completion:

Press Alt-Enter or click the lightbulb and now you see this:

Press Enter and the item is excluded from the Code Completion box because it has now been added here for you, i.e., instead of going all the way here, the class was registered here for you when you pressed Enter above:

NetBeans 8. Making your coding life simpler all the time.


That's cool!
Can I do this in the project settings?
The reason I'm asking is that in the Codename One plugin we have our own bootclasspath but the completion offers up all the J2SE files. I'd love to be able to narrow down code completion while still being compatible to NetBeans 7.x.

Posted by Shai Almog on January 23, 2014 at 02:01 AM PST #

No, this is not per-project, but IDE-wide. I can see how useful per-project would be for you, though. On the other hands, you could take the steps described in this blog entry above, then take a look at where that information is saved in the user directory. Then, in your Codename One plugin, detect when the user is working on a Codename One project, at which point that information would be written into the user directory, and removed when the user is working on a different project, i.e., a non-Codename One project. (You can listen to the Lookup for a change in Project and then check if it is your project or not.) Hope that gets you started.

Posted by Geertjan on January 23, 2014 at 02:49 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« June 2016