RFR: JMC-4667: Empty submenu if no stored selection

Alex Macdonald almacdon at redhat.com
Tue Nov 6 17:07:06 UTC 2018


Hi!

This patch addresses JMC-4667 [0], in which the submenus for adding filters
from selections can be empty. The bug [0] concerns the "selections" portion
of the menu, however the same behaviour is possible for the "attributes",
so I've addressed them both in my attached patch.

The proposed solution adds a bit of logic to the overridden
"menuAboutToShow" function for the MenuManagers, and introduces a disabled
MenuItem if no selections or attributes exist. If attributes or selections
do exist, then there's a quick check to see if the disabled item should be
removed, if it exists. Looking at the description for JMC-5083 [1], I
thought it'd be nice to disable the MenuManager itself, but overriding it's
"isEnabled" function has no effect and the implementation of MenuManager
mentions an outstanding bug [2] that prevents this behaviour.

I've captured some images and a gif to show the changes [3].

before:
empty add filter from attribute submenu [4]
empty add filter from selection submenu [5]

after:
empty add filter from attribute submenu [6]
empty add filter from selection submenu [7]

gif of the proposed patch in action [8]

Thoughts?

Cheers,

Alex

[0] https://bugs.openjdk.java.net/browse/JMC-4667
[1] https://bugs.openjdk.java.net/browse/JMC-5083
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=30833
[3] https://imgur.com/a/E4AdSFQ
[4] https://imgur.com/P1y4HEu
[5] https://imgur.com/aFHYOMK
[6] https://imgur.com/vk2BsJG
[7] https://imgur.com/3YrUlCi
[8] https://imgur.com/6wIjm7n
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jmc-4667-0.patch
Type: text/x-patch
Size: 4595 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/jmc-dev/attachments/20181106/5850ad6a/jmc-4667-0.patch>


More information about the jmc-dev mailing list