aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-06-25 14:53:49 (EDT)
committerEugene Tarassov2012-06-27 14:51:23 (EDT)
commita87dc45fe4a71aa0f0a8156b5430401de95b94c9 (patch)
treea85a8bb4cddb9b60197483e890898249ca7ea4c1
parentad3e1e4ab77acbe033226b2ac60f64a7f860b1dc (diff)
downloadorg.eclipse.tcf-a87dc45fe4a71aa0f0a8156b5430401de95b94c9.zip
org.eclipse.tcf-a87dc45fe4a71aa0f0a8156b5430401de95b94c9.tar.gz
org.eclipse.tcf-a87dc45fe4a71aa0f0a8156b5430401de95b94c9.tar.bz2
Bug 383464 - [breakpoints] TCF needs to provide a disassembly toggle adapter.
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFDisassemblyToggleBreakpointAdapter.java84
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFToggleBreakpointAdapter.java87
3 files changed, 167 insertions, 7 deletions
diff --git a/plugins/org.eclipse.tcf.cdt.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.cdt.ui/META-INF/MANIFEST.MF
index f031b46..e5b7724 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.tcf.cdt.ui/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.tcf.debug.ui;bundle-version="1.1.0",
org.eclipse.jface.text;bundle-version="3.8.0",
org.eclipse.core.expressions;bundle-version="3.4.400",
- org.eclipse.cdt.launch;bundle-version="7.1.0"
+ org.eclipse.cdt.launch;bundle-version="7.1.0",
+ org.eclipse.cdt.dsf.ui;bundle-version="2.3.0"
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFDisassemblyToggleBreakpointAdapter.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFDisassemblyToggleBreakpointAdapter.java
new file mode 100644
index 0000000..3e2073f
--- /dev/null
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFDisassemblyToggleBreakpointAdapter.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2012 Wind River Systems, Inc. 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
+ *******************************************************************************/
+package org.eclipse.tcf.internal.cdt.ui.breakpoints;
+
+import java.util.Map;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICBreakpointType;
+import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
+import org.eclipse.cdt.dsf.debug.ui.actions.AbstractDisassemblyBreakpointsTarget;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Toggles a TCF Scoped breakpoint in a C/C++ editor.
+ */
+public class TCFDisassemblyToggleBreakpointAdapter extends AbstractDisassemblyBreakpointsTarget {
+
+ private final String TOGGLE_TYPE;
+ private IWorkbenchPart fTogglePart;
+
+
+ TCFDisassemblyToggleBreakpointAdapter(String toggle_type ) {
+ TOGGLE_TYPE = toggle_type;
+ }
+
+ @Override
+ public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ // Save the workbench part that toggle is invoked on, use it in {@link #createLineBreakpoint}
+ fTogglePart = part;
+ super.toggleLineBreakpoints(part, selection);
+ fTogglePart = null;
+ }
+
+ @Override
+ protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
+ CDIDebugModel.createLineBreakpoint(
+ sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true ); //$NON-NLS-1$
+ Map<String, Object> attributes = TCFToggleBreakpointAdapter.getDefaultAttributes(fTogglePart, TOGGLE_TYPE);
+ ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
+ CDIDebugModel.setLineBreakpointAttributes(
+ attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
+ CDIDebugModel.createBreakpointMarker(lineBp, resource, attributes, true);
+ }
+
+ @Override
+ protected void createLineBreakpointInteractive(IWorkbenchPart part, String sourceHandle, IResource resource, int lineNumber) throws CoreException {
+ ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
+ Map<String, Object> attributes = TCFToggleBreakpointAdapter.getDefaultAttributes(fTogglePart, TOGGLE_TYPE);
+ CDIDebugModel.setLineBreakpointAttributes(
+ attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, ""); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
+ }
+
+ @Override
+ protected void createAddressBreakpoint(IResource resource, IAddress address) throws CoreException {
+ CDIDebugModel.createAddressBreakpoint(null, null, resource, getBreakpointType(), address, true, 0, "", true); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address) throws CoreException {
+ ICLineBreakpoint lineBp = CDIDebugModel.createBlankAddressBreakpoint();
+ Map<String, Object> attributes = TCFToggleBreakpointAdapter.getDefaultAttributes(fTogglePart, TOGGLE_TYPE);
+ CDIDebugModel.setAddressBreakpointAttributes(
+ attributes, null, null, getBreakpointType(), -1, address, true, 0, ""); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
+ }
+
+ protected int getBreakpointType() {
+ return ICBreakpointType.REGULAR;
+ }
+
+}
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFToggleBreakpointAdapter.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFToggleBreakpointAdapter.java
index c5756f3..786797e 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFToggleBreakpointAdapter.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFToggleBreakpointAdapter.java
@@ -21,6 +21,7 @@ import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.ui.breakpoints.AbstractToggleBreakpointAdapter;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
@@ -28,6 +29,7 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.tcf.internal.cdt.ui.Activator;
import org.eclipse.tcf.internal.cdt.ui.preferences.PreferenceConstants;
import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel;
@@ -41,11 +43,14 @@ public class TCFToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter
private final String TOGGLE_TYPE;
- TCFToggleBreakpointAdapter(String toggle_type ) {
+ private final TCFDisassemblyToggleBreakpointAdapter fDisassemblyToggleDelegate;
+
+ TCFToggleBreakpointAdapter(String toggle_type) {
TOGGLE_TYPE = toggle_type;
+ fDisassemblyToggleDelegate = new TCFDisassemblyToggleBreakpointAdapter(toggle_type);
}
- private static IStructuredSelection getDebugContext(IWorkbenchPart part) {
+ static IStructuredSelection getDebugContext(IWorkbenchPart part) {
ISelection selection = DebugUITools.getDebugContextManager().
getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
if (selection instanceof IStructuredSelection) {
@@ -54,7 +59,7 @@ public class TCFToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter
return StructuredSelection.EMPTY;
}
- private static boolean isDefaultBPContextQueryEnabled() {
+ static boolean isDefaultBPContextQueryEnabled() {
return Platform.getPreferencesService().getBoolean(
Activator.PLUGIN_ID,
PreferenceConstants.PREF_DEFAULT_TRIGGER_SCOPE_ENABLED,
@@ -62,7 +67,7 @@ public class TCFToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter
null);
}
- private static String getDefaultBPContextQuery() {
+ static String getDefaultBPContextQuery() {
return Platform.getPreferencesService().getString(
Activator.PLUGIN_ID,
PreferenceConstants.PREF_DEFAULT_TRIGGER_SCOPE,
@@ -70,7 +75,7 @@ public class TCFToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter
null);
}
- private Map<String, Object> getDefaultAttributes ( IWorkbenchPart part, final String toggleType) {
+ static Map<String, Object> getDefaultAttributes ( IWorkbenchPart part, final String toggleType) {
Map<String, Object> attributes = new TreeMap<String, Object>();
if ( part != null ) {
Object obj = getDebugContext(part).getFirstElement();
@@ -86,7 +91,7 @@ public class TCFToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter
}
return attributes;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
*/
@@ -169,4 +174,74 @@ public class TCFToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter
CDIDebugModel.setEventBreakpointAttributes(attributes,type, arg);
openBreakpointPropertiesDialog(bp, part, resource, attributes);
}
+
+ @Override
+ @SuppressWarnings("restriction")
+ public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ if (part instanceof IDisassemblyPart) {
+ fDisassemblyToggleDelegate.toggleLineBreakpoints(part, selection);
+ } else {
+ super.toggleLineBreakpoints(part, selection);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("restriction")
+ public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ if (part instanceof IDisassemblyPart) {
+ return fDisassemblyToggleDelegate.canToggleLineBreakpoints(part, selection);
+ } else {
+ return super.canToggleLineBreakpoints(part, selection);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("restriction")
+ public void toggleBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ if (part instanceof IDisassemblyPart) {
+ fDisassemblyToggleDelegate.toggleBreakpoints(part, selection);
+ } else {
+ super.toggleBreakpoints(part, selection);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("restriction")
+ public boolean canToggleBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ if (part instanceof IDisassemblyPart) {
+ return fDisassemblyToggleDelegate.canToggleBreakpoints(part, selection);
+ } else {
+ return super.canToggleBreakpoints(part, selection);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("restriction")
+ public void toggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) throws CoreException {
+ if (part instanceof IDisassemblyPart) {
+ fDisassemblyToggleDelegate.toggleBreakpointsWithEvent(part, selection, event);
+ } else {
+ super.toggleBreakpointsWithEvent(part, selection, event);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("restriction")
+ public void createLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
+ if (part instanceof IDisassemblyPart) {
+ fDisassemblyToggleDelegate.createLineBreakpointsInteractive(part, selection);
+ } else {
+ super.createLineBreakpointsInteractive(part, selection);
+ }
+ }
+
+ @Override
+ @SuppressWarnings("restriction")
+ public boolean canCreateLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) {
+ if (part instanceof IDisassemblyPart) {
+ return fDisassemblyToggleDelegate.canCreateLineBreakpointsInteractive(part, selection);
+ } else {
+ return super.canCreateLineBreakpointsInteractive(part, selection);
+ }
+ }
}