KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > util > StandardEditorSystemMenu


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.presentations.util;
12
13 import org.eclipse.jface.action.Separator;
14 import org.eclipse.swt.graphics.Point;
15 import org.eclipse.swt.widgets.Control;
16 import org.eclipse.ui.internal.WorkbenchMessages;
17 import org.eclipse.ui.internal.presentations.SystemMenuCloseAll;
18 import org.eclipse.ui.internal.presentations.SystemMenuCloseOthers;
19 import org.eclipse.ui.internal.presentations.SystemMenuNewEditor;
20 import org.eclipse.ui.presentations.IPresentablePart;
21 import org.eclipse.ui.presentations.IStackPresentationSite;
22
23 /**
24  * Implements the standard system menu used by the default presentation.
25  * Not intended to be subclassed by clients
26  *
27  * @since 3.1
28  */

29 public class StandardEditorSystemMenu extends StandardViewSystemMenu {
30
31     private SystemMenuCloseOthers closeOthers;
32     private SystemMenuCloseAll closeAll;
33     private SystemMenuNewEditor openAgain;
34     
35     /**
36      * @param site
37      */

38     public StandardEditorSystemMenu(IStackPresentationSite site) {
39         super(site);
40         
41         closeOthers = new SystemMenuCloseOthers(site);
42         closeAll = new SystemMenuCloseAll(site);
43         openAgain = new SystemMenuNewEditor(site);
44         menuManager.add(closeOthers);
45         menuManager.add(closeAll);
46         menuManager.add(new Separator());
47         menuManager.add(openAgain);
48     }
49
50     String JavaDoc getMoveMenuText() {
51         return WorkbenchMessages.EditorPane_moveEditor;
52     }
53     
54     /* (non-Javadoc)
55      * @see org.eclipse.ui.internal.presentations.util.ISystemMenu#show(org.eclipse.swt.widgets.Control, org.eclipse.swt.graphics.Point, org.eclipse.ui.presentations.IPresentablePart)
56      */

57     public void show(Control parent, Point displayCoordinates,
58             IPresentablePart currentSelection) {
59         closeOthers.setTarget(currentSelection);
60         closeAll.update();
61         openAgain.setTarget(currentSelection);
62         super.show(parent, displayCoordinates, currentSelection);
63     }
64 }
65
Popular Tags