mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Update with Pawel's adjusted patch using ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID
This commit is contained in:
parent
0c26d91b94
commit
75267de2dc
4 changed files with 47 additions and 16 deletions
|
@ -10,6 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.core.model;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
|
||||
|
@ -25,6 +26,16 @@ import org.eclipse.debug.core.model.IBreakpoint;
|
|||
*/
|
||||
public interface ICBreakpoint extends IBreakpoint {
|
||||
|
||||
/**
|
||||
* This debug model identifier can be returned by a debug implementation
|
||||
* to indicate that a given debugger integration is using C Breakpoints.
|
||||
* This model ID will allow breakpoint actions to configure their default
|
||||
* selection.
|
||||
*
|
||||
* @since 7.0
|
||||
*/
|
||||
public static final String C_BREAKPOINTS_DEBUG_MODEL_ID = CDIDebugModel.getPluginIdentifier() + ".cbreakpoints"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Breakpoint attribute storing the number of debug targets a breakpoint is
|
||||
* installed in (value
|
||||
|
|
|
@ -10,13 +10,14 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import java.util.Arrays;
|
||||
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.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;
|
||||
|
@ -56,7 +57,15 @@ public class ToggleCBreakpointsTargetFactory implements IToggleBreakpointsTarget
|
|||
(IDebugModelProvider)((IAdaptable)element).getAdapter(IDebugModelProvider.class);
|
||||
if (modelProvider != null) {
|
||||
String[] models = modelProvider.getModelIdentifiers();
|
||||
if (Arrays.asList(models).contains(CDIDebugModel.getPluginIdentifier())) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.IRestart;
|
||||
import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
|
||||
import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
|
||||
|
@ -179,7 +180,7 @@ public class GdbAdapterFactory
|
|||
fDebugModelProvider = new IDebugModelProvider() {
|
||||
// @see org.eclipse.debug.core.model.IDebugModelProvider#getModelIdentifiers()
|
||||
public String[] getModelIdentifiers() {
|
||||
return new String[] { GdbLaunchDelegate.GDB_DEBUG_MODEL_ID };
|
||||
return new String[] { GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID };
|
||||
}
|
||||
};
|
||||
session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue