Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » Item specific Context Menu in TreeField
Item specific Context Menu in TreeField [message #1428836] Mon, 22 September 2014 08:33 Go to next message
Eclipse UserFriend
Is it possible to add item specific Conext-Menu Entries in a TreeField?
We need to add different Menu Entries in a TreeView depending on the type of Tree Element. We have different elements in the Tree or Elements with different states. Depending on the State we need a different Context Menu.
Re: Item specific Context Menu in TreeField [message #1428897 is a reply to message #1428836] Mon, 22 September 2014 10:20 Go to previous messageGo to next message
Eclipse UserFriend
Hi Erich,
which version of Scout are you using?
Re: Item specific Context Menu in TreeField [message #1428900 is a reply to message #1428897] Mon, 22 September 2014 10:22 Go to previous messageGo to next message
Eclipse UserFriend
With Scout 4.0 we introduced a method:
execOwnerValueChanged(Object newOwnerValue)
which I think you can use.

The following code sets the context menu invisible if the selected node contains the text "Node 2". I hope this snippet helps.
          public class MenuAMenu extends AbstractExtensibleMenu {

            @Override
            protected String getConfiguredText() {
              return TEXTS.get("MenuA");
            }

            @Override
            protected void execOwnerValueChanged(Object newOwnerValue) throws ProcessingException {
              super.execOwnerValueChanged(newOwnerValue);
              if (getTree().getSelectedNode().getCell().getText().contains("Node 2")) {
                setVisible(false);
              }
              else {
                setVisible(true);
              }
            }
          }


Best regards,
Matthias

[Updated on: Mon, 22 September 2014 10:23] by Moderator

Re: Item specific Context Menu in TreeField [message #1429625 is a reply to message #1428900] Tue, 23 September 2014 09:41 Go to previous message
Eclipse UserFriend
Hi Matthias
Thanks for your answer. That works for me pretty good.
Previous Topic:Programmatically open the date picker's calendar popup
Next Topic:[RAP] Obtaining URL Parameters and open outline with page
Goto Forum:
  


Current Time: Mon Jul 07 00:24:38 EDT 2025

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

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

Back to the top