01: /*******************************************************************************
02: * Copyright (c) 2004, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.presentations.util;
11:
12: import org.eclipse.jface.action.Separator;
13: import org.eclipse.swt.graphics.Point;
14: import org.eclipse.swt.widgets.Control;
15: import org.eclipse.ui.internal.WorkbenchMessages;
16: import org.eclipse.ui.internal.presentations.SystemMenuCloseAll;
17: import org.eclipse.ui.internal.presentations.SystemMenuCloseOthers;
18: import org.eclipse.ui.internal.presentations.SystemMenuNewEditor;
19: import org.eclipse.ui.presentations.IPresentablePart;
20: import org.eclipse.ui.presentations.IStackPresentationSite;
21:
22: /**
23: * Implements the standard system menu used by the default presentation.
24: * Not intended to be subclassed by clients
25: *
26: * @since 3.1
27: */
28: public class StandardEditorSystemMenu extends StandardViewSystemMenu {
29:
30: private SystemMenuCloseOthers closeOthers;
31: private SystemMenuCloseAll closeAll;
32: private SystemMenuNewEditor openAgain;
33:
34: /**
35: * @param site
36: */
37: public StandardEditorSystemMenu(IStackPresentationSite site) {
38: super (site);
39:
40: closeOthers = new SystemMenuCloseOthers(site);
41: closeAll = new SystemMenuCloseAll(site);
42: openAgain = new SystemMenuNewEditor(site);
43: menuManager.add(closeOthers);
44: menuManager.add(closeAll);
45: menuManager.add(new Separator());
46: menuManager.add(openAgain);
47: }
48:
49: String getMoveMenuText() {
50: return WorkbenchMessages.EditorPane_moveEditor;
51: }
52:
53: /* (non-Javadoc)
54: * @see org.eclipse.ui.internal.presentations.util.ISystemMenu#show(org.eclipse.swt.widgets.Control, org.eclipse.swt.graphics.Point, org.eclipse.ui.presentations.IPresentablePart)
55: */
56: public void show(Control parent, Point displayCoordinates,
57: IPresentablePart currentSelection) {
58: closeOthers.setTarget(currentSelection);
59: closeAll.update();
60: openAgain.setTarget(currentSelection);
61: super.show(parent, displayCoordinates, currentSelection);
62: }
63: }
|