How to enable a command for popups if the children of the selected element have an certain type [message #636735] |
Tue, 02 November 2010 15:24 |
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 #636947 is a reply to message #636871] |
Wed, 03 November 2010 13:37 |
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
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03219 seconds