Thursday March 27, 2008
Java Hint Generator for NetBeans IDE 6.1 Beta
I've blogged about hints before and about how cool it would be for users out there to create hints so as to increase (even further) the power of the NetBeans Java Editor. But now it's a simplified process:
http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=6784
Install that plugin and read the accompanying instructions.
Here's where you'll find the new template, once you've installed the above plugin:

Mar 27 2008, 01:34:10 PM PDT Permalink
hi geertjan,
I tried your "java_hint_generator_for_netbeans" plugin for NetBeans6.1Beta. Its a good idea. It has quite a few days since I have been investigating in the Hints & Java editor modules and the corresponding XML layer of NetBeans. And then i suddenly found your plugin.
However i am facing a problem building the module using the plugin template.
When i try to compile and install in the target platform, the Build fails. the reason it gives is that there are no public packages in "org-netbeans-modules-java-editor.jar"
I investigated the Manifest file of this jar and found that there were on public packages available(and i have read-only permission on this jar :( ). I have the source code of NetBeans. I opened this particular module and made the packages of the module "java editor" public(API versioning), however the build failed again(may be i don't have the adequate dependencies)
Could you guide me to sort out this problem?
The exact error is as follows:-
C:\Program Files\NetBeans 6.1 Beta\harness\build.xml:97: The module C:\Program Files\NetBeans 6.1 Beta\java2\modules\org-netbeans-modules-java-editor.jar has no public packages and so cannot be compiled against
Posted by Kunal Modi on March 31, 2008 at 07:37 PM PDT #
Please follow the instructions on this page, Kunal. In your case, you didn't do step 6:
http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=6784
Posted by Geertjan on March 31, 2008 at 10:07 PM PDT #
Thank you, Geertjan. It worked now.
Posted by Kunal Modi on March 31, 2008 at 10:22 PM PDT #
Excellent! Let me know how you get on with the hint! We will definitely be interested in including new hints in the NetBeans sources, if they are useful to NetBeans IDE.
Posted by Geertjan on March 31, 2008 at 10:37 PM PDT #
hi,I am working on a review tool called Sticky Notes which is one of the modules for my Final Year computer engineering project(something similar to rohan's review tool mentioned at http://blogs.sun.com/geertjan/entry/creating_error_annotations_in_netbeans1 ). I have followed your tutorial and managed to make a custom annotation. I attach them at runtime to a java file at predefined line nos.in the java editor using the skeleton you provided in the Java Hint Generator plugin. However,I want to dynamically retrieve the particular line numbers from the Run-time information which hold this particular annotation, i.e. my custom annotation.
I tried the following code in the Java Hint Generator Plugin's skeleton class.
org.netbeans.modules.editor.hints.AnnotationHolder ah = org.netbeans.modules.editor.hints.AnnotationHolder.getInstance(info.getFileObject());
List<org.openide.text.Annotation>an = ah.getAnnotations();
while(an.iterator().hasNext()){
org.openide.text.Annotation a = an.iterator().next();
}
However this ignores my custom annotation.. which i later found out that it was meant only for the following errors.
1.)"org-netbeans-spi-editor-hints-parser_annotation_err_fixable"
2.)"org-netbeans-spi-editor-hints-parser_annotation_err"
3.)"org-netbeans-spi-editor-hints-parser_annotation_warn_fixable"
4.)"org-netbeans-spi-editor-hints-parser_annotation_warn"
5.)"org-netbeans-spi-editor-hints-parser_annotation_verifier_fixable"
6.)"org-netbeans-spi-editor-hints-parser_annotation_verifier"
7.)"org-netbeans-spi-editor-hints-parser_annotation_hint_fixable"
8.)"org-netbeans-spi-editor-hints-parser_annotation_hint"
9.)"org-netbeans-spi-editor-hints-parser_annotation_todo_fixable"
10.)"org-netbeans-spi-editor-hints-parser_annotation_todo"
It would be great if you could help me for a link through which i can determine the lines which hold my custom annotation at runtime.
Thank you.


