Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Item specific Context Menu in TreeField
Item specific Context Menu in TreeField [message #1428836] Mon, 22 September 2014 12:33 Go to next message
Erich Steiger is currently offline Erich SteigerFriend
Messages: 14
Registered: September 2013
Junior Member

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 14:20 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
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 14:22 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
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 14:23]

Report message to a moderator

Re: Item specific Context Menu in TreeField [message #1429625 is a reply to message #1428900] Tue, 23 September 2014 13:41 Go to previous message
Erich Steiger is currently offline Erich SteigerFriend
Messages: 14
Registered: September 2013
Junior Member

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: Tue Oct 17 15:20:56 GMT 2017

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

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