KickJava   Java API By Example, From Geeks To Geeks.

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


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.IWorkbenchWindow;
14
15 /**
16  * Action for showing a view.
17  */

18 public class ShowViewMenuAction extends ShowPartPaneMenuAction {
19
20     /**
21      * Constructor for ShowViewMenuAction.
22      * @param window
23      */

24     public ShowViewMenuAction(IWorkbenchWindow window) {
25         super(window);
26         // @issue missing action id
27
window.getWorkbench().getHelpSystem().setHelp(this,
28                 IWorkbenchHelpContextIds.SHOW_VIEW_MENU_ACTION);
29         setActionDefinitionId("org.eclipse.ui.window.showViewMenu"); //$NON-NLS-1$
30
}
31
32     /**
33      * Initialize the menu text and tooltip.
34      */

35     protected void initText() {
36         setText(WorkbenchMessages.ShowViewMenuAction_text);
37         setToolTipText(WorkbenchMessages.ShowViewMenuAction_toolTip);
38     }
39
40     /**
41      * Show the pane title menu.
42      */

43     protected void showMenu(PartPane pane) {
44         pane.showPaneMenu();
45     }
46
47     /**
48      * Updates the enabled state.
49      */

50     protected void updateState() {
51         super.updateState();
52
53         //All of the conditions in the super class passed
54
//now check for the menu.
55
if (isEnabled()) {
56             PartPane pane = (((PartSite) getActivePart().getSite()).getPane());
57             setEnabled((pane instanceof ViewPane)
58                     && ((ViewPane) pane).hasViewMenu());
59         }
60     }
61     
62 }
63
Popular Tags