1 11 package org.eclipse.team.internal.ccvs.ui.actions; 12 13 14 import org.eclipse.jface.action.Action; 15 import org.eclipse.ui.IPerspectiveDescriptor; 16 import org.eclipse.ui.IWorkbench; 17 import org.eclipse.ui.IWorkbenchPage; 18 import org.eclipse.ui.IWorkbenchWindow; 19 import org.eclipse.ui.PlatformUI; 20 21 public class ShowCVSPerspectiveAction extends Action { 22 public void run() { 23 IWorkbench workbench = PlatformUI.getWorkbench(); 24 IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow(); 25 if (activeWindow == null) { 26 return; 27 } 28 IWorkbenchPage activePage = activeWindow.getActivePage(); 29 if (activePage == null) { 30 return; 31 } 32 IPerspectiveDescriptor cvsPerspective = workbench.getPerspectiveRegistry().findPerspectiveWithId("org.eclipse.team.cvs.ui.cvsPerspective"); if(cvsPerspective!=null) { 34 activePage.setPerspective(cvsPerspective); 35 } 36 } 37 } 38 | Popular Tags |