mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
Added restart and breakpoint actions.
This commit is contained in:
parent
b9323185f0
commit
ec51c065a0
12 changed files with 1003 additions and 2 deletions
|
@ -13,6 +13,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
|
import org.eclipse.cdt.debug.core.IRestart;
|
||||||
import org.eclipse.cdt.debug.core.IStackFrameInfo;
|
import org.eclipse.cdt.debug.core.IStackFrameInfo;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
|
@ -35,7 +36,8 @@ import org.eclipse.debug.core.model.IVariable;
|
||||||
*/
|
*/
|
||||||
public class CStackFrame extends CDebugElement
|
public class CStackFrame extends CDebugElement
|
||||||
implements IStackFrame,
|
implements IStackFrame,
|
||||||
IStackFrameInfo,
|
IStackFrameInfo,
|
||||||
|
IRestart,
|
||||||
ICDIEventListener
|
ICDIEventListener
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -716,4 +718,22 @@ public class CStackFrame extends CDebugElement
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.IRestart#canRestart()
|
||||||
|
*/
|
||||||
|
public boolean canRestart()
|
||||||
|
{
|
||||||
|
return getDebugTarget() instanceof IRestart && ((IRestart)getDebugTarget()).canRestart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.IRestart#restart()
|
||||||
|
*/
|
||||||
|
public void restart() throws DebugException
|
||||||
|
{
|
||||||
|
if ( canRestart() )
|
||||||
|
{
|
||||||
|
((IRestart)getDebugTarget()).restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.IInstructionStep;
|
import org.eclipse.cdt.debug.core.IInstructionStep;
|
||||||
|
import org.eclipse.cdt.debug.core.IRestart;
|
||||||
import org.eclipse.cdt.debug.core.IState;
|
import org.eclipse.cdt.debug.core.IState;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint;
|
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint;
|
||||||
|
@ -47,6 +48,7 @@ import org.eclipse.debug.core.model.IThread;
|
||||||
public class CThread extends CDebugElement
|
public class CThread extends CDebugElement
|
||||||
implements IThread,
|
implements IThread,
|
||||||
IState,
|
IState,
|
||||||
|
IRestart,
|
||||||
IInstructionStep,
|
IInstructionStep,
|
||||||
ICDIEventListener
|
ICDIEventListener
|
||||||
{
|
{
|
||||||
|
@ -901,4 +903,22 @@ public class CThread extends CDebugElement
|
||||||
{
|
{
|
||||||
return fRefreshChildren;
|
return fRefreshChildren;
|
||||||
}
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.IRestart#canRestart()
|
||||||
|
*/
|
||||||
|
public boolean canRestart()
|
||||||
|
{
|
||||||
|
return getDebugTarget() instanceof IRestart && ((IRestart)getDebugTarget()).canRestart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.IRestart#restart()
|
||||||
|
*/
|
||||||
|
public void restart() throws DebugException
|
||||||
|
{
|
||||||
|
if ( canRestart() )
|
||||||
|
{
|
||||||
|
((IRestart)getDebugTarget()).restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/restart.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/restart.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 180 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/restart.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/restart.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/restart.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/restart.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 129 B |
|
@ -9,4 +9,8 @@ RegistersView.name=Registers
|
||||||
MemoryView.name=Memory
|
MemoryView.name=Memory
|
||||||
|
|
||||||
MemoryPreferencePage.name=Memory Views
|
MemoryPreferencePage.name=Memory Views
|
||||||
CDebuggerPage.name=C Debugger UI Page
|
CDebuggerPage.name=C Debugger UI Page
|
||||||
|
|
||||||
|
DebugActionSet.label=DebugActionSet
|
||||||
|
RestartAction.label=Restart
|
||||||
|
RestartAction.tooltip=Restart
|
||||||
|
|
|
@ -73,5 +73,68 @@
|
||||||
id="org.eclipse.cdt.debug.ui.MemoryViewPreferencePage">
|
id="org.eclipse.cdt.debug.ui.MemoryViewPreferencePage">
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.actionSets">
|
||||||
|
<actionSet
|
||||||
|
label="%DebugActionSet.label"
|
||||||
|
id="org.eclipse.cdt.debug.ui.debugActionSet">
|
||||||
|
<action
|
||||||
|
id="org.eclipse.cdt.debug.ui.internal.actions.RestartActionDelegate"
|
||||||
|
hoverIcon="icons/full/clcl16/restart.gif"
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.actions.RestartActionDelegate"
|
||||||
|
disabledIcon="icons/full/dlcl16/restart.gif"
|
||||||
|
enablesFor="1"
|
||||||
|
icon="icons/full/elcl16/restart.gif"
|
||||||
|
helpContextId="restart_action_context"
|
||||||
|
label="%RestartAction.label"
|
||||||
|
menubarPath="org.eclipse.ui.run/stepGroup">
|
||||||
|
</action>
|
||||||
|
</actionSet>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.popupMenus">
|
||||||
|
<viewerContribution
|
||||||
|
targetID="org.eclipse.debug.ui.DebugView"
|
||||||
|
id="org.eclipse.cdt.debug.ui.debugview.popupMenu">
|
||||||
|
<action
|
||||||
|
label="%RestartAction.label"
|
||||||
|
icon="icons/full/clcl16/restart.gif"
|
||||||
|
helpContextId="restart_action_context"
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.actions.RestartActionDelegate"
|
||||||
|
menubarPath="threadGroup"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.debug.internal.ui.actions.RestartActionDelegate">
|
||||||
|
</action>
|
||||||
|
</viewerContribution>
|
||||||
|
<viewerContribution
|
||||||
|
targetID="org.eclipse.cdt.ui.editor.CEditor.RulerContext"
|
||||||
|
id="org.eclipse.cdt.debug.ui.CEditorPopupActions">
|
||||||
|
<action
|
||||||
|
label="%AbbBreakpoint.label"
|
||||||
|
helpContextId="manage_breakpoint_action_context"
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
|
||||||
|
id="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate">
|
||||||
|
</action>
|
||||||
|
</viewerContribution>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.viewActions">
|
||||||
|
<viewContribution
|
||||||
|
targetID="org.eclipse.debug.ui.DebugView"
|
||||||
|
id="org.eclipse.cdt.debug.ui.debugview.toolbar">
|
||||||
|
<action
|
||||||
|
toolbarPath="threadGroup"
|
||||||
|
id="org.eclipse.cdt.debug.internal.ui.actions.RestartActionDelegate"
|
||||||
|
hoverIcon="icons/full/clcl16/restart.gif"
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.actions.RestartActionDelegate"
|
||||||
|
disabledIcon="icons/full/dlcl16/restart.gif"
|
||||||
|
enablesFor="1"
|
||||||
|
icon="icons/full/elcl16/restart.gif"
|
||||||
|
helpContextId="restart_action_context"
|
||||||
|
label="%RestartAction.label"
|
||||||
|
tooltip="%RestartAction.tooltip">
|
||||||
|
</action>
|
||||||
|
</viewContribution>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,331 @@
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) Copyright IBM Corp. 2000, 2001.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.swt.custom.BusyIndicator;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.ui.ISelectionListener;
|
||||||
|
import org.eclipse.ui.IViewActionDelegate;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
|
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
||||||
|
|
||||||
|
public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowActionDelegate, IViewActionDelegate, ISelectionListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The underlying action for this delegate
|
||||||
|
*/
|
||||||
|
private IAction fAction;
|
||||||
|
/**
|
||||||
|
* This action's view part, or <code>null</code>
|
||||||
|
* if not installed in a view.
|
||||||
|
*/
|
||||||
|
private IViewPart fViewPart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache of the most recent seletion
|
||||||
|
*/
|
||||||
|
private IStructuredSelection fSelection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this delegate has been initialized
|
||||||
|
*/
|
||||||
|
private boolean fInitialized = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The window associated with this action delegate
|
||||||
|
* May be <code>null</code>
|
||||||
|
*/
|
||||||
|
protected IWorkbenchWindow fWindow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It's crucial that delegate actions have a zero-arg constructor so that
|
||||||
|
* they can be reflected into existence when referenced in an action set
|
||||||
|
* in the plugin's plugin.xml file.
|
||||||
|
*/
|
||||||
|
public AbstractDebugActionDelegate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IWorkbenchWindowActionDelegate#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose(){
|
||||||
|
if (getWindow() != null) {
|
||||||
|
getWindow().getSelectionService().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
|
||||||
|
*/
|
||||||
|
public void init(IWorkbenchWindow window){
|
||||||
|
// listen to selection changes in the debug view
|
||||||
|
setWindow(window);
|
||||||
|
window.getSelectionService().addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IActionDelegate#run(IAction)
|
||||||
|
*/
|
||||||
|
public void run(IAction action){
|
||||||
|
IStructuredSelection selection= getSelection();
|
||||||
|
|
||||||
|
final Iterator enum= selection.iterator();
|
||||||
|
String pluginId= DebugUIPlugin.getUniqueIdentifier();
|
||||||
|
final MultiStatus ms=
|
||||||
|
new MultiStatus(pluginId, DebugException.REQUEST_FAILED, getStatusMessage(), null);
|
||||||
|
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
while (enum.hasNext()) {
|
||||||
|
Object element= enum.next();
|
||||||
|
try {
|
||||||
|
doAction(element);
|
||||||
|
} catch (DebugException e) {
|
||||||
|
ms.merge(e.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!ms.isOK()) {
|
||||||
|
IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow();
|
||||||
|
if (window != null) {
|
||||||
|
DebugUIPlugin.errorDialog(window.getShell(), getErrorDialogTitle(), getErrorDialogMessage(), ms);
|
||||||
|
} else {
|
||||||
|
DebugUIPlugin.log(ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the icons for this action on the first selection changed
|
||||||
|
* event. This is necessary because the XML currently only
|
||||||
|
* supports setting the enabled icon.
|
||||||
|
* <p>
|
||||||
|
* AbstractDebugActionDelegates come in 2 flavors: IViewActionDelegate,
|
||||||
|
* IWorkbenchWindowActionDelegate delegates.
|
||||||
|
* </p>
|
||||||
|
* <ul>
|
||||||
|
* <li>IViewActionDelegate delegate: getView() != null</li>
|
||||||
|
* <li>IWorkbenchWindowActionDelegate: getView == null</li>
|
||||||
|
* </ul>
|
||||||
|
* <p>
|
||||||
|
* Only want to call update(action, selection) for IViewActionDelegates.
|
||||||
|
* An initialize call to update(action, selection) is made for all flavors to set the initial
|
||||||
|
* enabled state of the underlying action.
|
||||||
|
* IWorkbenchWindowActionDelegate's listen to selection changes
|
||||||
|
* in the debug view only.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @see IActionDelegate#selectionChanged(IAction, ISelection)
|
||||||
|
*/
|
||||||
|
public void selectionChanged(IAction action, ISelection s) {
|
||||||
|
boolean wasInitialized= initialize(action, s);
|
||||||
|
if (!wasInitialized) {
|
||||||
|
if (getView() != null) {
|
||||||
|
update(action, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void update(IAction action, ISelection s) {
|
||||||
|
if (s instanceof IStructuredSelection) {
|
||||||
|
IStructuredSelection ss = (IStructuredSelection)s;
|
||||||
|
action.setEnabled(getEnableStateForSelection(ss));
|
||||||
|
setSelection(ss);
|
||||||
|
} else {
|
||||||
|
action.setEnabled(false);
|
||||||
|
setSelection(StructuredSelection.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether the action should be enabled or not based on the given selection.
|
||||||
|
*/
|
||||||
|
protected boolean getEnableStateForSelection(IStructuredSelection selection) {
|
||||||
|
if (selection.size() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Iterator enum= selection.iterator();
|
||||||
|
int count= 0;
|
||||||
|
while (enum.hasNext()) {
|
||||||
|
count++;
|
||||||
|
if (count > 1 && !enableForMultiSelection()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Object element= enum.next();
|
||||||
|
if (!isEnabledFor(element)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this action should be enabled if there is
|
||||||
|
* multi selection.
|
||||||
|
*/
|
||||||
|
protected boolean enableForMultiSelection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the specific action on this element.
|
||||||
|
*/
|
||||||
|
protected abstract void doAction(Object element) throws DebugException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this action will work for the given element
|
||||||
|
*/
|
||||||
|
protected abstract boolean isEnabledFor(Object element);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the String to use as an error dialog title for
|
||||||
|
* a failed action. Default is to return null.
|
||||||
|
*/
|
||||||
|
protected String getErrorDialogTitle(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the String to use as an error dialog message for
|
||||||
|
* a failed action. This message appears as the "Message:" in
|
||||||
|
* the error dialog for this action.
|
||||||
|
* Default is to return null.
|
||||||
|
*/
|
||||||
|
protected String getErrorDialogMessage(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the String to use as a status message for
|
||||||
|
* a failed action. This message appears as the "Reason:"
|
||||||
|
* in the error dialog for this action.
|
||||||
|
* Default is to return the empty String.
|
||||||
|
*/
|
||||||
|
protected String getStatusMessage(){
|
||||||
|
return ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IViewActionDelegate#init(IViewPart)
|
||||||
|
*/
|
||||||
|
public void init(IViewPart view) {
|
||||||
|
fViewPart = view;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this action's view part, or <code>null</code>
|
||||||
|
* if not installed in a view.
|
||||||
|
*
|
||||||
|
* @return view part or <code>null</code>
|
||||||
|
*/
|
||||||
|
protected IViewPart getView() {
|
||||||
|
return fViewPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize this delegate, updating this delegate's
|
||||||
|
* presentation.
|
||||||
|
* As well, all of the flavors of AbstractDebugActionDelegates need to
|
||||||
|
* have the initial enabled state set with a call to update(IAction, ISelection).
|
||||||
|
*
|
||||||
|
* @param action the presentation for this action
|
||||||
|
* @return whether the action was initialized
|
||||||
|
*/
|
||||||
|
protected boolean initialize(IAction action, ISelection selection) {
|
||||||
|
if (!isInitialized()) {
|
||||||
|
setAction(action);
|
||||||
|
if (getView() == null) {
|
||||||
|
//update on the selection in the debug view
|
||||||
|
IWorkbenchWindow window= getWindow();
|
||||||
|
if (window != null && window.getShell() != null && !window.getShell().isDisposed()) {
|
||||||
|
IWorkbenchPage page= window.getActivePage();
|
||||||
|
if (page != null) {
|
||||||
|
selection= page.getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
update(action, selection);
|
||||||
|
setInitialized(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the most recent selection
|
||||||
|
*
|
||||||
|
* @return structured selection
|
||||||
|
*/
|
||||||
|
protected IStructuredSelection getSelection() {
|
||||||
|
if (getView() != null) {
|
||||||
|
//cannot used the cached selection in a view
|
||||||
|
//as the selection can be out of date for context menu
|
||||||
|
//actions. See bug 14556
|
||||||
|
ISelection s= getView().getViewSite().getSelectionProvider().getSelection();
|
||||||
|
if (s instanceof IStructuredSelection) {
|
||||||
|
return (IStructuredSelection)s;
|
||||||
|
} else {
|
||||||
|
return StructuredSelection.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the most recent selection
|
||||||
|
*
|
||||||
|
* @parm selection structured selection
|
||||||
|
*/
|
||||||
|
private void setSelection(IStructuredSelection selection) {
|
||||||
|
fSelection = selection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
|
||||||
|
*/
|
||||||
|
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
|
||||||
|
update(getAction(), selection);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setAction(IAction action) {
|
||||||
|
fAction = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IAction getAction() {
|
||||||
|
return fAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setView(IViewPart viewPart) {
|
||||||
|
fViewPart = viewPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isInitialized() {
|
||||||
|
return fInitialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setInitialized(boolean initialized) {
|
||||||
|
fInitialized = initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IWorkbenchWindow getWindow() {
|
||||||
|
return fWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setWindow(IWorkbenchWindow window) {
|
||||||
|
fWindow = window;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,189 @@
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) Copyright IBM Corp. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.eclipse.debug.core.DebugEvent;
|
||||||
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
|
import org.eclipse.debug.core.IDebugEventSetListener;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.IPageListener;
|
||||||
|
import org.eclipse.ui.IPartListener;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
|
|
||||||
|
public abstract class AbstractListenerActionDelegate extends AbstractDebugActionDelegate implements IDebugEventSetListener, IPartListener, IPageListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPartListener#partActivated(IWorkbenchPart)
|
||||||
|
*/
|
||||||
|
public void partActivated(IWorkbenchPart part) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPartListener#partBroughtToTop(IWorkbenchPart)
|
||||||
|
*/
|
||||||
|
public void partBroughtToTop(IWorkbenchPart part) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPartListener#partClosed(IWorkbenchPart)
|
||||||
|
*/
|
||||||
|
public void partClosed(IWorkbenchPart part) {
|
||||||
|
if (part.equals(getView())) {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPartListener#partDeactivated(IWorkbenchPart)
|
||||||
|
*/
|
||||||
|
public void partDeactivated(IWorkbenchPart part) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPartListener#partOpened(IWorkbenchPart)
|
||||||
|
*/
|
||||||
|
public void partOpened(IWorkbenchPart part) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IWorkbenchWindowActionDelegate#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
DebugPlugin.getDefault().removeDebugEventListener(this);
|
||||||
|
getWindow().removePageListener(this);
|
||||||
|
if (getView() != null) {
|
||||||
|
getView().getViewSite().getPage().removePartListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IDebugEventSetListener#handleDebugEvents(DebugEvent[])
|
||||||
|
*/
|
||||||
|
public void handleDebugEvents(final DebugEvent[] events) {
|
||||||
|
if (getPage() == null || getAction() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Shell shell= getWindow().getShell();
|
||||||
|
if (shell == null || shell.isDisposed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Runnable r= new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
Shell shell= getWindow().getShell();
|
||||||
|
if (shell == null || shell.isDisposed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < events.length; i++) {
|
||||||
|
if (events[i].getSource() != null) {
|
||||||
|
doHandleDebugEvent(events[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getPage().getWorkbenchWindow().getShell().getDisplay().asyncExec(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the page that this action works in.
|
||||||
|
*/
|
||||||
|
protected IWorkbenchPage getPage() {
|
||||||
|
if (getWindow() != null) {
|
||||||
|
return getWindow().getActivePage();
|
||||||
|
} else {
|
||||||
|
IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow();
|
||||||
|
if (window != null) {
|
||||||
|
return window.getActivePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default implementation to update on specific debug events.
|
||||||
|
* Subclasses should override to handle events differently.
|
||||||
|
*/
|
||||||
|
protected void doHandleDebugEvent(DebugEvent event) {
|
||||||
|
switch (event.getKind()) {
|
||||||
|
case DebugEvent.TERMINATE :
|
||||||
|
update(getAction(), getSelection());
|
||||||
|
break;
|
||||||
|
case DebugEvent.RESUME :
|
||||||
|
if (!event.isEvaluation() || !((event.getDetail() & DebugEvent.EVALUATION_IMPLICIT) != 0)) {
|
||||||
|
update(getAction(), getSelection());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DebugEvent.SUSPEND :
|
||||||
|
// Update on suspend events (even for evaluations), in case the user changed
|
||||||
|
// the selection during an implicit evaluation.
|
||||||
|
update(getAction(), getSelection());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
|
||||||
|
*/
|
||||||
|
public void init(IWorkbenchWindow window){
|
||||||
|
super.init(window);
|
||||||
|
DebugPlugin.getDefault().addDebugEventListener(this);
|
||||||
|
window.addPageListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IViewActionDelegate#init(IViewPart)
|
||||||
|
*/
|
||||||
|
public void init(IViewPart view) {
|
||||||
|
super.init(view);
|
||||||
|
DebugPlugin.getDefault().addDebugEventListener(this);
|
||||||
|
setWindow(view.getViewSite().getWorkbenchWindow());
|
||||||
|
getPage().addPartListener(this);
|
||||||
|
getPage().getWorkbenchWindow().addPageListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPageListener#pageActivated(IWorkbenchPage)
|
||||||
|
*/
|
||||||
|
public void pageActivated(IWorkbenchPage page) {
|
||||||
|
if (getAction() != null && getView() != null && getPage() != null && getPage().equals(page)) {
|
||||||
|
Runnable r= new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if (getPage() != null) {
|
||||||
|
IWorkbenchWindow window= getPage().getWorkbenchWindow();
|
||||||
|
if (window != null && window.getShell() != null && !window.getShell().isDisposed()) {
|
||||||
|
ISelection selection= getPage().getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
|
||||||
|
update(getAction(), selection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getPage().getWorkbenchWindow().getShell().getDisplay().asyncExec(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPageListener#pageClosed(IWorkbenchPage)
|
||||||
|
*/
|
||||||
|
public void pageClosed(IWorkbenchPage page) {
|
||||||
|
if (page.equals(getPage())) {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IPageListener#pageOpened(IWorkbenchPage)
|
||||||
|
*/
|
||||||
|
public void pageOpened(IWorkbenchPage page) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,251 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IMarker;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
|
import org.eclipse.debug.core.IBreakpointManager;
|
||||||
|
import org.eclipse.debug.core.model.IBreakpoint;
|
||||||
|
import org.eclipse.jface.action.Action;
|
||||||
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
import org.eclipse.jface.text.Position;
|
||||||
|
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||||
|
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||||
|
import org.eclipse.ui.IEditorInput;
|
||||||
|
import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
|
||||||
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
|
import org.eclipse.ui.texteditor.IUpdate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter type comment.
|
||||||
|
*
|
||||||
|
* @since Aug 23, 2002
|
||||||
|
*/
|
||||||
|
public class ManageBreakpointRulerAction extends Action implements IUpdate
|
||||||
|
{
|
||||||
|
private IVerticalRulerInfo fRuler;
|
||||||
|
private ITextEditor fTextEditor;
|
||||||
|
private String fMarkerType;
|
||||||
|
private List fMarkers;
|
||||||
|
|
||||||
|
private String fAddLabel;
|
||||||
|
private String fRemoveLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for ManageBreakpointRulerAction.
|
||||||
|
*
|
||||||
|
* @param ruler
|
||||||
|
* @param editor
|
||||||
|
*/
|
||||||
|
public ManageBreakpointRulerAction( IVerticalRulerInfo ruler, ITextEditor editor )
|
||||||
|
{
|
||||||
|
fRuler = ruler;
|
||||||
|
fTextEditor = editor;
|
||||||
|
fMarkerType = IBreakpoint.BREAKPOINT_MARKER;
|
||||||
|
fAddLabel = "Add Breakpoint";
|
||||||
|
fRemoveLabel = "Remove Breakpoint";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
||||||
|
*/
|
||||||
|
public void update()
|
||||||
|
{
|
||||||
|
fMarkers = getMarkers();
|
||||||
|
setText( fMarkers.isEmpty() ? fAddLabel : fRemoveLabel );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Action#run()
|
||||||
|
*/
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if ( fMarkers.isEmpty() )
|
||||||
|
{
|
||||||
|
addMarker();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
removeMarkers( fMarkers );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List getMarkers()
|
||||||
|
{
|
||||||
|
List breakpoints = new ArrayList();
|
||||||
|
|
||||||
|
IResource resource = getResource();
|
||||||
|
IDocument document = getDocument();
|
||||||
|
AbstractMarkerAnnotationModel model = getAnnotationModel();
|
||||||
|
|
||||||
|
if ( model != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IMarker[] markers = null;
|
||||||
|
if ( resource instanceof IFile )
|
||||||
|
{
|
||||||
|
markers = resource.findMarkers( IBreakpoint.BREAKPOINT_MARKER,
|
||||||
|
true,
|
||||||
|
IResource.DEPTH_INFINITE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
markers = root.findMarkers( IBreakpoint.BREAKPOINT_MARKER,
|
||||||
|
true,
|
||||||
|
IResource.DEPTH_INFINITE );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( markers != null )
|
||||||
|
{
|
||||||
|
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
|
||||||
|
for ( int i = 0; i < markers.length; i++ )
|
||||||
|
{
|
||||||
|
IBreakpoint breakpoint = breakpointManager.getBreakpoint( markers[i] );
|
||||||
|
if ( breakpoint != null &&
|
||||||
|
breakpointManager.isRegistered( breakpoint ) &&
|
||||||
|
includesRulerLine( model.getMarkerPosition( markers[i] ), document ) )
|
||||||
|
breakpoints.add( markers[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( CoreException x )
|
||||||
|
{
|
||||||
|
CDebugUIPlugin.log( x.getStatus() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return breakpoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resource for which to create the marker,
|
||||||
|
* or <code>null</code> if there is no applicable resource.
|
||||||
|
*
|
||||||
|
* @return the resource for which to create the marker or <code>null</code>
|
||||||
|
*/
|
||||||
|
protected IResource getResource()
|
||||||
|
{
|
||||||
|
IEditorInput input = fTextEditor.getEditorInput();
|
||||||
|
IResource resource = (IResource)input.getAdapter( IFile.class );
|
||||||
|
if ( resource == null )
|
||||||
|
resource = (IResource)input.getAdapter( IResource.class );
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether a position includes the ruler's line of activity.
|
||||||
|
*
|
||||||
|
* @param position the position to be checked
|
||||||
|
* @param document the document the position refers to
|
||||||
|
* @return <code>true</code> if the line is included by the given position
|
||||||
|
*/
|
||||||
|
protected boolean includesRulerLine( Position position, IDocument document )
|
||||||
|
{
|
||||||
|
if ( position != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int markerLine = document.getLineOfOffset( position.getOffset() );
|
||||||
|
int line = fRuler.getLineOfLastMouseButtonActivity();
|
||||||
|
if ( line == markerLine )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( BadLocationException x )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this action's vertical ruler info.
|
||||||
|
*
|
||||||
|
* @return this action's vertical ruler
|
||||||
|
*/
|
||||||
|
protected IVerticalRulerInfo getVerticalRulerInfo()
|
||||||
|
{
|
||||||
|
return fRuler;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this action's editor.
|
||||||
|
*
|
||||||
|
* @return this action's editor
|
||||||
|
*/
|
||||||
|
protected ITextEditor getTextEditor()
|
||||||
|
{
|
||||||
|
return fTextEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the <code>AbstractMarkerAnnotationModel</code> of the editor's input.
|
||||||
|
*
|
||||||
|
* @return the marker annotation model
|
||||||
|
*/
|
||||||
|
protected AbstractMarkerAnnotationModel getAnnotationModel()
|
||||||
|
{
|
||||||
|
IDocumentProvider provider = fTextEditor.getDocumentProvider();
|
||||||
|
IAnnotationModel model = provider.getAnnotationModel( fTextEditor.getEditorInput() );
|
||||||
|
if ( model instanceof AbstractMarkerAnnotationModel )
|
||||||
|
{
|
||||||
|
return (AbstractMarkerAnnotationModel)model;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the <code>IDocument</code> of the editor's input.
|
||||||
|
*
|
||||||
|
* @return the document of the editor's input
|
||||||
|
*/
|
||||||
|
protected IDocument getDocument()
|
||||||
|
{
|
||||||
|
IDocumentProvider provider = fTextEditor.getDocumentProvider();
|
||||||
|
return provider.getDocument( fTextEditor.getEditorInput() );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addMarker()
|
||||||
|
{
|
||||||
|
IEditorInput editorInput = getTextEditor().getEditorInput();
|
||||||
|
IDocument document = getDocument();
|
||||||
|
int rulerLine = getVerticalRulerInfo().getLineOfLastMouseButtonActivity();
|
||||||
|
// create breakpoint
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeMarkers( List markers )
|
||||||
|
{
|
||||||
|
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Iterator e = markers.iterator();
|
||||||
|
while( e.hasNext() )
|
||||||
|
{
|
||||||
|
IBreakpoint breakpoint = breakpointManager.getBreakpoint( (IMarker)e.next() );
|
||||||
|
breakpointManager.removeBreakpoint( breakpoint, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( CoreException e )
|
||||||
|
{
|
||||||
|
// CDebugUIPlugin.errorDialog( ActionMessages.getString("ManageBreakpointRulerAction.error.removing.message1"), e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
||||||
|
import org.eclipse.ui.IEditorPart;
|
||||||
|
import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
|
||||||
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter type comment.
|
||||||
|
*
|
||||||
|
* @since Aug 23, 2002
|
||||||
|
*/
|
||||||
|
public class ManageBreakpointRulerActionDelegate extends AbstractRulerActionDelegate
|
||||||
|
{
|
||||||
|
static final private String C_EDITOR_ID = "org.eclipse.cdt.ui.editor.CEditor"; //$NON-NLS-1$
|
||||||
|
/**
|
||||||
|
* @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
|
||||||
|
*/
|
||||||
|
public void setActiveEditor(IAction callerAction, IEditorPart targetEditor)
|
||||||
|
{
|
||||||
|
if ( targetEditor != null )
|
||||||
|
{
|
||||||
|
String id = targetEditor.getSite().getId();
|
||||||
|
if ( !id.equals( C_EDITOR_ID ) )
|
||||||
|
targetEditor = null;
|
||||||
|
}
|
||||||
|
super.setActiveEditor( callerAction, targetEditor );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
|
||||||
|
*/
|
||||||
|
protected IAction createAction( ITextEditor editor, IVerticalRulerInfo rulerInfo )
|
||||||
|
{
|
||||||
|
return new ManageBreakpointRulerAction( rulerInfo, editor );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.IRestart;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter type comment.
|
||||||
|
*
|
||||||
|
* @since Aug 23, 2002
|
||||||
|
*/
|
||||||
|
public class RestartActionDelegate extends AbstractListenerActionDelegate
|
||||||
|
{
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(Object)
|
||||||
|
*/
|
||||||
|
protected void doAction( Object element ) throws DebugException
|
||||||
|
{
|
||||||
|
if ( element instanceof IRestart )
|
||||||
|
{
|
||||||
|
((IRestart)element).restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(Object)
|
||||||
|
*/
|
||||||
|
protected boolean isEnabledFor( Object element )
|
||||||
|
{
|
||||||
|
if ( element instanceof IRestart )
|
||||||
|
{
|
||||||
|
return checkCapability( (IRestart)element );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean checkCapability( IRestart element )
|
||||||
|
{
|
||||||
|
return element.canRestart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AbstractDebugActionDelegate#enableForMultiSelection()
|
||||||
|
*/
|
||||||
|
protected boolean enableForMultiSelection()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AbstractDebugActionDelegate#getStatusMessage()
|
||||||
|
*/
|
||||||
|
protected String getStatusMessage()
|
||||||
|
{
|
||||||
|
return "Exceptions occurred attempting to restart.";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AbstractDebugActionDelegate#getErrorDialogMessage()
|
||||||
|
*/
|
||||||
|
protected String getErrorDialogMessage()
|
||||||
|
{
|
||||||
|
return "Restart failed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AbstractDebugActionDelegate#getErrorDialogTitle()
|
||||||
|
*/
|
||||||
|
protected String getErrorDialogTitle()
|
||||||
|
{
|
||||||
|
return "Restart";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue