Using Fast Views in Eclipse RCP

In Adding the error view to RCP application one commenter asked how he could add a view as a fast view to an Eclipse RCP application.

To add views as fast view to your RCP application you have to do two things:

1.) Add your view as “fast” via the perspective extension point

fastview10

2.) Activate the FastViewBar via the ApplicationWorkbenchWindow Advisor (configurer.setShowFastViewBars(true);)

[sourcecode language=”java”]

package de.vogella.test;

import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {

public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
super(configurer);
}

@Override
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
return new ApplicationActionBarAdvisor(configurer);
}

@Override
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();

configurer.setInitialSize(new Point(1024, 800));
configurer.setShowStatusLine(true);
configurer.setTitle("Network Analyser");
configurer.setShowFastViewBars(true);
}

}
[/sourcecode]

This should be sufficient to show your view in your RCP application in the fast view pane.

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences,

He is the primary author of vogella.com. With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.

This entry was posted in Eclipse and tagged , . Bookmark the permalink.