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;
11:
12: import org.eclipse.jface.action.MenuManager;
13: import org.eclipse.ui.internal.WorkbenchMessages;
14: import org.eclipse.ui.presentations.IPresentablePart;
15: import org.eclipse.ui.presentations.IStackPresentationSite;
16:
17: public class SystemMenuMove extends MenuManager {
18:
19: private IStackPresentationSite stackPresentationSite;
20:
21: private SystemMenuMovePane movePaneAction;
22:
23: private SystemMenuMoveFolder moveFolderAction;
24: private boolean assumeActivePart = false;
25:
26: public SystemMenuMove(IStackPresentationSite stackPresentationSite,
27: String partName) {
28: this (stackPresentationSite, partName, true);
29: }
30:
31: public SystemMenuMove(IStackPresentationSite stackPresentationSite,
32: String partName, boolean assumeActivePart) {
33: super (WorkbenchMessages.PartPane_move);
34: this .stackPresentationSite = stackPresentationSite;
35: this .assumeActivePart = assumeActivePart;
36:
37: movePaneAction = new SystemMenuMovePane(stackPresentationSite);
38: movePaneAction.setText(partName);
39: moveFolderAction = new SystemMenuMoveFolder(
40: stackPresentationSite);
41:
42: add(movePaneAction);
43: add(moveFolderAction);
44: }
45:
46: public void setTarget(IPresentablePart part) {
47: movePaneAction.setTarget(part);
48: }
49:
50: /* (non-Javadoc)
51: * @see org.eclipse.jface.action.MenuManager#update(boolean, boolean)
52: */
53: protected void update(boolean force, boolean recursive) {
54: if (assumeActivePart) {
55: setTarget(stackPresentationSite.getSelectedPart());
56: }
57:
58: moveFolderAction.update();
59:
60: super.update(force, recursive);
61: }
62:
63: }
|