blob: 1b98cb9b86520fb7035fe20e4bb4b135bbe5972f [file] [log] [blame]
package org.eclipse.debug.internal.ui;
/*
* Licensed Materials - Property of IBM,
* WebSphere Studio Workbench
* (c) Copyright IBM Corp 2000
*/
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.jface.viewers.IStructuredSelection;
public class SuspendActionDelegate extends ControlActionDelegate {
private static final String PREFIX= "suspend_action.";
/**
* @see ControlActionDelegate
*/
protected void doAction(Object element) throws DebugException {
if (element instanceof ISuspendResume) {
((ISuspendResume) element).suspend();
}
}
/**
* @see ControlActionDelegate
*/
public boolean isEnabledFor(Object element) {
return element instanceof ISuspendResume && ((ISuspendResume)element).canSuspend();
}
/**
* @see ControlActionDelegate
*/
public boolean getEnableStateForSelection(IStructuredSelection selection) {
if (selection.size() == 1) {
return isEnabledFor(selection.getFirstElement());
} else {
return false;
}
}
/**
* @see ControlActionDelegate
*/
protected String getPrefix() {
return PREFIX;
}
}