package net.sf.findbugs.master; import java.net.URL; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.application.IWorkbenchConfigurer; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchAdvisor; import org.eclipse.ui.application.WorkbenchWindowAdvisor; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; import org.osgi.framework.Bundle; /** * This workbench advisor creates the window advisor, and specifies the * perspective id for the initial window. */ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { //private static final String PERSPECTIVE_ID = "de.tobject.findbugs.FindBugsPerspective"; private static final String PERSPECTIVE_ID = "org.eclipse.ui.resourcePerspective"; //private static final String PERSPECTIVE_ID = "org.eclipse.jdt.ui.JavaPerspective"; public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor( IWorkbenchWindowConfigurer configurer) { return new ApplicationWorkbenchWindowAdvisor(configurer); } public String getInitialWindowPerspectiveId() { return PERSPECTIVE_ID; } public void initialize(IWorkbenchConfigurer configurer) { IDE.registerAdapters(); final String ICONS_PATH = "icons/full/"; final String PATH_OBJECT = ICONS_PATH + "obj16/"; Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH); declareWorkbenchImage(configurer, ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif", true); declareWorkbenchImage(configurer, ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT + "cprj_obj.gif", true); super.initialize(configurer); configurer.setSaveAndRestore(true); } private void declareWorkbenchImage(IWorkbenchConfigurer configurer_p, Bundle ideBundle, String symbolicName, String path, boolean shared) { URL url = ideBundle.getEntry(path); ImageDescriptor desc = ImageDescriptor.createFromURL(url); configurer_p.declareImage(symbolicName, desc, shared); } }