KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > SystemMenuMove


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;
12
13 import org.eclipse.jface.action.MenuManager;
14 import org.eclipse.ui.internal.WorkbenchMessages;
15 import org.eclipse.ui.presentations.IPresentablePart;
16 import org.eclipse.ui.presentations.IStackPresentationSite;
17
18 public class SystemMenuMove extends MenuManager {
19
20     private IStackPresentationSite stackPresentationSite;
21
22     private SystemMenuMovePane movePaneAction;
23
24     private SystemMenuMoveFolder moveFolderAction;
25     private boolean assumeActivePart = false;
26
27     public SystemMenuMove(IStackPresentationSite stackPresentationSite,
28             String JavaDoc partName) {
29         this(stackPresentationSite, partName, true);
30     }
31     
32     public SystemMenuMove(IStackPresentationSite stackPresentationSite,
33             String JavaDoc partName, boolean assumeActivePart) {
34         super(WorkbenchMessages.PartPane_move);
35         this.stackPresentationSite = stackPresentationSite;
36         this.assumeActivePart = assumeActivePart;
37
38         movePaneAction = new SystemMenuMovePane(stackPresentationSite);
39         movePaneAction.setText(partName);
40         moveFolderAction = new SystemMenuMoveFolder(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 }
64
Popular Tags