1 11 package org.eclipse.pde.internal.ui; 12 13 import org.eclipse.core.resources.ResourcesPlugin; 14 import org.eclipse.core.runtime.IAdaptable; 15 import org.eclipse.jface.action.Action; 16 import org.eclipse.ui.IWorkbenchPage; 17 import org.eclipse.ui.IWorkbenchWindow; 18 import org.eclipse.ui.PlatformUI; 19 import org.eclipse.ui.WorkbenchException; 20 21 public class OpenPDEPerspectiveAction extends Action { 22 public OpenPDEPerspectiveAction() { 23 } 24 25 public void run() { 26 IWorkbenchWindow window = PDEPlugin.getActiveWorkbenchWindow(); 27 IWorkbenchPage page = window.getActivePage(); 28 IAdaptable input; 29 if (page != null) 30 input = page.getInput(); 31 else 32 input = ResourcesPlugin.getWorkspace().getRoot(); 33 try { 34 PlatformUI.getWorkbench().showPerspective( 35 "org.eclipse.pde.ui.PDEPerspective", window, 37 input); 38 notifyResult(true); 39 40 } catch (WorkbenchException e) { 41 PDEPlugin.logException(e); 42 notifyResult(false); 43 } 44 } 45 } 46 | Popular Tags |