Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to enable a command for popups if the children of the selected element have an certain type
How to enable a command for popups if the children of the selected element have an certain type [message #636735] Tue, 02 November 2010 11:24 Go to next message
Eclipse User
Originally posted by: formatzeh.gmx.de

I declared a command and a handler for it. Now I want to enable the
command in popups. The point is that the command should be enabled when
right-clicking a folder (for example in the package explorer) and only
if the folder contains files of a certain type (for example a EMF
resource). Is it possible to declare this issue in the plugin.xml?

best regards,
Gilbert
Re: How to enable a command for popups if the children of the selected element have an certain type [message #636871 is a reply to message #636735] Wed, 03 November 2010 04:18 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 02/11/10 8:54 PM, Gilbert Mirenque wrote:
> I declared a command and a handler for it. Now I want to enable the
> command in popups. The point is that the command should be enabled when
> right-clicking a folder (for example in the package explorer) and only
> if the folder contains files of a certain type (for example a EMF
> resource). Is it possible to declare this issue in the plugin.xml?
>
> best regards,
> Gilbert

Check this:
http://www.eclipse-tips.com/tutorials/1-actions-vs-commands? start=1

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: How to enable a command for popups if the children of the selected element have an certain type [message #636947 is a reply to message #636871] Wed, 03 November 2010 09:37 Go to previous messageGo to next message
Eclipse User
Originally posted by: formatzeh.gmx.de

Hi Prakash,
thanks for the link. But what is described there is only how to
determine the explicit elements of the selection. That can be achieved
with that:

<activeWhen>
<with variable="selection">
<iterate operator="or">
<instanceof value="org.eclipse.core.resources.IFolder"/>
</iterate>
</with>
</activeWhen>

But what I need in addition to that is something like the following:

<enabledWhen>
<with variable="children">
<iterate operator="or">
<instanceof
value="org.eclipse.emf.ecore.resource.Resource"/>
</iterate>
</with>
</enabledWhen>

The point is that I want to check the children of the selected element.
Can this be achieved anyhow?

Prakash G.R. wrote:
> On 02/11/10 8:54 PM, Gilbert Mirenque wrote:
>> I declared a command and a handler for it. Now I want to enable the
>> command in popups. The point is that the command should be enabled when
>> right-clicking a folder (for example in the package explorer) and only
>> if the folder contains files of a certain type (for example a EMF
>> resource). Is it possible to declare this issue in the plugin.xml?
>>
>> best regards,
>> Gilbert
>
> Check this:
> http://www.eclipse-tips.com/tutorials/1-actions-vs-commands? start=1
>
Re: How to enable a command for popups if the children of the selected element have an certain type [message #636973 is a reply to message #636947] Wed, 03 November 2010 11:47 Go to previous message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 03/11/10 7:07 PM, Gilbert Mirenque wrote:
> But what I need in addition to that is something like the following:
>
> <enabledWhen>
> <with variable="children">
> <iterate operator="or">
> <instanceof
> value="org.eclipse.emf.ecore.resource.Resource"/>
> </iterate>
> </with>
> </enabledWhen>
>
> The point is that I want to check the children of the selected element.
> Can this be achieved anyhow?

How about writing a property tester for that?

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Previous Topic:perspectiveExtension for Property Pages?
Next Topic:Custom compare
Goto Forum:
  


Current Time: Thu Jul 31 13:35:19 EDT 2014

Powered by FUDForum. Page generated in 0.08516 seconds