Geertjan's Blog

  • December 10, 2006

The "Action" Attribute in the Error Annotation DTD

Geertjan Wielenga
Product Manager
I discovered something interesting today. I was trying to work out what the "actions" attribute is for in the error annotations DTD (click here to see it). I found out that there are at least two cases in the NetBeans sources where the "actions" attribute is used. In BreakPoint.xml, BreakpointActions is defined as the value of the "actions" attribute, while in parser_annotation_err_fixable.xml one finds hints-fixable defined there.

I've experimented with the attribute and discovered that, after defining a value for that attribute, you need to register it in the Layer XML file's AnnotationTypes section. So, I defined the value of the "actions" attribute as "some-action" and then registered it in the Layer XML file like this:

<folder name="Editors">
<folder name="AnnotationTypes">
<folder name="some-action">
<file name="org-netbeans-modules-mymodule-SomeAction.instance"/>

And then... in the left sidebar, you have a new menu item, defined by the action registered in the XML Layer (the name "Manifest is Broken", comes from the Bundle.properties file, which is also defined in the error annotations XML file):

This is also how the Bookmark menu items end up in the left sidebar's menu. In the definition of the Bookmark.xml error annotation XML file, BookmarkActions is defined as the value of the "actions" attribute". Then, in the Layer XML file, you find the following registration:

<folder name="AnnotationTypes">
<file name="bookmark.xml" url="bookmark.xml"/>
<folder name="BookmarkActions">
<file name="bookmark-toggle.shadow">
<attr name="originalFile" stringvalue="Actions/Edit/bookmark-toggle.instance"/>
<file name="bookmark-next.shadow">
<attr name="originalFile" stringvalue="Actions/Edit/bookmark-next.instance"/>
<file name="bookmark-previous.shadow">
<attr name="originalFile" stringvalue="Actions/Edit/bookmark-previous.instance"/>

Pretty cool. This is a very obscure corner of development on the NetBeans Platform, but handy to know about nonetheless...

Join the discussion

Comments ( 1 )
  • steackfrite Friday, June 28, 2013


    I'm trying to associate an action with an annotation.

    I succeed in finding and error in my source code and displaying an annotation. But I don't understand how to associate an action with it.

    Could you help me ?


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.