KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > actions > ShowCVSPerspectiveAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

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"); //$NON-NLS-1$
33
if(cvsPerspective!=null) {
34             activePage.setPerspective(cvsPerspective);
35         }
36     }
37 }
38
Popular Tags