Create and open a custom view

1. Add view extension: org.eclipse.ui.views


2. Add Category to view extension

What is a category?

From the show view dialog of Eclipse, the "folder" is a category which is a view collection.

view category

Add a "custom plugin views" category and modify the id: CustomPlugin.views.category name: custom plugin views

edit id and name of cateogry

3. Add view to the extension and edit the id, name, category and class

edit id, name and category of view

When we create view class, we often add ID to the class for conveniently called by other code. The ID should be same with the content of id above.

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;

public class ExampleView1 extends ViewPart {
public static final String ID = "CustomPlugin.views.ExampleView1";
	public ExampleView1() {
		// TODO Auto-generated constructor stub

	public void createPartControl(Composite parent) {
		// TODO Auto-generated method stub
		Text text = new Text(parent, SWT.BORDER);
		text.setText("Hello View");

	public void setFocus() {
		// TODO Auto-generated method stub



4. Result

show view custom view

Tips: Generally, we won't open view through show view dialog. In this case, we can use PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewId); to show view in our program.