diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
index ee7cc57b849..ce4a48d8ba7 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
@@ -129,3 +129,7 @@ ToggleCBreakpointsTargetFactory.CBreakpointDescription=Standard C/C++ breakpoint
ToggleCBreakpointsTargetFactory.CBreakpointName=C/C++ Breakpoints
ToggleCBreakpointsTargetFactory.CTracepointDescription=Standard C/C++ tracepoint type.
ToggleCBreakpointsTargetFactory.CTracepointName=C/C++ Tracepoints
+RetargetAction.0=Error
+RetargetAction.1=Operation failed
+RetargetMoveToLineAction.0=The operation is unavailable on the current selection. Please place the cursor on valid line to run to.
+RetargetResumeAtLineAction.0=The operation is unavailable on the current selection. Please place the cursor on valid line to run to.
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetAction.java
index 68e211975d9..a133137362c 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Anton Leherbauer (Wind River Systems) - bug 183291
+ * Ericsson - Updated to the latest platform version of this file
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
@@ -15,26 +16,28 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IPartService;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.texteditor.IUpdate;
/**
* Global retargettable debug action.
- *
- * @since 3.0
*/
-public abstract class RetargetAction implements IWorkbenchWindowActionDelegate, IPartListener, IUpdate {
+public abstract class RetargetAction implements IWorkbenchWindowActionDelegate, IPartListener, IActionDelegate2 {
protected IWorkbenchWindow fWindow = null;
private IWorkbenchPart fActivePart = null;
@@ -59,7 +62,7 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
*
* @return the selection in the active part, possibly empty
*/
- private ISelection getTargetSelection() {
+ protected ISelection getTargetSelection() {
if (fActivePart != null) {
ISelectionProvider selectionProvider = fActivePart.getSite().getSelectionProvider();
if (selectionProvider != null) {
@@ -69,6 +72,10 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
return EMPTY_SELECTION;
}
+ protected IWorkbenchPart getActivePart() {
+ return fActivePart;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
@@ -96,19 +103,34 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
public void run(IAction action) {
if (fTargetAdapter != null) {
try {
- performAction(fTargetAdapter, getTargetSelection(), fActivePart);
+ if (isTargetEnabled()) {
+ performAction(fTargetAdapter, getTargetSelection(), fActivePart);
+ } else {
+ String message = getOperationUnavailableMessage();
+ IStatus status = new Status(IStatus.INFO, DebugUIPlugin.getUniqueIdentifier(), message);
+ DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), DebugUIPlugin.removeAccelerators(action.getText()), message, status);
+ }
} catch (CoreException e) {
- ErrorDialog.openError(fWindow.getShell(), ActionMessages.getString("RetargetAction.2"), ActionMessages.getString("RetargetAction.3"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
+ ErrorDialog.openError(fWindow.getShell(), ActionMessages.getString("RetargetAction.0"), ActionMessages.getString("RetargetAction.1"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
+ /**
+ * Returns a message to display when we find that the operation is not enabled
+ * when invoked in an editor (we check enabled state before running in this case,
+ * rather than updating on each selection change - see bug 180441).
+ *
+ * @return information message when unavailable
+ */
+ protected abstract String getOperationUnavailableMessage();
+
/**
* Performs the specific breakpoint toggling.
*
* @param selection selection in the active part
* @param part active part
- * @throws CoreException if an exception occurrs
+ * @throws CoreException if an exception occurs
*/
protected abstract void performAction(Object target, ISelection selection, IWorkbenchPart part) throws CoreException;
@@ -116,8 +138,7 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
- this.fAction = action;
- // if the active part did not provide an adapter, see if the selectoin does
+ // if the active part did not provide an adapter, see if the selection does
if (fTargetAdapter == null && selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (!ss.isEmpty()) {
@@ -127,7 +148,11 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
}
}
}
- update();
+ boolean enabled = fTargetAdapter != null;
+ if (selection instanceof IStructuredSelection) {
+ enabled = isTargetEnabled();
+ }
+ action.setEnabled(enabled);
}
/* (non-Javadoc)
@@ -145,7 +170,9 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
if (fTargetAdapter == null) {
fTargetAdapter = getAdapter(part);
}
- update();
+ if (fAction != null) {
+ fAction.setEnabled(fTargetAdapter != null);
+ }
}
protected Object getAdapter(IAdaptable adaptable) {
@@ -180,9 +207,9 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
/**
* Clears reference to active part and adapter when a relevant part
- * is closed or deactivated.
+ * is closed or no longer active.
*
- * @param part workbench part that has been closed or deactivated
+ * @param part workbench part that has been closed or no longer active
*/
protected void clearPart(IWorkbenchPart part) {
if (part.equals(fActivePart)) {
@@ -201,18 +228,19 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
*/
public void partOpened(IWorkbenchPart part) {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
+
+ /**
+ * Returns whether the target adapter is enabled
+ *
+ * @return whether target adapter is enabled
*/
- public void update() {
- if (fAction == null) {
- return;
- }
+ protected boolean isTargetEnabled() {
if (fTargetAdapter != null) {
- fAction.setEnabled(canPerformAction(fTargetAdapter, getTargetSelection(), fActivePart));
- } else {
- fAction.setEnabled(false);
+ if (fActivePart != null) {
+ return canPerformAction(fTargetAdapter, getTargetSelection(), fActivePart);
+ }
}
+ return false;
}
/**
@@ -223,5 +251,37 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
* @param part the part the operation has been requested on
* @return whether the operation can be performed
*/
- protected abstract boolean canPerformAction(Object target, ISelection selection, IWorkbenchPart part);
+ protected abstract boolean canPerformAction(Object target, ISelection selection, IWorkbenchPart part);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ fAction = action;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
+ }
+
+ /**
+ * Returns the proxy to this action delegate or null
+ *
+ * @return action proxy or null
+ */
+ protected IAction getAction() {
+ return fAction;
+ }
+
+ /**
+ * Returns whether there is currently a target adapter for this action.
+ *
+ * @return whether the action has a target adapter.
+ */
+ protected boolean hasTargetAdapter() {
+ return fTargetAdapter != null;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetMoveToLineAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetMoveToLineAction.java
index c7f3cd07e82..d477b609a05 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetMoveToLineAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetMoveToLineAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Freescale Semiconductor and others.
+ * Copyright (c) 2008, 2010 Freescale Semiconductor and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,15 +7,20 @@
*
* Contributors:
* Freescale Semiconductor - Initial API and implementation
+ * Ericsson - Updated with the latest platform changes of RetargetAction (302273)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.ISuspendResume;
-import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -23,74 +28,86 @@ import org.eclipse.ui.IWorkbenchWindow;
* Global retargettable move to line action.
*/
public class RetargetMoveToLineAction extends RetargetAction {
-
- private ISelectionListener fSelectionListener = new DebugSelectionListener();
-
+
+ private DebugContextListener fContextListener = new DebugContextListener();
private ISuspendResume fTargetElement = null;
+
+ class DebugContextListener implements IDebugContextListener {
- class DebugSelectionListener implements ISelectionListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
- setTargetElement( null );
- if ( selection instanceof IStructuredSelection ) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- if ( ss.size() == 1 ) {
- Object object = ss.getFirstElement();
- if ( object instanceof ISuspendResume ) {
- setTargetElement( (ISuspendResume)object );
- }
+ protected void contextActivated(ISelection selection) {
+ fTargetElement = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ if (ss.size() == 1) {
+ fTargetElement = (ISuspendResume)
+ DebugPlugin.getAdapter(ss.getFirstElement(), ISuspendResume.class);
}
}
- update();
+ IAction action = getAction();
+ if (action != null) {
+ action.setEnabled(fTargetElement != null && hasTargetAdapter());
+ }
+ }
+
+ public void debugContextChanged(DebugContextEvent event) {
+ contextActivated(event.getContext());
}
}
-
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose() {
- fWindow.getSelectionService().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, fSelectionListener );
+ DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(fContextListener);
super.dispose();
}
-
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
*/
- public void init( IWorkbenchWindow window ) {
- super.init( window );
- window.getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, fSelectionListener );
+ public void init(IWorkbenchWindow window) {
+ super.init(window);
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(window);
+ service.addDebugContextListener(fContextListener);
+ ISelection activeContext = service.getActiveContext();
+ fContextListener.contextActivated(activeContext);
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.RetargetAction#performAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
+ * @see org.eclipse.debug.internal.ui.actions.RetargetAction#canPerformAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
*/
- protected void performAction( Object target, ISelection selection, IWorkbenchPart part ) throws CoreException {
- ((IMoveToLineTarget)target).moveToLine( part, selection, getTargetElement() );
+ protected boolean canPerformAction(Object target, ISelection selection, IWorkbenchPart part) {
+ return fTargetElement != null &&
+ ((IMoveToLineTarget)target).canMoveToLine(part, selection, fTargetElement);
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.RetargetAction#getAdapterClass()
+ * @see org.eclipse.debug.internal.ui.actions.RetargetAction#getAdapterClass()
*/
- protected Class> getAdapterClass() {
+ protected Class getAdapterClass() {
return IMoveToLineTarget.class;
}
-
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.RetargetAction#canPerformAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
+ * @see org.eclipse.debug.internal.ui.actions.RetargetAction#performAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
*/
- protected boolean canPerformAction( Object target, ISelection selection, IWorkbenchPart part ) {
- return getTargetElement() != null && ((IMoveToLineTarget)target).canMoveToLine( part, selection, getTargetElement() );
+ protected void performAction(Object target, ISelection selection, IWorkbenchPart part) throws CoreException {
+ ((IMoveToLineTarget)target).moveToLine(part, selection, fTargetElement);
}
-
- protected ISuspendResume getTargetElement() {
- return fTargetElement;
- }
-
- protected void setTargetElement( ISuspendResume targetElement ) {
- fTargetElement = targetElement;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.actions.RetargetAction#getOperationUnavailableMessage()
+ */
+ protected String getOperationUnavailableMessage() {
+ return ActionMessages.getString("RetargetMoveToLineAction.0"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (fTargetElement == null) {
+ action.setEnabled(false);
+ } else {
+ super.selectionChanged(action, selection);
+ }
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetResumeAtLineAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetResumeAtLineAction.java
index 8de0567b3ff..b8554f84278 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetResumeAtLineAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RetargetResumeAtLineAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 QNX Software Systems and others.
+ * Copyright (c) 2004, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,15 +7,20 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Ericsson - Updated with the latest platform changes of RetargetAction (302273)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.ISuspendResume;
-import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.DebugContextEvent;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextService;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -23,74 +28,86 @@ import org.eclipse.ui.IWorkbenchWindow;
* Global retargettable resume at line action.
*/
public class RetargetResumeAtLineAction extends RetargetAction {
-
- private ISelectionListener fSelectionListener = new DebugSelectionListener();
-
+
+ private DebugContextListener fContextListener = new DebugContextListener();
private ISuspendResume fTargetElement = null;
+
+ class DebugContextListener implements IDebugContextListener {
- class DebugSelectionListener implements ISelectionListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
- setTargetElement( null );
- if ( selection instanceof IStructuredSelection ) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- if ( ss.size() == 1 ) {
- Object object = ss.getFirstElement();
- if ( object instanceof ISuspendResume ) {
- setTargetElement( (ISuspendResume)object );
- }
+ protected void contextActivated(ISelection selection) {
+ fTargetElement = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ if (ss.size() == 1) {
+ fTargetElement = (ISuspendResume)
+ DebugPlugin.getAdapter(ss.getFirstElement(), ISuspendResume.class);
}
}
- update();
+ IAction action = getAction();
+ if (action != null) {
+ action.setEnabled(fTargetElement != null && hasTargetAdapter());
+ }
+ }
+
+ public void debugContextChanged(DebugContextEvent event) {
+ contextActivated(event.getContext());
}
}
-
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose() {
- fWindow.getSelectionService().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, fSelectionListener );
+ DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(fContextListener);
super.dispose();
}
-
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
*/
- public void init( IWorkbenchWindow window ) {
- super.init( window );
- window.getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, fSelectionListener );
+ public void init(IWorkbenchWindow window) {
+ super.init(window);
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(window);
+ service.addDebugContextListener(fContextListener);
+ ISelection activeContext = service.getActiveContext();
+ fContextListener.contextActivated(activeContext);
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.RetargetAction#performAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
+ * @see org.eclipse.debug.internal.ui.actions.RetargetAction#canPerformAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
*/
- protected void performAction( Object target, ISelection selection, IWorkbenchPart part ) throws CoreException {
- ((IResumeAtLineTarget)target).resumeAtLine( part, selection, getTargetElement() );
+ protected boolean canPerformAction(Object target, ISelection selection, IWorkbenchPart part) {
+ return fTargetElement != null &&
+ ((IResumeAtLineTarget)target).canResumeAtLine(part, selection, fTargetElement);
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.RetargetAction#getAdapterClass()
+ * @see org.eclipse.debug.internal.ui.actions.RetargetAction#getAdapterClass()
*/
- protected Class> getAdapterClass() {
+ protected Class getAdapterClass() {
return IResumeAtLineTarget.class;
}
-
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.RetargetAction#canPerformAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
+ * @see org.eclipse.debug.internal.ui.actions.RetargetAction#performAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart)
*/
- protected boolean canPerformAction( Object target, ISelection selection, IWorkbenchPart part ) {
- return getTargetElement() != null && ((IResumeAtLineTarget)target).canResumeAtLine( part, selection, getTargetElement() );
+ protected void performAction(Object target, ISelection selection, IWorkbenchPart part) throws CoreException {
+ ((IResumeAtLineTarget)target).resumeAtLine(part, selection, fTargetElement);
}
-
- protected ISuspendResume getTargetElement() {
- return fTargetElement;
- }
-
- protected void setTargetElement( ISuspendResume targetElement ) {
- fTargetElement = targetElement;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.actions.RetargetAction#getOperationUnavailableMessage()
+ */
+ protected String getOperationUnavailableMessage() {
+ return ActionMessages.getString("RetargetResumeAtLineAction.0"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (fTargetElement == null) {
+ action.setEnabled(false);
+ } else {
+ super.selectionChanged(action, selection);
+ }
}
}