blob: da1d591706add2f049d7bd5a03a4ad567051f33a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.internal.presentations;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.presentations.IPresentablePart;
import org.eclipse.ui.presentations.IStackPresentationSite;
/**
* @since 3.0
*/
public class SystemMenuMovePane extends Action implements ISelfUpdatingAction {
IStackPresentationSite site;
public SystemMenuMovePane(IStackPresentationSite site) {
this.site = site;
setText(WorkbenchMessages.getString("SystemMenuMovePane.PaneName")); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
site.dragStart(site.getSelectedPart(), Display.getDefault().getCursorLocation(), true);
}
public void update() {
IPresentablePart part = site.getSelectedPart();
setEnabled(part != null && site.isPartMoveable(part));
}
public boolean shouldBeVisible() {
return true;
}
}