Inactive save button wiht new handler to save command [message #892305] |
Wed, 27 June 2012 16:49 |
jpfse Messages: 18 Registered: December 2011 |
Junior Member |
|
|
Hello,
I need to run a routine everytime the "save button" is pressed. To do that, I created a handler to the org.eclipse.ui.file.save command (see extension element detains.JPG).
I'm able to launch an eclipse application, but the save button is not enable, even when the file is edited (see inactiveSaveButton.JPG).
I will include also de handler file (OKInitializerSaveHandler.java).
I'm new to eclipse rcp, so I am finding it dificult to figure what the problem could be. Am I on the right path, at least?
Tanks!
[Updated on: Wed, 27 June 2012 16:50] Report message to a moderator
|
|
|
|
|
|
Re: Inactive save button wiht new handler to save command [message #892491 is a reply to message #892305] |
Thu, 28 June 2012 12:45 |
|
Hi João,
this is possible, I think that Eclipse ignores your own handler and uses the handler, which is defined by Default in Eclipse for the org.eclipse.ui.file.save command.
In order to tell Eclipse that it shall use your own handler, you´ll have to define an activeWhen for your handler, so that Eclipse knows when to use it´s own handler or your own handler.
The following page gives you a good overview concerning the Command Core Expressions:
wiki.eclipse.org/Command_Core_Expressions
By the way:
Quote:if I don't enable the handler, the save button will not enable?
The handler is enabled by default, so it is not necessary to enable it, you´ll just have to define when your handler should be active
Best regards,
Simon
[Updated on: Thu, 28 June 2012 12:48] Report message to a moderator
|
|
|
|
|
Re: Inactive save button wiht new handler to save command [message #892819 is a reply to message #892305] |
Fri, 29 June 2012 21:21 |
|
Hi João,
take a look at the JavaDoc concerning the Handler:
help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_ui_handlers.html
"handlers javadoc"
[...]
A handler that specifies no conditions is a default handler. A default handler is only active if no other handler has all of its conditions satisfied. If two handlers still have conditions that are satisfied, then the conditions are compared. The idea is to select a handler whose condition is more specific or more local. To do this, the variables referred to by the condition are looked at. The condition that refers to the most specific variable "wins". The order of specificity (from least specific to most specific) is suggested in org.eclipse.ui.ISources.
[...]
So if your activeWhen definition "wins", your own handler will be invoked.
"João"So when I make my handler active, the default eclipse handler is disabled?
Yes the eclipse handler wont be invoked, if your activeWhen definition "wins" and therefore your own handler is invoked.
Best regards,
Simon
|
|
|
Powered by
FUDForum. Page generated in 0.06684 seconds