KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > CloseAllPerspectivesAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.ui.internal;
12
13 import org.eclipse.ui.IPerspectiveDescriptor;
14 import org.eclipse.ui.IWorkbenchPage;
15 import org.eclipse.ui.IWorkbenchWindow;
16
17 /**
18  * The <code>CloseAllPerspectivesAction</code> is used to close all of
19  * the opened perspectives in the workbench window's active page.
20  */

21 public class CloseAllPerspectivesAction extends PerspectiveAction {
22
23     /**
24      * Create a new instance of <code>CloseAllPerspectivesAction</code>
25      *
26      * @param window the workbench window this action applies to
27      */

28     public CloseAllPerspectivesAction(IWorkbenchWindow window) {
29         super(window);
30         setText(WorkbenchMessages.CloseAllPerspectivesAction_text);
31         setActionDefinitionId("org.eclipse.ui.window.closeAllPerspectives"); //$NON-NLS-1$
32
// @issue missing action id
33
setToolTipText(WorkbenchMessages.CloseAllPerspectivesAction_toolTip);
34         window.getWorkbench().getHelpSystem().setHelp(this,
35                 IWorkbenchHelpContextIds.CLOSE_ALL_PAGES_ACTION);
36     }
37
38     /* (non-Javadoc)
39      * Method declared on PerspectiveAction.
40      */

41     protected void run(IWorkbenchPage page, IPerspectiveDescriptor persp) {
42         page.closeAllPerspectives(true, true);
43     }
44
45 }
46
Popular Tags