Wednesday, May 28, 2008

Adding action sets and wizards to perspective

Recently I had a requirement to add launch configuration to our custom perspective. Before looking into perspective source codes thats already there, i tried googling ...din get anything...then later I happened to see source code of Java Perspective and found out that we can add wizards,view shortcuts and action sets to our perspective like below:

// snippet code from JavaPerspectiveFactory class
public void createInitialLayout(IPageLayout layout) {

layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET); // line no A
layout.addActionSet(JavaUI.ID_ACTION_SET);

layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.JavaProjectWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$

}

Since my interest was to add launch configuration , I made use of line no A in my custom perspective and it served my purpose...

No comments: