Enable action in menubar? [message #529893] |
Tue, 27 April 2010 15:22 |
|
I have write an (GMF based) editor plugin. I have implement my own revert action and retargeted the global revert action to my revert action. I enable my revert action and everything works fine.
Only one thing is not working:
I want that the revert action is only enable if the editor is dirty. So I add a PropertyListener.
Every time the property is the same like IEditorPart.PROP_DIRTY I check the editor.isDirty() value and set the enable state of my revert action. But in the main menubar, the state of this action is not change. On the actionbar I tried updateActionBars() and getMenuManager().updateAll(true) without any effect. So how can I update the enable state of my revert action?
Thank You!
|
|
|
|
Re: Enable action in menubar? [message #532893 is a reply to message #529893] |
Tue, 11 May 2010 13:47 |
|
Thanks for your advice. Revert is an eclipse build-in Action. SourceProvider only works with Handlers?
But I solve my problem, by call setEnabled() twice:
setEnabled(!isDirty);
setEnabled(isDirty);
to make sure that firePropertyChange is called.
org.eclipse.jface.action.AbstractAction.firePropertyChange(ENABLED, oldVal, newVal);
|
|
|
|
Powered by
FUDForum. Page generated in 0.03454 seconds