Testing and setting workbench button states [message #631628] |
Fri, 08 October 2010 05:07  |
Eclipse User |
|
|
|
Hi,
This is probably a simple one, but Google just buries me under piles of useless information, when I try to search for "Eclipse workbench" and related terms.
For an Editor I've put a button into the toolbar of the workbench, that toggles the view of the Editor. I'd like to be able to set its state from within the EditPart of my Diagram when switching tabs, to sync the current view state with the button. Also for some policies it would be really neat to access the state of the button, so they could adapt their behavior accordingly.
Regards,
Chris
|
|
|
|
|
Re: Testing and setting workbench button states [message #632696 is a reply to message #632248] |
Wed, 13 October 2010 18:42   |
Eclipse User |
|
|
|
Okay, now I understand your question. You were right. In general, the commands API is preferred over the actions API. According to the book Eclipse Plug-ins (Third Edition) at page 215:
Quote: | Commands and actions are two different APIs for accomplishing the same thing: declaring the implementing functions that manifest as menu items and toolbar buttons. The actions API has been around since before Eclipse 3.0, while the commands API has only just solidified as of Eclipse 3.3 with small refinements in Eclipse 3.4. It appears that at some point the actions API will be deprecated, moved into a compatibility layer and in the future removed, but much of the Eclipse tooling still makes extensive use of the actions API, not to mention third party tools and IDEs built on top of the Eclipse infrastructure.
|
However GEF has already made some decisions for us, and has done a lot of integration work between actions and GEF commands. For example, your action class, a subclass of GEF WorkbenchPartAction, will have access to your editor class and your GEF command class. No need to say those already defined relationship between many GEF classes in terms of storage and reference as I described in my last post.
I would suggest you to go with GEF design.
|
|
|
|
Powered by
FUDForum. Page generated in 0.18034 seconds