Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Popup menu not refreshed when no new selection
Popup menu not refreshed when no new selection [message #517877] Tue, 02 March 2010 12:23 Go to next message
Johan Asterholm is currently offline Johan AsterholmFriend
Messages: 3
Registered: March 2010
Junior Member
Hi,

I have a problem with a tableviewer and a popup menu. the menu consists of a couple of commands which has activeWhen set on the handlers. Each of these activeWhen checks for different states in the object shown in the tableviewer.

Example:

the handler setToPending sets pending in the model object but its not active when the state is pending in the model object


My problem is that the popup menu is not refreshed unless i make a new selection in the tableviewer. So if im standing on a row, right-click and run the setToPending command, this works fine. If right-clicking on the same row again no new selection is sent and the handler setToPending is still shown as active in the menu, but throws an exception when its run since the handler is not active.

Is there a way which i can refresh the popup menu ( i have tried to send the same selection again but this dosen't work), or make the popup menu recheck the state of all the handlers on activation?
Re: Popup menu not refreshed when no new selection [message #518035 is a reply to message #517877] Tue, 02 March 2010 15:18 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Johan Asterholm wrote:
> Hi,
>
> I have a problem with a tableviewer and a popup menu. the menu consists
> of a couple of commands which has activeWhen set on the handlers. Each
> of these activeWhen checks for different states in the object shown in
> the tableviewer.
>
> Example:
>
> the handler setToPending sets pending in the model object but its not
> active when the state is pending in the model object
>
>
> My problem is that the popup menu is not refreshed unless i make a new
> selection in the tableviewer.

Refreshed in what way? What visibleWhen are you using to add the
setToPending menu item?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Popup menu not refreshed when no new selection [message #518140 is a reply to message #517877] Wed, 03 March 2010 09:11 Go to previous messageGo to next message
Johan Asterholm is currently offline Johan AsterholmFriend
Messages: 3
Registered: March 2010
Junior Member
Hi Paul,

I'm using a propertyTester to check the condition of the currently selected row, and i think that this is the problem, that they do not get rechecked if i don't make a new selection.

Here is the handler enabledWhen logic

<handler
class="se.capana.selection.ChangeStateToFalseHandler"
commandId="se.capana.selection.toFalse">
<enabledWhen>
<iterate
ifEmpty="false"
operator="and">
<test
forcePluginActivation="true"
property="se.capana.selection.tester.isTrue">
</test>
</iterate>
</enabledWhen>
</handler>

I have created a quick and dirty rcpproject which recreates the problem its exported as an eclipse export. Start the program select a row and show the menu. select toTrue, and then right click on the same row again to see the problem.

The project can be downloaded from:

http://atlas.sputnic.se/~aster/rcpproject.zip


Regards Johan
Re: Popup menu not refreshed when no new selection [message #518266 is a reply to message #518140] Wed, 03 March 2010 11:00 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Johan Asterholm wrote:
> Hi Paul,
> I'm using a propertyTester to check the condition of the currently
> selected row, and i think that this is the problem, that they do not get
> rechecked if i don't make a new selection.

Property testers do not get re-checked (nothing tells the framework that
the property has changed, it's opaque). It's the responsibility of the
property provider to request a re-evaluation. See
org.eclipse.ui.services.IEvaluationService.requestEvaluation (String)


PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Popup menu not refreshed when no new selection [message #518283 is a reply to message #518266] Wed, 03 March 2010 16:41 Go to previous message
Johan Asterholm is currently offline Johan AsterholmFriend
Messages: 3
Registered: March 2010
Junior Member
Works great!

Thanks allot.

regards Johan
Previous Topic:How to add views from other plugins to perspective
Next Topic:Context menu for a MultipageEditorPart
Goto Forum:
  


Current Time: Thu Apr 25 10:22:41 GMT 2024

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

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

Back to the top