KickJava   Java API By Example, From Geeks To Geeks.

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


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.Action;
14 import org.eclipse.swt.widgets.Display;
15 import org.eclipse.ui.internal.WorkbenchMessages;
16 import org.eclipse.ui.presentations.IPresentablePart;
17 import org.eclipse.ui.presentations.IStackPresentationSite;
18
19 /**
20  * @since 3.0
21  */

22 public class SystemMenuMovePane extends Action {
23
24     IStackPresentationSite site;
25     IPresentablePart part;
26
27     public SystemMenuMovePane(IStackPresentationSite site) {
28         this.site = site;
29         setText(WorkbenchMessages.SystemMenuMovePane_PaneName);
30     }
31
32     /* (non-Javadoc)
33      * @see org.eclipse.jface.action.IAction#run()
34      */

35     public void run() {
36         site.dragStart(part, Display.getDefault().getCursorLocation(), true);
37     }
38
39     public void setTarget(IPresentablePart part) {
40         this.part = part;
41         setEnabled(part != null && site.isPartMoveable(part));
42     }
43
44 }
45
Popular Tags