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 59344 - Actions from AnnotationTypes are not checked for isEnabled()
Summary: Actions from AnnotationTypes are not checked for isEnabled()
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Hints & Annotations (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks: 56602
  Show dependency tree
 
Reported: 2005-05-27 17:08 UTC by Martin Entlicher
Modified: 2007-11-05 13:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2005-05-27 17:08:28 UTC
When I add some action folder in annotation XML file, as described at
http://www.netbeans.org/download/dev/javadoc/org-openide-text/org/openide/text/doc-files/api.html#auto-ann
the actions defined in that folder are not tested for whether they are enabled
or not. Therefore they are always displayed, even when they can not be actually
performed.
Comment 1 Martin Entlicher 2005-05-27 17:10:29 UTC
Should be fixed into 4.2, the fix is trivial, please review...

Index: Annotations.java
===================================================================
RCS file: /cvs/editor/libsrc/org/netbeans/editor/Annotations.java,v
retrieving revision 1.23
diff -u -r1.23 Annotations.java
--- Annotations.java	18 Aug 2004 17:22:15 -0000	1.23
+++ Annotations.java	27 May 2005 16:09:37 -0000
@@ -699,8 +699,11 @@
             actions = type.getActions();
             if (actions != null) {
                 subMenu = new JMenu(type.getDescription());
-                for (int j=0; j<actions.length; j++)
-                    subMenu.add(createMenuItem(actions[j], kit));
+                for (int j=0; j<actions.length; j++) {
+                    if (actions[j].isEnabled()) {
+                        subMenu.add(createMenuItem(actions[j], kit));
+                    }
+                }
                 if (separator) {
                     separator = false;
                     //pm.addSeparator();
Comment 2 Martin Entlicher 2005-08-02 14:45:21 UTC
Assuming that the change is O.K. since there was no response. Committing...
Comment 3 Martin Entlicher 2005-08-02 14:50:15 UTC
Fixed in trunk:

/cvs/editor/libsrc/org/netbeans/editor/Annotations.java,v  <--  Annotations.java
new revision: 1.25; previous revision: 1.24