In Eclipse RCP, how do I disable a save toolbar button according to the "dirty" property in editor

Posted by paulgreg on Stack Overflow See other posts from Stack Overflow or by paulgreg
Published on 2009-03-16T14:57:58Z Indexed on 2010/05/30 8:42 UTC
Read the original article Hit count: 814

Filed under:
|

In my eclipse RCP 3.3 application, I would like to enable or disable a 'save' toolbar button according to current editor dirty flag.

I'm trying to use the <enabledWhen> tag but I can't make it work.

Here's the portion of code in plugin.xml :

<command
 commandId="org.acme.command.save"
 icon="icons/save.png"
 id="org.acme.command.save"
 style="push">
 <enabledWhen>
    <instanceof value="activeEditor"/>
     <test property="dirty" value="true"/>
 </enabledWhen>
</command>

Do you have any idea how that is supposed to work ?

© Stack Overflow or respective owner

Related posts about java

Related posts about eclipse-rcp