Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » question on visible when for command
question on visible when for command [message #334962] Thu, 12 March 2009 14:08 Go to next message
Carmelo  is currently offline Carmelo
Messages: 224
Registered: July 2009
Senior Member
I all ... I'm using eclipse 3.3 - the question is about a command.

I need to enable a command in my popup menu when the selected object is of a
particular type (adapt) and the item as got a property set (example delete
= true)

ok the first part about the object type ...

<visibleWhen>
<with variable="activeMenuSelection">
<iterate>
<adapt
type="xxx.yyy.files.eom.IEOMObjectItem">
</adapt>
</iterate>
</with>
</visibleWhen>

HOW TO ENABLE THE CHECK OF THE PROPERTY ...
with actionset I could use the ObjectState property ... I believe that here
I should use the test property ... but I don't know how to use it
Thanks
Kar
Re: question on visible when for command [message #334987 is a reply to message #334962] Fri, 13 March 2009 16:43 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Kar wrote:
> I all ... I'm using eclipse 3.3 - the question is about a command.
>
> I need to enable a command in my popup menu when the selected object is
> of a particular type (adapt) and the item as got a property set
> (example delete = true)
>
> ok the first part about the object type ...
>
> <visibleWhen>
> <with variable="activeMenuSelection">
> <iterate>
> <adapt
> type="xxx.yyy.files.eom.IEOMObjectItem">
> </adapt>
> </iterate>
> </with>
> </visibleWhen>
>
> HOW TO ENABLE THE CHECK OF THE PROPERTY ...
> with actionset I could use the ObjectState property ... I believe that
> here I should use the test property ... but I don't know how to use it
> Thanks
> Kar

Right, you would use adapt and then test:
<adapt type="xxx.yyy.files.eom.IEOMObjectItem">
<test property="com.example.myObj.delete" value="true"/>
</adapt>

You contribute property testers using the
org.eclipse.core.expressions.propertyTesters extension point and a
subclass of org.eclipse.core.expressions.PropertyTester

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/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Bundle update and buddy classloading
Next Topic:key bindings to command and action
Goto Forum:
  


Current Time: Thu Oct 30 14:34:39 GMT 2014

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

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