How to customize workbench in a plugin for Eclipse 4 application

67 Views Asked by At

We are using an Eclipse application, currently developed on Eclipse 3 architecture. We have developed a custom plugin for that application. We are now upgrading this application to a new version that's based on Eclipse 4 architecture. I am tasked with migrating the custom plugin from Eclipse 3 to Eclipse 4 architecture to be used with the upgraded version of the application. I have bit of Eclipse plugin development experience, but migrating from Eclipse 3 to Eclipse 4 architecture is my first. So, excuse me while I explain/ask my questions.

I found one existing question - eclipse rcp 4 - customize workbench. But that question is not answered.

Perspective Header Added to Workbench

The plugin on Eclipse 3 architecture customizes the workbench, to provide tabs for open and commonly used perspectives (as shown in screenshot), by:

  1. Defined an extension for org.eclipse.core.runtime.applications. Implementation of this extension is in CustomApplication class. CustomApplication class extends the application class from the Eclipse application.
  2. Inside the CustomApplication class, called PlatformUI.createAndRunWorkbench() by passing custom implementation of WorkbenchAdvisor - CustomWorkbenchAdvisor class.
  3. Inside the createWorkbenchWindowAdvisor() method of the CustomWorkbenchAdvisor, created custom WorkbenchWindowAdvisor - CustomWorkbenchWindowAdvisor class.
  4. Inside the createWindowContents() method of the CustomWorkbenchWindowAdvisor, created a custom CustomPerspectiveHeader class to manage those tabs. This class creates tab representation of open & commonly used perspectives. This allows user to switch perspective just by clicking on the tab instead of going through Windows menu. It also provides important information on the perspective header space - such as the user name and group/role that user has logged in. When user clicks on a tab, that perspective opens below.

Eclipse 4 has new mechanism to customize windows layout using application model (via e4xmi file), and createWindowContents() method of the WorkbenchWindowAdvisor is deprecated.

I don't understand how to create/setup/configure e4xmi file for my custom plugin to provide for the Perspective Header space on top of the application UI. I followed tutorial from https://www.vogella.com/ but those tutorials refer to application model in the context of new Eclipse application develipment and not in the context of plugin development for an existing application.

Using application model (e4xmi file) can I just add my plugin workbench changes (the perspective header) on top of what the application provides or do I need to provide the entire workbench layout in my plugin application model?

0

There are 0 best solutions below