Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Ryall2010-03-02 13:29:06 +0000
committerKen Ryall2010-03-02 13:29:06 +0000
commitde52271f86afbd5bd29280e76d327810322f88c3 (patch)
treeeb054236275f8c575c720d4452ba62fcf172e84a /dsf/org.eclipse.cdt.dsf.ui
parent8e1def1e775de9869074cfa9aca4fcd96821b9a8 (diff)
downloadorg.eclipse.cdt-de52271f86afbd5bd29280e76d327810322f88c3.tar.gz
org.eclipse.cdt-de52271f86afbd5bd29280e76d327810322f88c3.tar.xz
org.eclipse.cdt-de52271f86afbd5bd29280e76d327810322f88c3.zip
Bug 303968, move support for Run To Line, Move To Line, Resume At Line, to DSF.
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf.ui')
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/plugin.xml14
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java91
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java89
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java89
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java98
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java184
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java194
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java47
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java197
9 files changed, 1003 insertions, 0 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/plugin.xml b/dsf/org.eclipse.cdt.dsf.ui/plugin.xml
index 61ae3db7eec..d03d2d442a1 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/plugin.xml
+++ b/dsf/org.eclipse.cdt.dsf.ui/plugin.xml
@@ -680,6 +680,20 @@
pattern="org\.eclipse\.cdt\.dsf\.ui/org\.eclipse\.cdt\.dsf\.debug\.ui\.[A-Za-z]+\.viewmodel\.update\.actions\.refresh">
</activityPatternBinding>
</extension>
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.eclipse.cdt.dsf.debug.internal.ui.SuspendResumeAdapterFactory"
+ adaptableType="org.eclipse.cdt.dsf.ui.viewmodel.IVMContext">
+ <adapter type="org.eclipse.debug.core.model.ISuspendResume"/>
+ </factory>
+ <factory
+ class="org.eclipse.cdt.dsf.debug.internal.ui.actions.RetargettableActionAdapterFactory"
+ adaptableType="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyView">
+ <adapter type="org.eclipse.debug.ui.actions.IRunToLineTarget"/>
+ <adapter type="org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget"/>
+ <adapter type="org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget"/>
+ </factory>
+ </extension>
</plugin>
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java
new file mode 100644
index 00000000000..1d686ff403d
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Wind River 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ * Ericsson - Updated to support Move-To-Line
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui;
+
+import org.eclipse.cdt.dsf.datamodel.DMContexts;
+import org.eclipse.cdt.dsf.debug.internal.ui.actions.MoveToLine;
+import org.eclipse.cdt.dsf.debug.internal.ui.actions.ResumeAtLine;
+import org.eclipse.cdt.dsf.debug.internal.ui.actions.RunToLine;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ISuspendResume;
+
+/**
+ * Adapter factory for Run-To-Line, Move-To-Line
+ * and Resume-At-Line
+ *
+ * @since 2.1
+ */
+public class SuspendResumeAdapterFactory implements IAdapterFactory {
+
+ static class GdbSuspendResume implements ISuspendResume, IAdaptable {
+
+ private final RunToLine fRunToLine;
+ private final MoveToLine fMoveToLine;
+ private final ResumeAtLine fResumeAtLine;
+
+ GdbSuspendResume(IExecutionDMContext execCtx) {
+ fRunToLine = new RunToLine(execCtx);
+ fMoveToLine = new MoveToLine(execCtx);
+ fResumeAtLine = new ResumeAtLine(execCtx);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter) {
+ if (adapter.isInstance(fRunToLine)) {
+ return fRunToLine;
+ }
+ if (adapter.isInstance(fMoveToLine)) {
+ return fMoveToLine;
+ }
+ if (adapter.isInstance(fResumeAtLine)) {
+ return fResumeAtLine;
+ }
+ return null;
+ }
+
+ public boolean canResume() { return false; }
+ public boolean canSuspend() { return false; }
+ // This must return true because the platform
+ // RunToLineActionDelegate will only enable the
+ // action if we are suspended
+ public boolean isSuspended() { return true; }
+ public void resume() throws DebugException {}
+ public void suspend() throws DebugException {}
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (ISuspendResume.class.equals(adapterType)) {
+ if (adaptableObject instanceof IDMVMContext) {
+ IExecutionDMContext execDmc = DMContexts.getAncestorOfType(
+ ((IDMVMContext)adaptableObject).getDMContext(),
+ IExecutionDMContext.class);
+ // It only makes sense to RunToLine, MoveToLine or
+ // ResumeAtLine if we are dealing with a thread, not a container
+ if (execDmc != null && !(execDmc instanceof IContainerDMContext)) {
+ return new GdbSuspendResume(execDmc);
+ }
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Class[] getAdapterList() {
+ return new Class[] { ISuspendResume.class };
+ }
+} \ No newline at end of file
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java
new file mode 100644
index 00000000000..fc8b2965460
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui.actions;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.IMoveToAddress;
+import org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Move to line target adapter for the DSF Disassembly view
+ *
+ * @since 2.1
+ */
+public class DisassemblyMoveToLineAdapter implements IMoveToLineTarget {
+
+ public void moveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
+ if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
+ if (!(selection instanceof IDisassemblySelection)) {
+ selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ }
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ final IAddress address = disassemblySelection.getStartAddress();
+
+ if (address != null && target instanceof IAdaptable) {
+ final IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter(IMoveToAddress.class);
+ if (moveToAddress != null && moveToAddress.canMoveToAddress(address)) {
+ try {
+ moveToAddress.moveToAddress(address);
+ }
+ catch(DebugException e) {
+ failed(e);
+ }
+ }
+ }
+ }
+ }
+
+ public boolean canMoveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
+ if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
+ IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter(IMoveToAddress.class);
+ if (moveToAddress == null) {
+ return false;
+ }
+
+ if (!(selection instanceof IDisassemblySelection)) {
+ selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ }
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ final IAddress address = disassemblySelection.getStartAddress();
+ if (address == null) {
+ return false;
+ }
+
+ return moveToAddress.canMoveToAddress(address);
+ }
+
+ return false;
+ }
+
+ protected void failed( Throwable e ) {
+ MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "MoveToLine failed", null); //$NON-NLS-1$
+ ms.add( new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e));
+ DsfUIPlugin.log(ms);
+ }
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java
new file mode 100644
index 00000000000..112f91225c7
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui.actions;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.IResumeAtAddress;
+import org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Resume at line target adapter for the DSF Disassembly view
+ *
+ * @since 2.1
+ */
+public class DisassemblyResumeAtLineAdapter implements IResumeAtLineTarget {
+
+ public void resumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
+ if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
+ if (!(selection instanceof IDisassemblySelection)) {
+ selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ }
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ final IAddress address = disassemblySelection.getStartAddress();
+
+ if (address != null && target instanceof IAdaptable) {
+ final IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter(IResumeAtAddress.class);
+ if (resumeAtAddress != null && resumeAtAddress.canResumeAtAddress(address)) {
+ try {
+ resumeAtAddress.resumeAtAddress(address);
+ }
+ catch(DebugException e) {
+ failed(e);
+ }
+ }
+ }
+ }
+ }
+
+ public boolean canResumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
+ if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
+ IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter(IResumeAtAddress.class);
+ if (resumeAtAddress == null) {
+ return false;
+ }
+
+ if (!(selection instanceof IDisassemblySelection)) {
+ selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ }
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ final IAddress address = disassemblySelection.getStartAddress();
+ if (address == null) {
+ return false;
+ }
+
+ return resumeAtAddress.canResumeAtAddress(address);
+ }
+
+ return false;
+ }
+
+ protected void failed( Throwable e ) {
+ MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "Resume At Line failed", null); //$NON-NLS-1$
+ ms.add( new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e));
+ DsfUIPlugin.log(ms);
+ }
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java
new file mode 100644
index 00000000000..5ebca3316ce
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui.actions;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.IRunToAddress;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.actions.IRunToLineTarget;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Run to line target adapter for the DSF Disassembly view
+ *
+ * @since 2.1
+ */
+public class DisassemblyRunToLineAdapter implements IRunToLineTarget {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IRunToLineTarget#runToLine(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection, org.eclipse.debug.core.model.ISuspendResume)
+ */
+ public void runToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
+ if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
+ if (!(selection instanceof IDisassemblySelection)) {
+ selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ }
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ final IAddress address = disassemblySelection.getStartAddress();
+
+ if (address != null && target instanceof IAdaptable) {
+ final IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class);
+ if (runToAddress != null && runToAddress.canRunToAddress(address)) {
+ try {
+ boolean skipBreakpoints = DebugUITools.getPreferenceStore().getBoolean(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE);
+ runToAddress.runToAddress(address, skipBreakpoints);
+ }
+ catch(DebugException e) {
+ failed(e);
+ }
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IRunToLineTarget#canRunToLine(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection, org.eclipse.debug.core.model.ISuspendResume)
+ */
+ public boolean canRunToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
+ if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
+ IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class);
+ if (runToAddress == null) {
+ return false;
+ }
+
+ if (!(selection instanceof IDisassemblySelection)) {
+ selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ }
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ final IAddress address = disassemblySelection.getStartAddress();
+ if (address == null) {
+ return false;
+ }
+
+ return runToAddress.canRunToAddress(address);
+ }
+
+ return false;
+ }
+
+ protected void failed( Throwable e ) {
+ MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "RunToLine failed", null ); //$NON-NLS-1$
+ ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e ) );
+ DsfUIPlugin.log(ms);
+ }
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java
new file mode 100644
index 00000000000..8228f91abf9
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui.actions;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.RejectedExecutionException;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.debug.core.model.IMoveToAddress;
+import org.eclipse.cdt.debug.core.model.IMoveToLine;
+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
+import org.eclipse.cdt.dsf.concurrent.Query;
+import org.eclipse.cdt.dsf.debug.service.IRunControl2;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
+import org.eclipse.cdt.dsf.service.DsfServicesTracker;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Implements the CDT's move to line interface.
+ *
+ * @since 2.1
+ */
+public class MoveToLine implements IMoveToLine, IMoveToAddress {
+
+ private final IExecutionDMContext fContext;
+
+ public MoveToLine(IExecutionDMContext context) {
+ fContext = context;
+ }
+
+ public boolean canMoveToLine(final String fileName, final int lineNumber) {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canMoveToLine(fContext, fileName, lineNumber, false, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ }
+ return false;
+ }
+
+ public void moveToLine(final String fileName, final int lineNumber) throws DebugException {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.moveToLine(
+ fContext, fileName, lineNumber, false,
+ new DataRequestMonitor<Object>(ImmediateExecutor.getInstance(), rm));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Faild executing move to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+
+ public boolean canMoveToAddress(final IAddress address) {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canMoveToAddress(fContext, address, false, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ }
+ return false;
+ }
+
+ public void moveToAddress(final IAddress address) throws DebugException {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.moveToAddress(
+ fContext, address, false,
+ new DataRequestMonitor<Object>(ImmediateExecutor.getInstance(), rm));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Faild executing move to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java
new file mode 100644
index 00000000000..7e42df3c305
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui.actions;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.RejectedExecutionException;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.debug.core.model.IResumeAtAddress;
+import org.eclipse.cdt.debug.core.model.IResumeAtLine;
+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
+import org.eclipse.cdt.dsf.concurrent.Query;
+import org.eclipse.cdt.dsf.debug.service.IRunControl2;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
+import org.eclipse.cdt.dsf.service.DsfServicesTracker;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Implements the CDT's resume at line interface.
+ *
+ * @since 2.1
+ */
+public class ResumeAtLine implements IResumeAtLine, IResumeAtAddress {
+
+ private final IExecutionDMContext fContext;
+
+ public ResumeAtLine(IExecutionDMContext context) {
+ fContext = context;
+ }
+
+ public boolean canResumeAtLine(IFile file, final int lineNumber) {
+ return canResumeAtLine(file.getLocation().makeAbsolute().toOSString(), lineNumber);
+ }
+
+ public boolean canResumeAtLine(final String fileName, final int lineNumber) {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canMoveToLine(fContext, fileName, lineNumber, true, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ }
+ return false;
+ }
+
+ public void resumeAtLine(IFile file, int lineNumber) throws DebugException {
+ resumeAtLine(file.getLocation().makeAbsolute().toOSString(), lineNumber);
+ }
+
+ public void resumeAtLine(final String fileName, final int lineNumber) throws DebugException {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.moveToLine(
+ fContext, fileName, lineNumber, true,
+ new DataRequestMonitor<Object>(ImmediateExecutor.getInstance(), rm));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Faild executing move to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+
+ public boolean canResumeAtAddress(final IAddress address) {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canMoveToAddress(fContext, address, true, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ }
+ return false;
+ }
+
+ public void resumeAtAddress(final IAddress address) throws DebugException {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.moveToAddress(
+ fContext, address, true,
+ new DataRequestMonitor<Object>(ImmediateExecutor.getInstance(), rm));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Faild executing move to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java
new file mode 100644
index 00000000000..f554b9b139c
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui.actions;
+
+import org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget;
+import org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.IRunToLineTarget;
+
+/**
+ * Retargettable Action Adapter Factory for the DSF Disassembly view
+ *
+ * @since 2.1
+ */
+public class RetargettableActionAdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adapterType == IRunToLineTarget.class) {
+ return new DisassemblyRunToLineAdapter();
+ }
+ if (adapterType == IMoveToLineTarget.class) {
+ return new DisassemblyMoveToLineAdapter();
+ }
+ if (adapterType == IResumeAtLineTarget.class) {
+ return new DisassemblyResumeAtLineAdapter();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[]{ IRunToLineTarget.class, IResumeAtLineTarget.class, IMoveToLineTarget.class };
+ }
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java
new file mode 100644
index 00000000000..fbaf2d9e43d
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Wind River 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ * Ericsson - Added support for IRunToAddress for DSF DisassemblyView (302324)
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.debug.internal.ui.actions;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.RejectedExecutionException;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.debug.core.model.IRunToAddress;
+import org.eclipse.cdt.debug.core.model.IRunToLine;
+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
+import org.eclipse.cdt.dsf.concurrent.Query;
+import org.eclipse.cdt.dsf.debug.service.IRunControl2;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
+import org.eclipse.cdt.dsf.service.DsfServicesTracker;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.ui.actions.IRunToLineTarget;
+
+/**
+ * Implements the CDT's run to line interface. This interface is called by CDT's
+ * {@link IRunToLineTarget} implementation.
+ *
+ * @since 2.0
+ */
+public class RunToLine implements IRunToLine, IRunToAddress {
+
+ private final IExecutionDMContext fContext;
+
+ public RunToLine(IExecutionDMContext context) {
+ fContext = context;
+ }
+
+ public boolean canRunToLine(final IFile file, final int lineNumber) {
+ return canRunToLine(file.getLocation().makeAbsolute().toOSString(), lineNumber);
+ }
+
+ public boolean canRunToLine(final String fileName, final int lineNumber) {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canRunToLine(fContext, fileName, lineNumber, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ }
+ return false;
+ }
+
+ public void runToLine(IFile file, int lineNumber, boolean skipBreakpoints) throws DebugException {
+ runToLine(file.getLocation().makeAbsolute().toOSString(), lineNumber, skipBreakpoints);
+ }
+
+ public void runToLine(final String fileName, final int lineNumber, final boolean skipBreakpoints) throws DebugException {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.runToLine(
+ fContext, fileName, lineNumber, skipBreakpoints,
+ new DataRequestMonitor<Object>(ImmediateExecutor.getInstance(), rm));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Faild executing run to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+
+ /** @since 2.1 */
+ public boolean canRunToAddress(final IAddress address) {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canRunToAddress(fContext, address, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get();
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ }
+ }
+ return false;
+ }
+
+ /** @since 2.1 */
+ public void runToAddress(final IAddress address, final boolean skipBreakpoints) throws DebugException {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker =
+ new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.runToAddress(fContext, address, skipBreakpoints,
+ new DataRequestMonitor<Object>(ImmediateExecutor.getInstance(), rm));
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Faild executing run to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+ }

Back to the top