Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Menumanager setVisible doesn't work as expected
Menumanager setVisible doesn't work as expected [message #741662] Wed, 19 October 2011 19:22
davids  is currently offline davids Friend
Messages: 2
Registered: October 2011
Junior Member
I want to show a popup menu on a tree, with following conditions:
When the node "Item1" is selected, show the menu items via setVisible(true), when any other node is selected hide items setVisible(false).

In my code there is a problem, if on application start, I right click on node "Item1" I see the menu items. Then if I try to click on any other nodes THE MENU ITEMS STILL VISIBLE.


Action a1 = new Action("XXX") {};
Action a2 = new Action("YYY") {};
Action a3 = new Action("ZZZ") {};

final MenuManager mgr = new MenuManager();


mgr.addMenuListener(new IMenuListener() {
        public void menuAboutToShow(IMenuManager manager) {
            IStructuredSelection selection = (IStructuredSelection) tree
            if (!selection.isEmpty()) {
                String str = ((MyModel) selection.getFirstElement())
                if (str.equals("Item1")) {
                    for (int i = 0; i < 3; i++) {
                } else {
                    for (int i = 0; i < 3; i++) {
Previous Topic:TableViewer - DoubleClick events for column
Next Topic:Rebroadcast selection after TableViewer row changed
Goto Forum:

Current Time: Sat Oct 22 05:28:53 GMT 2016

Powered by FUDForum. Page generated in 0.02361 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software