Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » [neon] AbstractMenu.execAboutToShow()
[neon] AbstractMenu.execAboutToShow() [message #1725429] Thu, 03 March 2016 12:51 Go to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
In Mars we were overwriting AbstractMenu.execAboutToShow() in order to create dynamic table menu entries (menu text was context sensitive).

This method seems to have gone with Neon. How do we change the menu text before the menu is redrawn?
Re: [neon] AbstractMenu.execAboutToShow() [message #1725440 is a reply to message #1725429] Thu, 03 March 2016 14:27 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
In my current project, I have a similar requirement:
I should create additional child-menus depending on a List that is dynamically computed by a Service.
Re: [neon] AbstractMenu.execAboutToShow() [message #1725451 is a reply to message #1725440] Thu, 03 March 2016 15:15 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
You're right, execAboutToShow() has been removed with the Html UI. In the new UI each table has a menu-bar that always displays all currently visible menu-items of the table, it also contains the menu-items of the context-menu (which in the old UI have been only visible, when you've right-clicked on a table-row). Because all menu-items are always visible, execAboutToShow makes no sense anymore.

Instead you should manipulate the menu-items when the selection in your table changes. When we've migrated our own software to the new UI, we've replaced all occurrences of execAboutToShow() with AbstractMenu#execOwnerValueChanged(), which is triggered when the selection of the menu-owner (table, tree, etc.) changes. Check the javadoc on the method for more infos.


Eclipse Scout Homepage | Documentation | GitHub
Re: [neon] AbstractMenu.execAboutToShow() [message #1725706 is a reply to message #1725451] Mon, 07 March 2016 07:59 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
The problem is, that our dynamic menu items were not dependent on the selected row, but on the selected column, so before showing the menu, we interrogated the current column in order to adjust the text of the menu item. I don't see how we can do this with the execOwnerValueChanged() callback. Do you have any suggestion on how to do this?
Re: [neon] AbstractMenu.execAboutToShow() [message #1725719 is a reply to message #1725706] Mon, 07 March 2016 09:29 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Usually you could use getContextColumn() to check which column has been clicked. However, in the current implementation the context-column is not updated when the context-menu is openend, so getContextColumn() will not work in your case. I guess a simple solution is, to send an additional (right) click event to the UI server, before the context-menu is opened in the UI. With that you could overwrite execRowClick(), check getContextColumn() and change the visibility or enabled-state of the menu-items. Would that work for you?

Would you please open a Bugzilla-ticket for that change?


Eclipse Scout Homepage | Documentation | GitHub
Re: [neon] AbstractMenu.execAboutToShow() [message #1725747 is a reply to message #1725719] Mon, 07 March 2016 12:15 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
That would be one way to do this.

I just checked our current code, because I remembered some code I wrote quite a while ago. It used the following code snippet on an AbstractMenu:

            @Override
            protected void execInitAction() throws ProcessingException {
              getTable().addPropertyChangeListener(ITable.PROP_CONTEXT_COLUMN, new PropertyChangeListener() {

                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                  // some code calculating visibility and menuText based on the current column
                  setVisible(visibility);
                  setText(menuText);
                }

              });
            }


Would something like this still work in Neon?
Re: [neon] AbstractMenu.execAboutToShow() [message #1725750 is a reply to message #1725747] Mon, 07 March 2016 12:21 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Bug submitted: https://bugs.eclipse.org/bugs/show_bug.cgi?id=489129
Re: [neon] AbstractMenu.execAboutToShow() [message #1725757 is a reply to message #1725747] Mon, 07 March 2016 13:00 Go to previous message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Yes, that should work with the Neon release, as soon as the bug below is fixed (Thanks for opening the bug btw). Currently the contextColumn property change event is not fired when a user right-clicks to open the context-menu, but it should already work when a rowClick, rowAction or appLink is processed.

Eclipse Scout Homepage | Documentation | GitHub
Previous Topic:[neon] AbstractForm.getConfiguredModal()
Next Topic:[neon] How to set an icon on a WizardButton
Goto Forum:
  


Current Time: Fri Apr 26 02:21:47 GMT 2024

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

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

Back to the top