Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/dsf
diff options
context:
space:
mode:
authorKen Ryall2010-03-09 22:45:11 +0000
committerKen Ryall2010-03-09 22:45:11 +0000
commit75267de2dcbe5563aa5d0317836980244b45a796 (patch)
tree2940dba9ae8d87ffd2e9b2024ab0b648bfafda57 /dsf
parent0c26d91b94a4e5423d61554e4626bb2a828dcdcf (diff)
downloadorg.eclipse.cdt-75267de2dcbe5563aa5d0317836980244b45a796.tar.gz
org.eclipse.cdt-75267de2dcbe5563aa5d0317836980244b45a796.tar.xz
org.eclipse.cdt-75267de2dcbe5563aa5d0317836980244b45a796.zip
Update with Pawel's adjusted patch using ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID
Diffstat (limited to 'dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java36
1 files changed, 23 insertions, 13 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java
index c5120997003..840eaad07fe 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java
@@ -10,15 +10,16 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugModelProvider;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
@@ -68,18 +69,27 @@ public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetF
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
if (part instanceof IDisassemblyPart) {
- Object element = getDebugContext(part).getFirstElement();
- if (element instanceof IAdaptable) {
- IDebugModelProvider modelProvider =
- (IDebugModelProvider)((IAdaptable)element).getAdapter(IDebugModelProvider.class);
- if (modelProvider != null) {
- String[] models = modelProvider.getModelIdentifiers();
- if (Arrays.asList(models).contains(CDIDebugModel.getPluginIdentifier())) {
- return TOGGLE_C_BREAKPOINT_TARGET_ID;
- }
- }
- }
- return null;
+ // Return the debug context as a default if the currently selected context
+ // is a CDT element. Otherwise return null.
+ Object element = getDebugContext(part).getFirstElement();
+ if (element instanceof IAdaptable) {
+ IDebugModelProvider modelProvider =
+ (IDebugModelProvider)((IAdaptable)element).getAdapter(IDebugModelProvider.class);
+ if (modelProvider != null) {
+ String[] models = modelProvider.getModelIdentifiers();
+ for (String model : models) {
+ if (CDIDebugModel.getPluginIdentifier().equals(model) ||
+ ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID.equals(model))
+ {
+ return TOGGLE_C_BREAKPOINT_TARGET_ID;
+ }
+ }
+ } else if (element instanceof IDebugElement) {
+ if (CDIDebugModel.getPluginIdentifier().equals(((IDebugElement)element).getModelIdentifier()) ) {
+ return TOGGLE_C_BREAKPOINT_TARGET_ID;
+ }
+ }
+ }
}
return null;
}

Back to the top