How to use Eclipse RCP command framework Save command with the default save action? -
the eclipse rcp command framework intended replace action framework mechanism allowing plugins contribute ui commands workbench. defining new commands, plugins may provide handlers default rcp commands such "org.eclipse.ui.file.save" (full list of default commands here: http://svn2.assembla.com/svn/eclipsecommands/trunk/eclipsecommands/contents/article.html).
using default commands brings advantages of standard key bindings , icons, , in cases ability use built-in eclipse actions.
for example default editor save command can added file menu following snippet in plugin.xml:
<extension point="org.eclipse.ui.menus"> <menucontribution locationuri="menu:file"> <command commandid="org.eclipse.ui.file.save" style="push"> </command> </menucontribution> </extension>
a handler can defined command adding handler definition in handlers extension point in plugin.xml. if, however, editors being contributed implement ieditorpart, should possible use built-in eclipse save action (which takes care of tracking active editor , dirty property updates) instead of defining new handler. further steps necessary use built-in save action?
it necessary call actionbaradvisor.register() make save action available. example:
public class myactionbaradvisor extends actionbaradvisor { public myactionbaradvisor(iactionbarconfigurer configurer) { super(configurer); } protected void makeactions(final iworkbenchwindow window) { register(actionfactory.save.create(window)); } }
given addition plugin.xml in question, built-in save handler invoked active editor.
Comments
Post a Comment