Customize Eclipse ToolBar, Menus and visible editors depending on the current Perspective

We decided here at activeeon , to build an Eclipse RCP product, that we will call the ProActive Studio , containing the functionalities of all of our current RPC products.
Doing this will allow us to release, if needed, products containing subsets of our current RCPS.

Our current RCP Products are:

  • IC2D – a product for monitoring and (remote)debugging of distributed applications. This is mainly used by programmers
  • Scheduler Client – A client GUI for monitoring and administration of our Scheduler Server
  • Resource Manager Client – the same, for our Resource Manager Server
  • The Workflow Studio … but not the least … – I’m the project leader for this product 🙂 – is an Eclipse GMF-based application providing a graphical environment for the design and execution of distributed workflows .
  • As all of these products are based on Eclipse Plugins, all we have to do is just include them within a single product (well, small refactoring is needed, especially for avoiding library import duplications, but this is not the scope of this article).

    Each product comes with its own perspective and contributes buttons to the toolbar, menus in the main menu and may provide editors (for example the Workflow Studio Editor for Workflow Diagrams)

    Well, putting everything together within a single product results in a workbench with a lot of menus and a lot of buttons on the toolbar contributed by all the plugins.

    We would like, for instance, to have, while the Resource Manager Perspective is active, only the toolbar buttons
    and the menus which make sens for that perspective.

    Here’s an examle:

    In the picture, the WorkflowDesign Perspective is selected and an Editor (which, from the logical point of view does belong to that perspective) is opened. However I can see, on the toolbar, buttons contributed by the Resource Manager plugin, which i would like to show only in the Resource Manager Perspective. In tyhe current Perspective, those buttons don’t make sense. The same for the menus.

    In the same way, I would like, when changing to the Resource Manager Perspective, my current editor (the one with a flow diagram in the picture) to be hidden, but not closed, so I could come back to its current state when re-changing the perspective. By default, in Eclipse, when changing to another perspective, the views corresponding to that perspective will be shown, but the editors area is the same for all perspectives, and the editors remain the same (when you switch, from your java perspective, to the debug perspective or team synchronizing perspecive or any other) you will still be able to see all of your opened java files.
    But in my case, I would like to hide my editors, as the new perspective is only meant for monitoring and not an editing.

    Just one more consideration before start working: The buttons and menus in my product can be contributed via 2 different ways:

    – by providing extensions in the plugin xml file
    – by writing java code (usually in the AppplicationActionBarAdvisor class).

    We will see, for each of these cases, how to customize the perspectives.

    All the blah blah in this post leads us to these 3 sections:

    My next posts will treat on these subjects.

This entry was posted in Eclipse RCP. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s