JMC-4667: Empty submenu if no stored selection

Marcus Hirt marcus.hirt at oracle.com
Tue Nov 6 17:30:27 UTC 2018


I think it looks good! Thank you for your contribution Alex!

Kind regards,
Marcus

On 2018-11-06, 18:09, "jmc-dev on behalf of Alex Macdonald" <jmc-dev-bounces at openjdk.java.net on behalf of almacdon at redhat.com> wrote:

    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
    
    




More information about the jmc-dev mailing list