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 240003

Summary: Task-Dashboard Actions need to check for support
Product: connecteddeveloper Reporter: matthias42
Component: Task DashboardAssignee: Jan Peska <JPESKA>
Status: VERIFIED FIXED    
Severity: normal Keywords: PATCH_AVAILABLE
Priority: P3    
Version: 8.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: proposed patch v1

Description matthias42 2014-01-05 16:11:16 UTC
Created attachment 143609 [details]
proposed patch v1

Hey, while doing tests with the mantis integration, I noticed, that the context menus of the Tasklist partly show non-applicable actions. For example I don't yet provide a ScheduleProvider, non the less the menu is shown in the context menu of the tasks.

The attached patch fixes the places I noticed.
Comment 1 Jan Peska 2014-01-06 12:27:39 UTC
Thanks for reporting and for the patch. I'll just change it a bit - not-supported actions will be disabled as it is in case of e.g. local repository actions.
Comment 2 Jan Peska 2014-01-06 13:05:29 UTC
fix: http://hg.netbeans.org/core-main/rev/e6ef34c2f542
Comment 3 Quality Engineering 2014-01-07 02:49:27 UTC
Integrated into 'main-silver', will be available in build *201401070002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e6ef34c2f542
User: Jan Peska <JPESKA@netbeans.org>
Log: Issue #240003 - Task-Dashboard Actions need to check for support
Disable scheduling and markAsRead actions if they are not supported
Comment 4 matthias42 2014-01-07 09:37:09 UTC
Hey Jan, I checked main-golden (your changes migrated there and are present in the nightly build) - looks good apart from the schedule menu, which is still enabled. The menu is still enabled, although you code changes are sensible (=> the action is disabled).

Looks like you need to either change getPopupPresenter, to return a disabled menu when called on a disabled action, or override setEnabled and also disable the menu, when called this way.

This change in DashboardUtils.java (class ScheduleMenuAction):

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -710,5 +710,11 @@
         public JMenuItem getPopupPresenter() {
             return menu;
         }
+
+        @Override
+        public void setEnabled(boolean newValue) {
+            super.setEnabled(newValue);
+            menu.setEnabled(newValue);
     }
 }
+}

Should do it. 

BTW: I'm ok with disabling actions, instead of not showing at all, my implementation was based on the way Open vs. Edit Task were handled).
Comment 5 Jan Peska 2014-01-08 12:12:58 UTC
Thanks for validation and additional patch.

fix: http://hg.netbeans.org/core-main/rev/bdd287eb73a1