Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/.settings/.api_filters81
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java2083
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java5
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java7
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java5
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java7
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java25
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java4
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java4
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java8
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java6
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java137
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java36
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java8
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java14
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java17
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java14
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java18
-rw-r--r--debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.properties11
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml116
-rw-r--r--debug/org.eclipse.cdt.debug.ui/schema/BreakpointUIContribution.exsd2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java90
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractToggleBreakpointAdapter.java463
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties14
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java39
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerAction.java93
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerActionDelegate.java27
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java132
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleShowColumnsAction.java66
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleTracepointAdapter.java115
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/WatchpointExpressionVerifier.java31
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AbstractBreakpointRulerAction.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java)67
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddEventBreakpointActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddEventBreakpointActionDelegate.java)3
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java75
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointActionDelegate.java)35
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java)4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnMemoryActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnMemoryActionDelegate.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnVariableActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java)3
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java218
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerActionDelegate.java97
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesHandler.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesHandler.java)42
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerAction.java96
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerActionDelegate.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleBreakpointObjectActionDelegate.java97
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java48
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/EnableDisableBreakpointRulerAction.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerAction.java)3
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java123
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCBreakpointsTargetFactory.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCBreakpointsTargetFactory.java)6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCTracepointsTargetFactory.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCTracepointsTargetFactory.java)6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleTracepointAdapter.java91
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointImageProvider.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.java33
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties40
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointContext.java)121
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointFilteringPage.java)4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java299
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java498
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointUpdater.java)4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointWorkbenchAdapterFactory.java)8
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java43
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ThreadFilterEditor.java)12
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ToggleCBreakpointTester.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java9
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPreferenceStore.java46
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java525
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties23
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java752
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointPropertyDialogAction.java182
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java59
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java55
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java133
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java13
79 files changed, 4869 insertions, 2722 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/.settings/.api_filters b/debug/org.eclipse.cdt.debug.core/.settings/.api_filters
index c528f9e508c..6792bd1faca 100644
--- a/debug/org.eclipse.cdt.debug.core/.settings/.api_filters
+++ b/debug/org.eclipse.cdt.debug.core/.settings/.api_filters
@@ -1,5 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.debug.core" version="2">
+ <resource path="src/org/eclipse/cdt/debug/core/ICDebugConstants.java" type="org.eclipse.cdt.debug.core.ICDebugConstants">
+ <filter id="403853384">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.ICDebugConstants"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICAddressBreakpoint">
+ <filter comment="Binay backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICAddressBreakpoint"/>
+ <message_argument value="C_ADDRESS_BREAKPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
+ <filter comment="Binary backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
+ <message_argument value="C_BREAKPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICEventBreakpoint">
+ <filter comment="Binary backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICEventBreakpoint"/>
+ <message_argument value="C_EVENT_BREAKPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint">
+ <filter comment="Binay backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint"/>
+ <message_argument value="C_FUNCTION_BREAKPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java" type="org.eclipse.cdt.debug.core.model.ICLineBreakpoint">
+ <filter id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICLineBreakpoint"/>
+ <message_argument value="C_LINE_BREAKPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/debug/core/model/ICTracepoint.java" type="org.eclipse.cdt.debug.core.model.ICTracepoint">
+ <filter comment="Binay backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
+ <message_argument value="C_ADDRESS_TRACEPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Binay backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
+ <message_argument value="C_FUNCTION_TRACEPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Binary backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
+ <message_argument value="C_LINE_TRACEPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Binary backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
+ <message_argument value="C_TRACEPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java" type="org.eclipse.cdt.debug.core.model.ICWatchpoint">
+ <filter comment="Binay backward compatible change." id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.debug.core.model.ICWatchpoint"/>
+ <message_argument value="C_WATCHPOINT_MARKER"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/cdt/debug/core/sourcelookup/MappingSourceContainer.java" type="org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer">
<filter id="643846161">
<message_arguments>
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
index ea88c2b8ef5..43539805dc7 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
@@ -29,11 +29,13 @@ import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint2;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint2;
+import org.eclipse.cdt.debug.core.model.ICTracepoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
@@ -63,6 +65,7 @@ import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.debug.core.model.IProcess;
/**
@@ -71,747 +74,1345 @@ import org.eclipse.debug.core.model.IProcess;
*/
public class CDIDebugModel {
- /**
- * Returns the identifier for the CDI debug model plug-in
- *
- * @return plugin identifier
- */
- public static String getPluginIdentifier() {
- return CDebugCorePlugin.getUniqueIdentifier();
- }
-
- /**
- * Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
- * target is added to the given launch.
- *
- * @param launch the launch the new debug target will be contained in
- * @param project the project to use to persist breakpoints.
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
- * @param file the executable to debug.
- * @param allowTerminate allow terminate().
- * @param allowDisconnect allow disconnect().
- * @param stopSymbol place temporary breakpoint at <code>stopSymbol</code>, ignore if <code>null</code> or empty.
- * @param resumeTarget resume target.
- * @return a debug target
- * @throws DebugException
- * @since 3.1
- */
- public static IDebugTarget newDebugTarget( final ILaunch launch, final IProject project, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, final boolean allowDisconnect, final String stopSymbol, final boolean resumeTarget ) throws DebugException {
- final IDebugTarget[] target = new IDebugTarget[1];
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
-
- @Override
- public void run( IProgressMonitor m ) throws CoreException {
- target[0] = new CDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect );
- ((CDebugTarget)target[0]).start( stopSymbol, resumeTarget );
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( r, null );
- }
- catch( CoreException e ) {
- CDebugCorePlugin.log( e );
- throw new DebugException( e.getStatus() );
- }
- return target[0];
- }
-
- /**
- * Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
- * target is added to the given launch.
- *
- * @param launch the launch the new debug target will be contained in
- * @param project the project to use to persist breakpoints.
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
- * @param file the executable to debug.
- * @param allowTerminate allow terminate().
- * @param allowDisconnect allow disconnect().
- * @param stopInMain place temporary breakpoint at main()
- * @param resumeTarget resume target.
- * @return a debug target
- * @throws DebugException
- * @deprecated
- */
- @Deprecated
- public static IDebugTarget newDebugTarget( final ILaunch launch, final IProject project, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget ) throws DebugException {
- final IDebugTarget[] target = new IDebugTarget[1];
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
-
- @Override
- public void run( IProgressMonitor m ) throws CoreException {
- String stopSymbol = null;
- if ( stopInMain )
- stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
- target[0] = new CDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect );
- ((CDebugTarget)target[0]).start( stopSymbol, resumeTarget );
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( r, null );
- }
- catch( CoreException e ) {
- CDebugCorePlugin.log( e );
- throw new DebugException( e.getStatus() );
- }
- return target[0];
- }
-
- /**
- * Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
- * target is added to the given launch.
- *
- * @param launch the launch the new debug target will be contained in
- * @param project the project to use to persist breakpoints.
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
- * @param file the executable to debug.
- * @param allowTerminate allow terminate().
- * @param allowDisconnect allow disconnect().
- * @param resumeTarget resume target.
- * @return a debug target
- * @throws DebugException
- */
- public static IDebugTarget newDebugTarget( ILaunch launch, IProject project, ICDITarget cdiTarget, final String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowTerminate, boolean allowDisconnect, boolean resumeTarget ) throws DebugException {
- return newDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect, null, resumeTarget );
- }
-
- /**
- * Creates and returns a line breakpoint for the source defined by the given source handle, at the given line number. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param sourceHandle
- * the handle to the breakpoint source
- * @param resource
- * the resource on which to create the associated breakpoint marker
- * @param lineNumber
- * the line number on which the breakpoint is set - line numbers are 1 based, associated with the source file in which the breakpoint is set
- * @param enabled
- * whether to enable or disable this breakpoint
- * @param ignoreCount
- * the number of times this breakpoint will be ignored
- * @param condition
- * the breakpoint condition
- * @param register
- * whether to add this breakpoint to the breakpoint manager
- * @return a line breakpoint
- * @throws CoreException
- * if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's status contains the underlying exception responsible for the failure.</li>
- * </ul>
- * @deprecated as of CDT 5.0 use {@link #createLineBreakpoint(String, IResource, int, int, boolean, int, String, boolean)}
- */
- @Deprecated
- public static ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- return createLineBreakpoint(sourceHandle, resource, ICBreakpointType.REGULAR, lineNumber, enabled, ignoreCount, condition, register);
- }
-
- /**
- * Creates and returns a line breakpoint for the source defined by the given source handle, at the given line number. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param sourceHandle
- * the handle to the breakpoint source
- * @param resource
- * the resource on which to create the associated breakpoint marker
- * @param type
- * a type constant from ICBreakpointType
- * @param lineNumber
- * the line number on which the breakpoint is set - line numbers are 1 based, associated with the source file in which the breakpoint is set
- * @param enabled
- * whether to enable or disable this breakpoint
- * @param ignoreCount
- * the number of times this breakpoint will be ignored
- * @param condition
- * the breakpoint condition
- * @param register
- * whether to add this breakpoint to the breakpoint manager
- * @return a line breakpoint
- * @throws CoreException
- * if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's status contains the underlying exception responsible for the failure.</li>
- * </ul>
- */
- public static ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, int type, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setLineBreakpointAttributes( attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition );
- return new CLineBreakpoint( resource, attributes, register );
- }
-
- /**
- * @since 7.0
- */
- public static ICLineBreakpoint createLineTracepoint( String sourceHandle, IResource resource, int type, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setLineBreakpointAttributes( attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition );
- return new CLineTracepoint( resource, attributes, register );
- }
-
- /**
- * Helper function for setting common line breakpoint attributes.
- */
- private static void setLineBreakpointAttributes( HashMap<String, Object> attributes,
- String sourceHandle,
- Integer type,
- int lineNumber,
- boolean enabled,
- int ignoreCount,
- String condition ) {
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
- attributes.put( IBreakpoint.ENABLED, Boolean.valueOf( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- attributes.put( ICBreakpointType.TYPE, type );
-
- // Added for source relocated breakpoints.
- if (!attributes.containsKey(ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE)) {
- attributes.put( ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE, sourceHandle );
- }
- if (!attributes.containsKey( ICLineBreakpoint2.REQUESTED_LINE )) {
- attributes.put( ICLineBreakpoint2.REQUESTED_LINE, new Integer( lineNumber ));
- }
- if (attributes.containsKey(IMarker.CHAR_START) &&
- !attributes.containsKey( ICLineBreakpoint2.REQUESTED_CHAR_START ))
- {
- attributes.put( ICLineBreakpoint2.REQUESTED_CHAR_START, attributes.get(IMarker.CHAR_START));
+ /**
+ * Returns the identifier for the CDI debug model plug-in
+ *
+ * @return plugin identifier
+ */
+ public static String getPluginIdentifier() {
+ return CDebugCorePlugin.getUniqueIdentifier();
+ }
+
+ /**
+ * Creates and returns a debug target for the given CDI target, with the
+ * specified name, and associates it with the given process for console I/O.
+ * The debug target is added to the given launch.
+ *
+ * @param launch
+ * the launch the new debug target will be contained in
+ * @param project
+ * the project to use to persist breakpoints.
+ * @param cdiTarget
+ * the CDI target to create a debug target for
+ * @param name
+ * the name to associate with this target, which will be returned
+ * from <code>IDebugTarget.getName</code>.
+ * @param debuggeeProcess
+ * the process to associate with the debug target, which will be
+ * returned from <code>IDebugTarget.getProcess</code>
+ * @param file
+ * the executable to debug.
+ * @param allowTerminate
+ * allow terminate().
+ * @param allowDisconnect
+ * allow disconnect().
+ * @param stopSymbol
+ * place temporary breakpoint at <code>stopSymbol</code>, ignore
+ * if <code>null</code> or empty.
+ * @param resumeTarget
+ * resume target.
+ * @return a debug target
+ * @throws DebugException
+ * @since 3.1
+ */
+ public static IDebugTarget newDebugTarget(final ILaunch launch, final IProject project, final ICDITarget cdiTarget,
+ final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate,
+ final boolean allowDisconnect, final String stopSymbol, final boolean resumeTarget) throws DebugException {
+ final IDebugTarget[] target = new IDebugTarget[1];
+ IWorkspaceRunnable r = new IWorkspaceRunnable() {
+
+ @Override
+ public void run(IProgressMonitor m) throws CoreException {
+ target[0] = new CDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate,
+ allowDisconnect);
+ ((CDebugTarget) target[0]).start(stopSymbol, resumeTarget);
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(r, null);
+ } catch (CoreException e) {
+ CDebugCorePlugin.log(e);
+ throw new DebugException(e.getStatus());
+ }
+ return target[0];
+ }
+
+ /**
+ * Creates and returns a debug target for the given CDI target, with the
+ * specified name, and associates it with the given process for console I/O.
+ * The debug target is added to the given launch.
+ *
+ * @param launch
+ * the launch the new debug target will be contained in
+ * @param project
+ * the project to use to persist breakpoints.
+ * @param cdiTarget
+ * the CDI target to create a debug target for
+ * @param name
+ * the name to associate with this target, which will be returned
+ * from <code>IDebugTarget.getName</code>.
+ * @param debuggeeProcess
+ * the process to associate with the debug target, which will be
+ * returned from <code>IDebugTarget.getProcess</code>
+ * @param file
+ * the executable to debug.
+ * @param allowTerminate
+ * allow terminate().
+ * @param allowDisconnect
+ * allow disconnect().
+ * @param stopInMain
+ * place temporary breakpoint at main()
+ * @param resumeTarget
+ * resume target.
+ * @return a debug target
+ * @throws DebugException
+ * @deprecated
+ */
+ @Deprecated
+ public static IDebugTarget newDebugTarget(final ILaunch launch, final IProject project, final ICDITarget cdiTarget,
+ final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate,
+ final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget) throws DebugException {
+ final IDebugTarget[] target = new IDebugTarget[1];
+ IWorkspaceRunnable r = new IWorkspaceRunnable() {
+
+ @Override
+ public void run(IProgressMonitor m) throws CoreException {
+ String stopSymbol = null;
+ if (stopInMain)
+ stopSymbol = launch.getLaunchConfiguration().getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
+ ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+ target[0] = new CDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate,
+ allowDisconnect);
+ ((CDebugTarget) target[0]).start(stopSymbol, resumeTarget);
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(r, null);
+ } catch (CoreException e) {
+ CDebugCorePlugin.log(e);
+ throw new DebugException(e.getStatus());
+ }
+ return target[0];
+ }
+
+ /**
+ * Creates and returns a debug target for the given CDI target, with the
+ * specified name, and associates it with the given process for console I/O.
+ * The debug target is added to the given launch.
+ *
+ * @param launch
+ * the launch the new debug target will be contained in
+ * @param project
+ * the project to use to persist breakpoints.
+ * @param cdiTarget
+ * the CDI target to create a debug target for
+ * @param name
+ * the name to associate with this target, which will be returned
+ * from <code>IDebugTarget.getName</code>.
+ * @param debuggeeProcess
+ * the process to associate with the debug target, which will be
+ * returned from <code>IDebugTarget.getProcess</code>
+ * @param file
+ * the executable to debug.
+ * @param allowTerminate
+ * allow terminate().
+ * @param allowDisconnect
+ * allow disconnect().
+ * @param resumeTarget
+ * resume target.
+ * @return a debug target
+ * @throws DebugException
+ */
+ public static IDebugTarget newDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget,
+ final String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowTerminate,
+ boolean allowDisconnect, boolean resumeTarget) throws DebugException {
+ return newDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect,
+ null, resumeTarget);
+ }
+
+ /**
+ * Calculates breakpoint marker ID based on the breakpoint object type.
+ *
+ * @since 7.2
+ */
+ public static String calculateMarkerType(IBreakpoint bp) {
+ if (bp instanceof ICBreakpoint2) {
+ return ((ICBreakpoint2) bp).getMarkerType();
+ }
+ if (bp instanceof ICTracepoint) {
+ if (bp instanceof ICFunctionBreakpoint) {
+ return ICTracepoint.C_FUNCTION_TRACEPOINT_MARKER;
+ } else if (bp instanceof ICAddressBreakpoint) {
+ return ICTracepoint.C_ADDRESS_TRACEPOINT_MARKER;
+ } else if (bp instanceof ICLineBreakpoint) {
+ return ICTracepoint.C_LINE_TRACEPOINT_MARKER;
+ } else {
+ return ICTracepoint.C_TRACEPOINT_MARKER;
+ }
+ } else if (bp instanceof ICFunctionBreakpoint) {
+ return ICFunctionBreakpoint.C_FUNCTION_BREAKPOINT_MARKER;
+ } else if (bp instanceof ICAddressBreakpoint) {
+ return ICAddressBreakpoint.C_ADDRESS_BREAKPOINT_MARKER;
+ } else if (bp instanceof ICLineBreakpoint) {
+ return ICLineBreakpoint.C_LINE_BREAKPOINT_MARKER;
+ } else if (bp instanceof ICEventBreakpoint) {
+ return ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER;
+ } else if (bp instanceof ICBreakpoint) {
+ return ICBreakpoint.C_BREAKPOINT_MARKER;
+ } else if (bp instanceof ILineBreakpoint) {
+ return IBreakpoint.LINE_BREAKPOINT_MARKER;
+ }
+ return IBreakpoint.BREAKPOINT_MARKER;
+ }
+
+ /**
+ * Creates and returns a line breakpoint for the source defined by the given
+ * source handle, at the given line number. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param lineNumber
+ * the line number on which the breakpoint is set - line numbers
+ * are 1 based, associated with the source file in which the
+ * breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return a line breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ * @deprecated as of CDT 5.0 use
+ * {@link #createLineBreakpoint(String, IResource, int, int, boolean, int, String, boolean)}
+ */
+ @Deprecated
+ public static ICLineBreakpoint createLineBreakpoint(String sourceHandle, IResource resource, int lineNumber,
+ boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ return createLineBreakpoint(sourceHandle, resource, ICBreakpointType.REGULAR, lineNumber, enabled, ignoreCount,
+ condition, register);
+ }
+
+ /**
+ * Creates and returns a line breakpoint for the source defined by the given
+ * source handle, at the given line number. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param lineNumber
+ * the line number on which the breakpoint is set - line numbers
+ * are 1 based, associated with the source file in which the
+ * breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return a line breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICLineBreakpoint createLineBreakpoint(String sourceHandle, IResource resource, int type,
+ int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
+ return new CLineBreakpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICLineBreakpoint createBlankLineBreakpoint() {
+ return new CLineBreakpoint();
+ }
+
+ /**
+ * @since 7.0
+ */
+ public static ICLineBreakpoint createLineTracepoint(String sourceHandle, IResource resource, int type,
+ int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
+ return new CLineTracepoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICLineBreakpoint createBlankLineTracepoint() {
+ return new CLineTracepoint();
+ }
+
+ /**
+ * Helper function for setting common line breakpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param sourceHandle
+ * The handle to the breakpoint source.
+ * @param resource
+ * The resource on which to create the associated breakpoint
+ * marker.
+ * @param type
+ * A type constant from ICBreakpointType.
+ * @param lineNumber
+ * The line number on which the breakpoint is set - line numbers
+ * are 1 based, associated with the source file in which the
+ * breakpoint is set.
+ * @param enabled
+ * Whether to enable or disable this breakpoint.
+ * @param ignoreCount
+ * The number of times this breakpoint will be ignored.
+ * @param condition
+ * The breakpoint condition.
+ * @param register
+ * Whether to add this breakpoint to the breakpoint manager.
+ *
+ * @since 7.2
+ */
+ public static void setLineBreakpointAttributes(Map<String, Object> attributes, String sourceHandle, Integer type,
+ int lineNumber, boolean enabled, int ignoreCount, String condition) {
+ attributes.put(IBreakpoint.ID, getPluginIdentifier());
+ attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
+ attributes.put(IBreakpoint.ENABLED, Boolean.valueOf(enabled));
+ attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount));
+ attributes.put(ICBreakpoint.CONDITION, condition);
+ attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
+ attributes.put(ICBreakpointType.TYPE, type);
+
+ // Added for source relocated breakpoints.
+ if (!attributes.containsKey(ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE)) {
+ attributes.put(ICLineBreakpoint2.REQUESTED_SOURCE_HANDLE, sourceHandle);
}
- if (attributes.containsKey(IMarker.CHAR_END) &&
- !attributes.containsKey( ICLineBreakpoint2.REQUESTED_CHAR_END ))
- {
- attributes.put( ICLineBreakpoint2.REQUESTED_CHAR_END, attributes.get(IMarker.CHAR_END));
+ if (!attributes.containsKey(ICLineBreakpoint2.REQUESTED_LINE)) {
+ attributes.put(ICLineBreakpoint2.REQUESTED_LINE, new Integer(lineNumber));
}
- }
-
- /**
- * Creates and returns an address breakpoint for the source defined by the
- * given source handle, at the given address. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param module the module name the breakpoint is set in
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param address the address on which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- * @deprecated as of CDT 5.0 use {@link #createAddressBreakpoint(String, String, IResource, int, int, IAddress, boolean, int, String, boolean)}
- */
- @Deprecated
- public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- return createAddressBreakpoint( module, sourceHandle, resource, ICBreakpointType.REGULAR, -1, address, enabled, ignoreCount, condition, register );
- }
-
- /**
- * Creates and returns an address breakpoint for the source defined by the
- * given source handle, at the given address. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param module the module name the breakpoint is set in
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param type a type constant from ICBreakpointType
- * @param address the address on which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, int type, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- return createAddressBreakpoint( module, sourceHandle, resource, type, -1, address, enabled, ignoreCount, condition, register );
- }
-
- /**
- * Creates and returns an address breakpoint for the source defined by the
- * given source handle, at the given address. The marker associated with the
- * breakpoint will be created on the specified resource.
- *
- * @param module the module name the breakpoint is set in
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param type a type constant from ICBreakpointType
- * @param lineNumber the line number in the source file
- * @param address the address on which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICAddressBreakpoint createAddressBreakpoint( String module, String sourceHandle, IResource resource, int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setAddressBreakpointAttributes( attributes, module, sourceHandle, type, lineNumber, address, enabled, ignoreCount, condition );
- return new CAddressBreakpoint( resource, attributes, register );
- }
-
- /**
- * @since 7.0
- */
- public static ICAddressBreakpoint createAddressTracepoint( String module, String sourceHandle, IResource resource, int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setAddressBreakpointAttributes( attributes, module, sourceHandle, type, lineNumber, address, enabled, ignoreCount, condition );
- return new CAddressTracepoint( resource, attributes, register );
- }
-
- /**
- * Helper function for setting common address breakpoint attributes.
- */
- private static void setAddressBreakpointAttributes( HashMap<String, Object> attributes,
- String module,
- String sourceHandle,
- int type,
- int lineNumber,
- IAddress address,
- boolean enabled,
- int ignoreCount,
- String condition ) {
- setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
- attributes.put( IMarker.CHAR_START, new Integer( -1 ) );
- attributes.put( IMarker.CHAR_END, new Integer( -1 ) );
- attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
- attributes.put( ICBreakpoint.MODULE, module );
- }
-
- /**
- * Creates and returns a watchpoint for the source defined by the given
- * source handle, at the given expression. The marker associated with the
- * watchpoint will be created on the specified resource.
- *
- * @param sourceHandle the handle to the watchpoint source
- * @param resource the resource on which to create the associated watchpoint marker
- * @param writeAccess whether this is write watchpoint
- * @param readAccess whether this is read watchpoint
- * @param expression the expression on which the watchpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return a watchpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setWatchPointAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, "", BigInteger.ZERO, enabled, ignoreCount, condition, register ); //$NON-NLS-1$
- return new CWatchpoint( resource, attributes, register );
- }
-
- /**
- * Creates and returns a watchpoint for the source defined by the given
- * source handle, at the given expression. The marker associated with the
- * watchpoint will be created on the specified resource.
- *
- * @param sourceHandle the handle to the watchpoint source
- * @param resource the resource on which to create the associated watchpoint marker
- * @param charStart the first character index associated with the watchpoint, or
- * -1 if unspecified, in the source file in which the watchpoint
- * is set
- * @param charEnd the last character index associated with the watchpoint, or -1
- * if unspecified, in the source file in which the watchpoint is
- * set
- * @param lineNumber the lineNumber on which the watchpoint is set, or -1 if
- * unspecified - line numbers are 1 based, associated with the
- * source file in which the watchpoint is set
- * @param writeAccess whether this is write watchpoint
- * @param readAccess whether this is read watchpoint
- * @param expression the expression on which the watchpoint is set
- * @param memorySpace the memory space in which the watchpoint is set
- * @param range the range of the watchpoint in addressable units
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return a watchpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, int charStart, int charEnd, int lineNumber, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setWatchPointAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace, range, enabled, ignoreCount, condition, register );
- attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
- attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
- attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
- return new CWatchpoint( resource, attributes, register );
- }
-
- /**
- * Creates and returns a watchpoint for the source defined by the given
- * source handle, at the given expression and over the given range.
- * The marker associated with the watchpoint will be created on the
- * specified resource.
- *
- * @param sourceHandle the handle to the watchpoint source
- * @param resource the resource on which to create the associated watchpoint marker
- * @param writeAccess whether this is write watchpoint
- * @param readAccess whether this is read watchpoint
- * @param expression the expression on which the watchpoint is set
- * @param memorySpace the memory space in which the watchpoint is set
- * @param range the range of the watchpoint in addressable units
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return the watchpoint that was created
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICWatchpoint createWatchpoint( String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setWatchPointAttributes( attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace, range, enabled, ignoreCount, condition, register );
- return new CWatchpoint( resource, attributes, register );
- }
-
- /**
- * Helper function for setting common watchpoint attributes.
- */
- private static void setWatchPointAttributes( HashMap<String, Object> attributes, String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register ) {
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IBreakpoint.ENABLED, Boolean.valueOf( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- attributes.put( ICWatchpoint.EXPRESSION, expression );
- attributes.put( ICWatchpoint2.MEMORYSPACE, memorySpace );
- attributes.put( ICWatchpoint2.RANGE, range.toString() );
- attributes.put( ICWatchpoint.READ, Boolean.valueOf( readAccess ) );
- attributes.put( ICWatchpoint.WRITE, Boolean.valueOf( writeAccess ) );
- }
-
- /**
- * Creates and returns a breakpoint for the function defined by the given
- * name. The marker associated with the breakpoint will be created on the
- * specified resource.
- *
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param function the name of the function this breakpoint suspends execution in
- * @param charStart the first character index associated with the breakpoint, or
- * -1 if unspecified, in the source file in which the breakpoint
- * is set
- * @param charEnd the last character index associated with the breakpoint, or -1
- * if unspecified, in the source file in which the breakpoint is
- * set
- * @param lineNumber the lineNumber on which the breakpoint is set, or -1 if
- * unspecified - line numbers are 1 based, associated with the
- * source file in which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- * @deprecated as of CDT 5.0 use {@link #createFunctionBreakpoint(String, IResource, int, String, int, int, int, boolean, int, String, boolean)}
- */
- @Deprecated
- public static ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle, IResource resource, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- return createFunctionBreakpoint(sourceHandle, resource, ICBreakpointType.REGULAR, function, charStart, charEnd, lineNumber, enabled, ignoreCount, condition, register);
- }
-
- /**
- * Creates and returns a breakpoint for the function defined by the given
- * name. The marker associated with the breakpoint will be created on the
- * specified resource.
- *
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param type a type constant from ICBreakpointType
- * @param function the name of the function this breakpoint suspends execution in
- * @param charStart the first character index associated with the breakpoint, or
- * -1 if unspecified, in the source file in which the breakpoint
- * is set
- * @param charEnd the last character index associated with the breakpoint, or -1
- * if unspecified, in the source file in which the breakpoint is
- * set
- * @param lineNumber the lineNumber on which the breakpoint is set, or -1 if
- * unspecified - line numbers are 1 based, associated with the
- * source file in which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
- * @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Failure creating underlying marker. The exception's
- * status contains the underlying exception responsible for the
- * failure.</li>
- * </ul>
- */
- public static ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle, IResource resource, int type, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setFunctionBreakpointAttributes( attributes, sourceHandle, type, function, charStart, charEnd, lineNumber, enabled, ignoreCount, condition);
- return new CFunctionBreakpoint( resource, attributes, register );
- }
-
- /**
- * @since 7.0
- */
- public static ICFunctionBreakpoint createFunctionTracepoint( String sourceHandle, IResource resource, int type, String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register ) throws CoreException {
- HashMap<String, Object> attributes = new HashMap<String, Object>( 10 );
- setFunctionBreakpointAttributes( attributes, sourceHandle, type, function, charStart, charEnd, lineNumber, enabled, ignoreCount, condition);
- return new CFunctionTracepoint( resource, attributes, register );
- }
-
- /**
- * Helper function for setting common address breakpoint attributes.
- */
- private static void setFunctionBreakpointAttributes( HashMap<String, Object> attributes,
- String sourceHandle,
- int type,
- String function,
- int charStart,
- int charEnd,
- int lineNumber,
- boolean enabled,
- int ignoreCount,
- String condition ) {
- setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
- attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
- attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
- attributes.put( ICLineBreakpoint.FUNCTION, function );
- }
-
- /**
- * Returns the line breakpoint that is already registered with the
- * breakpoint manager for a source with the given handle and the given
- * resource at the given line number.
- *
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param lineNumber the line number
- * @return the line breakpoint that is already registered with the
- * breakpoint manager or <code>null</code> if no such breakpoint
- * is registered
- * @exception CoreException if unable to retrieve the associated marker attributes (line number).
- */
- public static ICLineBreakpoint lineBreakpointExists( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
- String modelId = getPluginIdentifier();
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICLineBreakpoint) ) {
- continue;
- }
- ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i];
- if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getLineNumber() == lineNumber ) {
- return breakpoint;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the watchpoint that is already registered with the breakpoint
- * manager for a source with the given handle and the given resource at the
- * given expression.
- *
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param expression the expression
- * @return the watchpoint that is already registered with the breakpoint
- * manager or <code>null</code> if no such watchpoint is
- * registered
- * @exception CoreException if unable to retrieve the associated marker attributes (line number).
- */
- public static ICWatchpoint watchpointExists( String sourceHandle, IResource resource, String expression ) throws CoreException {
- String modelId = getPluginIdentifier();
- String markerType = CWatchpoint.getMarkerType();
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICWatchpoint) ) {
- continue;
- }
- ICWatchpoint breakpoint = (ICWatchpoint)breakpoints[i];
- if ( breakpoint.getMarker().getType().equals( markerType ) ) {
- if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getMarker().getResource().equals( resource ) ) {
- if ( breakpoint.getExpression().equals( expression ) ) {
- return breakpoint;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the function breakpoint that is already registered with the
- * breakpoint manager for a source with the given handle and the given
- * resource with the given function name.
- *
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param function the fully qualified function name
- * @return the breakpoint that is already registered with the breakpoint
- * manager or <code>null</code> if no such breakpoint is
- * registered
- * @exception CoreException if unable to retrieve the associated marker attributes (line number).
- */
- public static ICFunctionBreakpoint functionBreakpointExists( String sourceHandle, IResource resource, String function ) throws CoreException {
- String modelId = getPluginIdentifier();
- String markerType = CFunctionBreakpoint.getMarkerType();
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICFunctionBreakpoint) ) {
- continue;
- }
- ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i];
- if ( breakpoint.getMarker().getType().equals( markerType ) ) {
- if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getMarker().getResource().equals( resource ) ) {
- if ( breakpoint.getFunction() != null && breakpoint.getFunction().equals( function ) ) {
- return breakpoint;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public static IDebugTarget newDebugTarget( ILaunch launch, ICDITarget target, String name, IProcess iprocess, IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain ) throws CoreException {
- IBinaryExecutable exeFile = getBinary( file );
- String stopSymbol = null;
- if ( stopInMain )
- stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
- return newDebugTarget( launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate, allowDisconnect, stopSymbol, true );
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public static IDebugTarget newAttachDebugTarget( ILaunch launch, ICDITarget target, String name, IProcess debuggerProcess, IFile file ) throws CoreException {
- IBinaryExecutable exeFile = getBinary( file );
- return newDebugTarget( launch, file.getProject(), target, name, null, exeFile, true, true, false );
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch, final ICDITarget target, final String name, final IProcess debuggerProcess, final IFile file ) throws CoreException {
- IBinaryExecutable exeFile = getBinary( file );
- return newDebugTarget( launch, file.getProject(), target, name, null, exeFile, true, false, false );
- }
-
- private static IBinaryExecutable getBinary( IFile file ) throws CoreException {
- IProject project = file.getProject();
- ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions( project );
- for( int i = 0; i < binaryParsersExt.length; i++ ) {
- IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]);
- try {
- IBinaryFile exe = parser.getBinary( file.getLocation() );
- if ( exe instanceof IBinaryExecutable ) {
- return (IBinaryExecutable)exe;
- }
- }
- catch( IOException e ) {
- }
- }
- throw new CoreException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1, DebugCoreMessages.getString( "CDIDebugModel.0" ), null ) ); //$NON-NLS-1$
- }
-
- private static boolean sameSourceHandle( String handle1, String handle2 ) {
- if ( handle1 == null || handle2 == null )
- return false;
- IPath path1 = new Path( handle1 );
- IPath path2 = new Path( handle2 );
- if ( path1.isValidPath( handle1 ) && path2.isValidPath( handle2 ) ) {
- return path1.equals( path2 );
- }
- // If handles are not file names ????
- return handle1.equals( handle2 );
- }
-
- public static ICEventBreakpoint eventBreakpointExists(String type, String arg ) throws CoreException {
- String modelId = getPluginIdentifier();
-
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
- for (int i = 0; i < breakpoints.length; i++) {
- if (!(breakpoints[i] instanceof ICEventBreakpoint)) {
- continue;
- }
- ICEventBreakpoint breakpoint = (ICEventBreakpoint) breakpoints[i];
-
- if (breakpoint.getEventType().equals(type)) {
- String arg1 = breakpoint.getEventArgument();
- if (arg1 == null)
- arg1 = ""; //$NON-NLS-1$
- String arg2 = arg == null ? "" : arg; //$NON-NLS-1$
- if (arg1.equals(arg2))
- return breakpoint;
- }
-
- }
- return null;
- }
- public static ICEventBreakpoint createEventBreakpoint(String type, String arg, boolean register)
- throws CoreException {
- final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- final Map<String,Object> attributes = new HashMap<String,Object>();
- attributes.put(IBreakpoint.ID, CDIDebugModel.getPluginIdentifier());
- attributes.put(IBreakpoint.ENABLED, true);
- attributes.put(ICBreakpoint.IGNORE_COUNT, 0);
- attributes.put(ICBreakpoint.CONDITION, ""); //$NON-NLS-1$
- attributes.put(ICEventBreakpoint.EVENT_TYPE_ID, type);
- attributes.put(ICEventBreakpoint.EVENT_ARG, arg);
- return new CEventBreakpoint(resource, attributes, register);
-
- }
+ if (attributes.containsKey(IMarker.CHAR_START)
+ && !attributes.containsKey(ICLineBreakpoint2.REQUESTED_CHAR_START)) {
+ attributes.put(ICLineBreakpoint2.REQUESTED_CHAR_START, attributes.get(IMarker.CHAR_START));
+ }
+ if (attributes.containsKey(IMarker.CHAR_END) && !attributes.containsKey(ICLineBreakpoint2.REQUESTED_CHAR_END)) {
+ attributes.put(ICLineBreakpoint2.REQUESTED_CHAR_END, attributes.get(IMarker.CHAR_END));
+ }
+ }
+
+ /**
+ * Creates and returns an address breakpoint for the source defined by the
+ * given source handle, at the given address. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param module
+ * the module name the breakpoint is set in
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ * @deprecated as of CDT 5.0 use
+ * {@link #createAddressBreakpoint(String, String, IResource, int, int, IAddress, boolean, int, String, boolean)}
+ */
+ @Deprecated
+ public static ICAddressBreakpoint createAddressBreakpoint(String module, String sourceHandle, IResource resource,
+ IAddress address, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ return createAddressBreakpoint(module, sourceHandle, resource, ICBreakpointType.REGULAR, -1, address, enabled,
+ ignoreCount, condition, register);
+ }
+
+ /**
+ * Creates and returns an address breakpoint for the source defined by the
+ * given source handle, at the given address. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param module
+ * the module name the breakpoint is set in
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICAddressBreakpoint createAddressBreakpoint(String module, String sourceHandle, IResource resource,
+ int type, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ return createAddressBreakpoint(module, sourceHandle, resource, type, -1, address, enabled, ignoreCount,
+ condition, register);
+ }
+
+ /**
+ * Creates and returns an address breakpoint for the source defined by the
+ * given source handle, at the given address. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param module
+ * the module name the breakpoint is set in
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param lineNumber
+ * the line number in the source file
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICAddressBreakpoint createAddressBreakpoint(String module, String sourceHandle, IResource resource,
+ int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setAddressBreakpointAttributes(attributes, module, sourceHandle, type, lineNumber, address, enabled,
+ ignoreCount, condition);
+ return new CAddressBreakpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICAddressBreakpoint createBlankAddressBreakpoint() {
+ return new CAddressBreakpoint();
+ }
+
+ /**
+ * @since 7.0
+ */
+ public static ICAddressBreakpoint createAddressTracepoint(String module, String sourceHandle, IResource resource,
+ int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setAddressBreakpointAttributes(attributes, module, sourceHandle, type, lineNumber, address, enabled,
+ ignoreCount, condition);
+ return new CAddressTracepoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICAddressBreakpoint createBlankAddressTracepoint() {
+ return new CAddressTracepoint();
+ }
+
+ /**
+ * Helper function for setting common address breakpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param module
+ * the module name the breakpoint is set in
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param lineNumber
+ * the line number in the source file
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ *
+ * @since 7.2
+ */
+ public static void setAddressBreakpointAttributes(Map<String, Object> attributes, String module,
+ String sourceHandle, int type, int lineNumber, IAddress address, boolean enabled, int ignoreCount,
+ String condition) {
+ setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
+ attributes.put(IMarker.CHAR_START, new Integer(-1));
+ attributes.put(IMarker.CHAR_END, new Integer(-1));
+ attributes.put(ICLineBreakpoint.ADDRESS, address.toHexAddressString());
+ attributes.put(ICBreakpoint.MODULE, module);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICWatchpoint createBlankWatchpoint() {
+ return new CWatchpoint();
+ }
+
+ /**
+ * Creates and returns a watchpoint for the source defined by the given
+ * source handle, at the given expression. The marker associated with the
+ * watchpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return a watchpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICWatchpoint createWatchpoint(String sourceHandle, IResource resource, boolean writeAccess,
+ boolean readAccess, String expression, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setWatchPointAttributes(attributes, sourceHandle, resource, writeAccess, readAccess, expression, "", //$NON-NLS-1$
+ BigInteger.ZERO, enabled, ignoreCount, condition);
+ return new CWatchpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates and returns a watchpoint for the source defined by the given
+ * source handle, at the given expression. The marker associated with the
+ * watchpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param charStart
+ * the first character index associated with the watchpoint, or
+ * -1 if unspecified, in the source file in which the watchpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the watchpoint, or -1
+ * if unspecified, in the source file in which the watchpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the watchpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the watchpoint is set
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param memorySpace
+ * the memory space in which the watchpoint is set
+ * @param range
+ * the range of the watchpoint in addressable units
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return a watchpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICWatchpoint createWatchpoint(String sourceHandle, IResource resource, int charStart, int charEnd,
+ int lineNumber, boolean writeAccess, boolean readAccess, String expression, String memorySpace,
+ BigInteger range, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setWatchPointAttributes(attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace,
+ range, enabled, ignoreCount, condition);
+ attributes.put(IMarker.CHAR_START, new Integer(charStart));
+ attributes.put(IMarker.CHAR_END, new Integer(charEnd));
+ attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
+ return new CWatchpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates and returns a watchpoint for the source defined by the given
+ * source handle, at the given expression and over the given range. The
+ * marker associated with the watchpoint will be created on the specified
+ * resource.
+ *
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param memorySpace
+ * the memory space in which the watchpoint is set
+ * @param range
+ * the range of the watchpoint in addressable units
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return the watchpoint that was created
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICWatchpoint createWatchpoint(String sourceHandle, IResource resource, boolean writeAccess,
+ boolean readAccess, String expression, String memorySpace, BigInteger range, boolean enabled, int ignoreCount,
+ String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setWatchPointAttributes(attributes, sourceHandle, resource, writeAccess, readAccess, expression, memorySpace,
+ range, enabled, ignoreCount, condition);
+ return new CWatchpoint(resource, attributes, register);
+ }
+
+ /**
+ * Helper function for setting common watchpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param memorySpace
+ * the memory space in which the watchpoint is set
+ * @param range
+ * the range of the watchpoint in addressable units
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ *
+ * @since 7.2
+ */
+ public static void setWatchPointAttributes(Map<String, Object> attributes, String sourceHandle, IResource resource,
+ boolean writeAccess, boolean readAccess, String expression, String memorySpace, BigInteger range,
+ boolean enabled, int ignoreCount, String condition) {
+ attributes.put(IBreakpoint.ID, getPluginIdentifier());
+ attributes.put(IBreakpoint.ENABLED, Boolean.valueOf(enabled));
+ attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount));
+ attributes.put(ICBreakpoint.CONDITION, condition);
+ attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
+ attributes.put(ICWatchpoint.EXPRESSION, expression);
+ attributes.put(ICWatchpoint2.MEMORYSPACE, memorySpace);
+ attributes.put(ICWatchpoint2.RANGE, range.toString());
+ attributes.put(ICWatchpoint.READ, Boolean.valueOf(readAccess));
+ attributes.put(ICWatchpoint.WRITE, Boolean.valueOf(writeAccess));
+ }
+
+ /**
+ * Creates and returns a breakpoint for the function defined by the given
+ * name. The marker associated with the breakpoint will be created on the
+ * specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ * @deprecated as of CDT 5.0 use
+ * {@link #createFunctionBreakpoint(String, IResource, int, String, int, int, int, boolean, int, String, boolean)}
+ */
+ @Deprecated
+ public static ICFunctionBreakpoint createFunctionBreakpoint(String sourceHandle, IResource resource,
+ String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount,
+ String condition, boolean register) throws CoreException {
+ return createFunctionBreakpoint(sourceHandle, resource, ICBreakpointType.REGULAR, function, charStart, charEnd,
+ lineNumber, enabled, ignoreCount, condition, register);
+ }
+
+ /**
+ * Creates and returns a breakpoint for the function defined by the given
+ * name. The marker associated with the breakpoint will be created on the
+ * specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICFunctionBreakpoint createFunctionBreakpoint(String sourceHandle, IResource resource, int type,
+ String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount,
+ String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setFunctionBreakpointAttributes(attributes, sourceHandle, type, function, charStart, charEnd, lineNumber,
+ enabled, ignoreCount, condition);
+ return new CFunctionBreakpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICFunctionBreakpoint createBlankFunctionBreakpoint() {
+ return new CFunctionBreakpoint();
+ }
+
+ /**
+ * Creates and returns a tracepoint for the function defined by the given
+ * name. The marker associated with the breakpoint will be created on the
+ * specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an address breakpoint
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ * @since 7.0
+ */
+ public static ICFunctionBreakpoint createFunctionTracepoint(String sourceHandle, IResource resource, int type,
+ String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount,
+ String condition, boolean register) throws CoreException {
+ HashMap<String, Object> attributes = new HashMap<String, Object>(10);
+ setFunctionBreakpointAttributes(attributes, sourceHandle, type, function, charStart, charEnd, lineNumber,
+ enabled, ignoreCount, condition);
+ return new CFunctionTracepoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICFunctionBreakpoint createBlankFunctionTracepoint() {
+ return new CFunctionTracepoint();
+ }
+
+ /**
+ * Helper function for setting common address breakpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param type
+ * a type constant from ICBreakpointType
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ *
+ * @since 7.2
+ */
+ public static void setFunctionBreakpointAttributes(Map<String, Object> attributes, String sourceHandle, int type,
+ String function, int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition) {
+ setLineBreakpointAttributes(attributes, sourceHandle, type, lineNumber, enabled, ignoreCount, condition);
+ attributes.put(IMarker.CHAR_START, new Integer(charStart));
+ attributes.put(IMarker.CHAR_END, new Integer(charEnd));
+ attributes.put(ICLineBreakpoint.FUNCTION, function);
+ }
+
+ /**
+ * Returns the line breakpoint that is already registered with the
+ * breakpoint manager for a source with the given handle and the given
+ * resource at the given line number.
+ *
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param lineNumber
+ * the line number
+ * @return the line breakpoint that is already registered with the
+ * breakpoint manager or <code>null</code> if no such breakpoint is
+ * registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
+ */
+ public static ICLineBreakpoint lineBreakpointExists(String sourceHandle, IResource resource, int lineNumber)
+ throws CoreException {
+ String modelId = getPluginIdentifier();
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (!(breakpoints[i] instanceof ICLineBreakpoint)) {
+ continue;
+ }
+ ICLineBreakpoint breakpoint = (ICLineBreakpoint) breakpoints[i];
+ if (sameSourceHandle(sourceHandle, breakpoint.getSourceHandle())) {
+ if (breakpoint.getLineNumber() == lineNumber) {
+ return breakpoint;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the watchpoint that is already registered with the breakpoint
+ * manager for a source with the given handle and the given resource at the
+ * given expression.
+ *
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param expression
+ * the expression
+ * @return the watchpoint that is already registered with the breakpoint
+ * manager or <code>null</code> if no such watchpoint is registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
+ */
+ public static ICWatchpoint watchpointExists(String sourceHandle, IResource resource, String expression)
+ throws CoreException {
+ String modelId = getPluginIdentifier();
+ String markerType = ICWatchpoint.C_WATCHPOINT_MARKER;
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (!(breakpoints[i] instanceof ICWatchpoint)) {
+ continue;
+ }
+ ICWatchpoint breakpoint = (ICWatchpoint) breakpoints[i];
+ if (breakpoint.getMarker().getType().equals(markerType)) {
+ if (sameSourceHandle(sourceHandle, breakpoint.getSourceHandle())) {
+ if (breakpoint.getMarker().getResource().equals(resource)) {
+ if (breakpoint.getExpression().equals(expression)) {
+ return breakpoint;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the function breakpoint that is already registered with the
+ * breakpoint manager for a source with the given handle and the given
+ * resource with the given function name.
+ *
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param function
+ * the fully qualified function name
+ * @return the breakpoint that is already registered with the breakpoint
+ * manager or <code>null</code> if no such breakpoint is registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
+ */
+ public static ICFunctionBreakpoint functionBreakpointExists(String sourceHandle, IResource resource, String function)
+ throws CoreException {
+ String modelId = getPluginIdentifier();
+ String markerType = ICFunctionBreakpoint.C_FUNCTION_BREAKPOINT_MARKER;
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (!(breakpoints[i] instanceof ICFunctionBreakpoint)) {
+ continue;
+ }
+ ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint) breakpoints[i];
+ if (breakpoint.getMarker().getType().equals(markerType)) {
+ if (sameSourceHandle(sourceHandle, breakpoint.getSourceHandle())) {
+ if (breakpoint.getMarker().getResource().equals(resource)) {
+ if (breakpoint.getFunction() != null && breakpoint.getFunction().equals(function)) {
+ return breakpoint;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static IDebugTarget newDebugTarget(ILaunch launch, ICDITarget target, String name, IProcess iprocess,
+ IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain)
+ throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ String stopSymbol = null;
+ if (stopInMain)
+ stopSymbol = launch.getLaunchConfiguration().getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
+ ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+ return newDebugTarget(launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate,
+ allowDisconnect, stopSymbol, true);
+ }
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static IDebugTarget newAttachDebugTarget(ILaunch launch, ICDITarget target, String name,
+ IProcess debuggerProcess, IFile file) throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, true, true, false);
+ }
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static IDebugTarget newCoreFileDebugTarget(final ILaunch launch, final ICDITarget target, final String name,
+ final IProcess debuggerProcess, final IFile file) throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, true, false, false);
+ }
+
+ private static IBinaryExecutable getBinary(IFile file) throws CoreException {
+ IProject project = file.getProject();
+ ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(
+ project);
+ for (int i = 0; i < binaryParsersExt.length; i++) {
+ IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]);
+ try {
+ IBinaryFile exe = parser.getBinary(file.getLocation());
+ if (exe instanceof IBinaryExecutable) {
+ return (IBinaryExecutable) exe;
+ }
+ } catch (IOException e) {
+ }
+ }
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1,
+ DebugCoreMessages.getString("CDIDebugModel.0"), null)); //$NON-NLS-1$
+ }
+
+ private static boolean sameSourceHandle(String handle1, String handle2) {
+ if (handle1 == null || handle2 == null)
+ return false;
+ IPath path1 = new Path(handle1);
+ IPath path2 = new Path(handle2);
+ if (path1.isValidPath(handle1) && path2.isValidPath(handle2)) {
+ return path1.equals(path2);
+ }
+ // If handles are not file names ????
+ return handle1.equals(handle2);
+ }
+
+ /**
+ * Checks whether an event breakpoint with given type and argument already
+ * exists. If multiple event breakpoints exist that match given parameters,
+ * only one of them will be returned.
+ *
+ * @param type
+ * Event type.
+ * @param arg
+ * Event argument.
+ * @return Event breakpoint, if found.
+ * @throws CoreException
+ * Exception in reading breakpoint properties.
+ */
+ public static ICEventBreakpoint eventBreakpointExists(String type, String arg) throws CoreException {
+ String modelId = getPluginIdentifier();
+
+ IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (!(breakpoints[i] instanceof ICEventBreakpoint)) {
+ continue;
+ }
+ ICEventBreakpoint breakpoint = (ICEventBreakpoint) breakpoints[i];
+
+ if (breakpoint.getEventType().equals(type)) {
+ String arg1 = breakpoint.getEventArgument();
+ if (arg1 == null)
+ arg1 = ""; //$NON-NLS-1$
+ String arg2 = arg == null ? "" : arg; //$NON-NLS-1$
+ if (arg1.equals(arg2))
+ return breakpoint;
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Creates and registers a new event breakpoint.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param type
+ * Event breakpoint type.
+ * @param arg
+ * Event-specific argument value.
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @return an event breakpoint
+ *
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
+ */
+ public static ICEventBreakpoint createEventBreakpoint(String type, String arg, boolean register)
+ throws CoreException {
+ final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
+ final Map<String, Object> attributes = new HashMap<String, Object>();
+ setEventBreakpointAttributes(attributes, type, arg);
+ return new CEventBreakpoint(resource, attributes, register);
+
+ }
+
+ /**
+ * Helper function for setting common event breakpoint attributes.
+ *
+ * @param attributes
+ * Map to write the attributes into.
+ * @param type
+ * Event breakpoint type.
+ * @param arg
+ * Event-specific argument value.
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ *
+ * @since 7.2
+ */
+ public static void setEventBreakpointAttributes(Map<String, Object> attributes, String type, String arg) {
+ attributes.put(IBreakpoint.ID, CDIDebugModel.getPluginIdentifier());
+ attributes.put(IBreakpoint.ENABLED, true);
+ attributes.put(ICBreakpoint.IGNORE_COUNT, 0);
+ attributes.put(ICBreakpoint.CONDITION, ""); //$NON-NLS-1$
+ attributes.put(ICEventBreakpoint.EVENT_TYPE_ID, type);
+ attributes.put(ICEventBreakpoint.EVENT_ARG, arg);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ * <p>
+ * Note: Before a breakpoint created using this method can be used, the
+ * client must first create a marker and register the breakpoint. The former
+ * is accomplished using {@link IBreakpoint#setMarker(IMarker)}, the latter
+ * using {@link IBreakpointManager#addBreakpoint(IBreakpoint)}.
+ *
+ * @since 7.2
+ */
+ public static ICEventBreakpoint createBlankEventBreakpoint() {
+ return new CEventBreakpoint();
+ }
+
+ /**
+ * Creates a marker for given C breakpoint.
+ *
+ * @param breakpoint
+ * Breakpoint to create the marker for.
+ * @param resource
+ * Resource to create the marker on.
+ * @param attributes
+ * Marker attributes to use.
+ * @param add
+ * Whether to register the breakpoint with breakpoint manager.
+ * @throws CoreException
+ * Error thrown while creating marker.
+ *
+ * @since 7.2
+ */
+ public static void createBreakpointMarker(final ICBreakpoint breakpoint, final IResource resource,
+ final Map<String, Object> attributes, final boolean add) throws CoreException {
+ if (breakpoint.getMarker() != null) {
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID,
+ "Cannot create breakpoint marker breakpoint given breakpoint already has an assotiated maker")); //$NON-NLS-1$
+ }
+
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ // create the marker
+ IMarker marker = resource.createMarker(calculateMarkerType(breakpoint));
+ breakpoint.setMarker(marker);
+
+ // set attributes
+ marker.setAttributes(attributes);
+
+ // set the marker message
+ if (breakpoint instanceof ICBreakpoint2) {
+ ((ICBreakpoint2) breakpoint).refreshMessage();
+ }
+
+ // add to breakpoint manager if requested
+ if (add) {
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(breakpoint);
+ }
+ }
+ };
+ ResourcesPlugin.getWorkspace().run(wr, null);
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java
index 0d7ab756cd5..a56831d017a 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICAddressBreakpoint.java
@@ -14,5 +14,11 @@ package org.eclipse.cdt.debug.core.model;
* A breakpoint that suspend the execution when a particular address is reached.
*/
public interface ICAddressBreakpoint extends ICLineBreakpoint {
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_ADDRESS_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
index 4d00e6c4528..0d85e473e3e 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint.java
@@ -26,6 +26,12 @@ import org.eclipse.debug.core.model.IBreakpoint;
*/
public interface ICBreakpoint extends IBreakpoint {
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cBreakpointMarker"; //$NON-NLS-1$
+
/**
* This debug model identifier can be returned by a debug implementation
* to indicate that a given debugger integration is using C Breakpoints.
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java
index 3e7acd6b207..0c2a784def7 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICBreakpoint2.java
@@ -36,4 +36,9 @@ public interface ICBreakpoint2 extends ICBreakpoint {
*/
public void refreshMessage() throws CoreException;
+ /**
+ * Returns the marker type of the given CDT Breakpoint.
+ * @return marker type ID
+ */
+ public String getMarkerType();
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
index ee635da0cb0..1be934e8665 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
@@ -22,6 +22,13 @@ import org.eclipse.core.runtime.CoreException;
* @since 7.0
*/
public interface ICEventBreakpoint extends ICBreakpoint {
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_EVENT_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cEventBreakpointMarker"; //$NON-NLS-1$;
+
/**
* Breakpoint attribute storing the event breakpoint event id. Basically,
* this indicates what type of event the breakpoint catches--e.g., a C++
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java
index 593bffe77fe..543e1864fc0 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICFunctionBreakpoint.java
@@ -15,5 +15,10 @@ package org.eclipse.cdt.debug.core.model;
* A breakpoint that suspends the execution when a function is entered.
*/
public interface ICFunctionBreakpoint extends ICLineBreakpoint {
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_FUNCTION_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java
index 5f9fd93db9a..d3cc7d6ecd2 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICLineBreakpoint.java
@@ -19,6 +19,12 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
*/
public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint {
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_LINE_BREAKPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$
+
/**
* Breakpoint attribute storing the function this breakpoint suspends
* execution at (value <code>"org.eclipse.cdt.debug.core.function"</code>).
@@ -77,4 +83,5 @@ public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint {
* underlying marker
*/
public String getFileName() throws CoreException;
+
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java
index c55f1c3cd41..ba3fb2b8f1c 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICTracepoint.java
@@ -18,6 +18,31 @@ import org.eclipse.core.runtime.CoreException;
* @since 7.0
*/
public interface ICTracepoint extends ICLineBreakpoint {
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cTracepointMarker"; //$NON-NLS-1$
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_LINE_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineTracepointMarker"; //$NON-NLS-1$
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_ADDRESS_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressTracepointMarker"; //$NON-NLS-1$
+
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_FUNCTION_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionTracepointMarker"; //$NON-NLS-1$
+
/**
* Tracepoint attribute storing a tracepoint's pass count value (value
* <code>"org.eclipse.cdt.debug.core.passCount"</code>). This attribute
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java
index f2e63b7345f..55bd9d38d98 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java
@@ -18,6 +18,12 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
*/
public interface ICWatchpoint extends ICBreakpoint, ILineBreakpoint {
+ /**
+ * Breakpoint marker type for this breakpoint type.
+ * @since 7.2
+ */
+ public static final String C_WATCHPOINT_MARKER = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
+
/**
* Watchpoint attribute storing the expression associated with this
* watchpoint (value <code>"org.eclipse.cdt.debug.core.expression"</code>).
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java
index d5150ff1f75..1fae7032860 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractLineBreakpoint.java
@@ -42,8 +42,8 @@ public abstract class AbstractLineBreakpoint extends CBreakpoint implements ICLi
* @param add
* @throws CoreException
*/
- public AbstractLineBreakpoint( IResource resource, String markerType, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, markerType, attributes, add );
+ public AbstractLineBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
+ super( resource, attributes, add );
}
/*(non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java
index 02611c9e218..a50acc756de 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/AbstractTracepoint.java
@@ -42,8 +42,8 @@ public abstract class AbstractTracepoint extends CBreakpoint implements ICTracep
* @param add
* @throws CoreException
*/
- public AbstractTracepoint( IResource resource, String markerType, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, markerType, attributes, add );
+ public AbstractTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
+ super( resource, attributes, add );
}
/*(non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java
index 7d31ce0ae1c..85df609b65f 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java
@@ -24,8 +24,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddressBreakpoint {
- private static final String C_ADDRESS_BREAKPOINT = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CAddressBreakpoint.
*/
@@ -36,14 +34,14 @@ public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddr
* Constructor for CAddressBreakpoint.
*/
public CAddressBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
- public static String getMarkerType() {
- return C_ADDRESS_BREAKPOINT;
+ public String getMarkerType() {
+ return C_ADDRESS_BREAKPOINT_MARKER;
}
/*
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java
index 0106803b448..f5852983ef3 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressTracepoint.java
@@ -27,8 +27,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CAddressTracepoint extends AbstractTracepoint implements ICAddressBreakpoint, ICTracepoint {
- private static final String C_ADDRESS_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cAddressTracepointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CAddressTracepoint.
*/
@@ -39,13 +37,13 @@ public class CAddressTracepoint extends AbstractTracepoint implements ICAddressB
* Constructor for CAddressTracepoint.
*/
public CAddressTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
- public static String getMarkerType() {
+ public String getMarkerType() {
return C_ADDRESS_TRACEPOINT_MARKER;
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
index b8a8ccdb11d..6182be1db46 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpoint.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints;
-import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -18,8 +17,7 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint2;
import org.eclipse.cdt.debug.core.model.ICBreakpointExtension;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.core.resources.IMarker;
@@ -39,10 +37,12 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.model.Breakpoint;
+import com.ibm.icu.text.MessageFormat;
+
/**
* The base class for all C/C++ specific breakpoints.
*/
-public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ICBreakpointType, IDebugEventSetListener {
+public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint2, ICBreakpointType, IDebugEventSetListener {
/**
* Map of breakpoint extensions. The keys to the map are debug model IDs
@@ -67,14 +67,14 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
/**
* Constructor for CBreakpoint.
*/
- public CBreakpoint( final IResource resource, final String markerType, final Map<String, Object> attributes, final boolean add ) throws CoreException {
+ public CBreakpoint( final IResource resource, final Map<String, Object> attributes, final boolean add ) throws CoreException {
this();
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
@Override
public void run( IProgressMonitor monitor ) throws CoreException {
// create the marker
- setMarker( resource.createMarker( markerType ) );
+ setMarker( resource.createMarker( getMarkerType() ) );
// set attributes
ensureMarker().setAttributes( attributes );
//set the marker message
@@ -86,146 +86,69 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
run( wr );
}
- public void createMarker( final IResource resource, final String markerType, final Map<String, Object> attributes, final boolean add ) throws DebugException {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- @Override
- public void run( IProgressMonitor monitor ) throws CoreException {
- // create the marker
- setMarker( resource.createMarker( markerType ) );
- // set attributes
- ensureMarker().setAttributes( attributes );
- //set the marker message
- setAttribute( IMarker.MESSAGE, getMarkerMessage() );
- // add to breakpoint manager if requested
- register( add );
- }
- };
- run( wr );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
- */
@Override
public String getModelIdentifier() {
return CDIDebugModel.getPluginIdentifier();
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#isInstalled()
- */
@Override
public boolean isInstalled() throws CoreException {
return fInstallCount > 0;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#getCondition()
- */
@Override
public String getCondition() throws CoreException {
return ensureMarker().getAttribute( CONDITION, "" ); //$NON-NLS-1$
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#setCondition(String)
- */
@Override
public void setCondition( String condition ) throws CoreException {
setAttribute( CONDITION, condition );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#getIgnoreCount()
- */
@Override
public int getIgnoreCount() throws CoreException {
return ensureMarker().getAttribute( IGNORE_COUNT, 0 );
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#setIgnoreCount(int)
- */
@Override
public void setIgnoreCount( int ignoreCount ) throws CoreException {
setAttribute( IGNORE_COUNT, ignoreCount );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getType()
- */
@Override
public int getType() throws CoreException {
return ensureMarker().getAttribute( TYPE, 0 );
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setType(int)
- */
@Override
public void setType(int type) throws CoreException {
setAttribute( TYPE, type );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#getThreadId()
- */
@Override
public String getThreadId() throws CoreException {
return ensureMarker().getAttribute( THREAD_ID, null );
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.ICBreakpoint#setThreadId(String)
- */
@Override
public void setThreadId( String threadId ) throws CoreException {
setAttribute( THREAD_ID, threadId );
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getSourceHandle()
- */
@Override
public String getSourceHandle() throws CoreException {
return ensureMarker().getAttribute( SOURCE_HANDLE, null );
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setSourceHandle(java.lang.String)
- */
@Override
public void setSourceHandle( String sourceHandle ) throws CoreException {
setAttribute( SOURCE_HANDLE, sourceHandle );
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(DebugEvent[])
- */
@Override
public void handleDebugEvents( DebugEvent[] events ) {
}
@@ -257,9 +180,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
abstract protected String getMarkerMessage() throws CoreException;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#incrementInstallCount()
- */
@Override
public synchronized int incrementInstallCount() throws CoreException {
++fInstallCount;
@@ -279,9 +199,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
return fInstallCount;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#decrementInstallCount()
- */
@Override
public synchronized int decrementInstallCount() throws CoreException {
fInstallCount--;
@@ -293,9 +210,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
return fInstallCount;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#resetInstallCount()
- */
@Override
public synchronized void resetInstallCount() throws CoreException {
if (fInstallCount != 0) {
@@ -304,31 +218,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.model.Breakpoint#ensureMarker()
- */
- @Override
- protected IMarker ensureMarker() throws DebugException {
- return super.ensureMarker();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.model.Breakpoint#setAttribute(String, Object)
- */
- @Override
- protected void setAttribute( String attributeName, Object value ) throws CoreException {
- super.setAttribute( attributeName, value );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#isConditional()
- */
@Override
public boolean isConditional() throws CoreException {
return ((getCondition() != null && getCondition().trim().length() > 0) || getIgnoreCount() > 0);
@@ -359,17 +248,11 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getModule()
- */
@Override
public String getModule() throws CoreException {
return ensureMarker().getAttribute( MODULE, null );
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setModule(java.lang.String)
- */
@Override
public void setModule( String module ) throws CoreException {
setAttribute( MODULE, module );
@@ -436,6 +319,10 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IC
}
return fExtensions.get(debugModelId);
}
-
-
+
+ @Override
+ public void refreshMessage() throws CoreException {
+ IMarker marker = ensureMarker();
+ marker.setAttribute(IMarker.MESSAGE, getMarkerMessage());
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java
index 70377807de7..96e16776e77 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CEventBreakpoint.java
@@ -14,24 +14,15 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.DebugException;
public class CEventBreakpoint extends CBreakpoint implements ICEventBreakpoint {
- private static final String C_EVENTBREAKPOINT_MARKER_TYPE = "org.eclipse.cdt.debug.core.cEventBreakpointMarker"; //$NON-NLS-1$;
-
public CEventBreakpoint() {
-
- }
-
- public static String getMarkerType() {
- return C_EVENTBREAKPOINT_MARKER_TYPE;
}
public CEventBreakpoint(IResource resource, Map<String, Object> attributes, boolean add) throws CoreException {
@@ -39,29 +30,14 @@ public class CEventBreakpoint extends CBreakpoint implements ICEventBreakpoint {
// event breakpoint must set non null EVENT_TYPE_ID property to be valid
if (attributes.get(EVENT_TYPE_ID) == null)
throw new IllegalArgumentException();
- setBreakpointMarker(resource, getMarkerType(), attributes, add);
-
+ CDIDebugModel.createBreakpointMarker(this, resource, attributes, add);
}
- private void setBreakpointMarker(final IResource resource, final String markerType,
- final Map<String, Object> attributes, final boolean add) throws DebugException {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- // create the marker
- setMarker(resource.createMarker(markerType));
- // set attributes
- ensureMarker().setAttributes(attributes);
- // set the marker message
- setAttribute(IMarker.MESSAGE, getMarkerMessage());
- // add to breakpoint manager if requested
- register(add);
- }
- };
- run(wr);
+ @Override
+ public String getMarkerType() {
+ return C_EVENT_BREAKPOINT_MARKER;
}
-
+
@Override
protected String getMarkerMessage() throws CoreException {
// default message, overridden by label provider, which would take care of translation
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java
index a9f27aeb4fa..9d36cdd948a 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java
@@ -24,8 +24,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CFunctionBreakpoint extends AbstractLineBreakpoint implements ICFunctionBreakpoint {
- private static final String C_FUNCTION_BREAKPOINT = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CFunctionBreakpoint.
*/
@@ -36,14 +34,14 @@ public class CFunctionBreakpoint extends AbstractLineBreakpoint implements ICFun
* Constructor for CFunctionBreakpoint.
*/
public CFunctionBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
- public static String getMarkerType() {
- return C_FUNCTION_BREAKPOINT;
+ public String getMarkerType() {
+ return C_FUNCTION_BREAKPOINT_MARKER;
}
/*(non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java
index ea0503cf0d6..8631eab5a39 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionTracepoint.java
@@ -27,8 +27,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CFunctionTracepoint extends AbstractTracepoint implements ICFunctionBreakpoint, ICTracepoint {
- private static final String C_FUNCTION_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cFunctionTracepointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CFunctionTracepoint.
*/
@@ -39,15 +37,15 @@ public class CFunctionTracepoint extends AbstractTracepoint implements ICFunctio
* Constructor for CFunctionTracepoint.
*/
public CFunctionTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
/**
- * Returns the type of marker associated with this type of breakpoints
- */
- public static String getMarkerType() {
- return C_FUNCTION_TRACEPOINT_MARKER;
- }
+ * Returns the type of marker associated with this type of breakpoints
+ */
+ public String getMarkerType() {
+ return C_FUNCTION_TRACEPOINT_MARKER;
+ }
/*(non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java
index 37f16afd8fd..05a4b0173fa 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints;
-import com.ibm.icu.text.MessageFormat;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugUtils;
@@ -20,14 +19,14 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import com.ibm.icu.text.MessageFormat;
+
/**
* A breakpoint that suspends the execution when a particular line of code is
* reached.
*/
public class CLineBreakpoint extends AbstractLineBreakpoint {
- private static final String C_LINE_BREAKPOINT = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CLineBreakpoint.
*/
@@ -38,14 +37,12 @@ public class CLineBreakpoint extends AbstractLineBreakpoint {
* Constructor for CLineBreakpoint.
*/
public CLineBreakpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
-
- /**
- * Returns the type of marker associated with this type of breakpoints
- */
- public static String getMarkerType() {
- return C_LINE_BREAKPOINT;
+
+ @Override
+ public String getMarkerType() {
+ return C_LINE_BREAKPOINT_MARKER;
}
/*(non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java
index c911cc63daf..9089a732cd1 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineTracepoint.java
@@ -29,8 +29,6 @@ import com.ibm.icu.text.MessageFormat;
*/
public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint, ICLineBreakpoint2 {
- private static final String C_LINE_TRACEPOINT_MARKER = "org.eclipse.cdt.debug.core.cLineTracepointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CLineTracepoint.
*/
@@ -41,16 +39,14 @@ public class CLineTracepoint extends AbstractTracepoint implements ICTracepoint,
* Constructor for CLineTracepoint.
*/
public CLineTracepoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
- /**
- * Returns the type of marker associated with this type of breakpoints
- */
- public static String getMarkerType() {
- return C_LINE_TRACEPOINT_MARKER;
+ @Override
+ public String getMarkerType() {
+ return C_LINE_TRACEPOINT_MARKER;
}
-
+
@Override
public synchronized int decrementInstallCount() throws CoreException {
int count = super.decrementInstallCount();
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java
index 75f992d126d..e1a23732e1d 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java
@@ -25,8 +25,6 @@ import org.eclipse.core.runtime.CoreException;
*/
public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
- private static final String C_WATCHPOINT = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
-
/**
* Constructor for CWatchpoint.
*/
@@ -37,13 +35,14 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
* Constructor for CWatchpoint.
*/
public CWatchpoint( IResource resource, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
- protected CWatchpoint( IResource resource, String marker, Map<String, Object> attributes, boolean add ) throws CoreException {
- super( resource, marker, attributes, add );
+ @Override
+ public String getMarkerType() {
+ return C_WATCHPOINT_MARKER;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICWatchpoint#isWriteType()
*/
@@ -68,13 +67,6 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint2 {
return ensureMarker().getAttribute( EXPRESSION, "" ); //$NON-NLS-1$
}
- /**
- * Returns the type of marker associated with this type of breakpoints
- */
- public static String getMarkerType() {
- return C_WATCHPOINT;
- }
-
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
index 934302b9c8d..11eba71e802 100644
--- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
@@ -7,8 +7,10 @@ Bundle-Activator: org.eclipse.cdt.debug.ui.CDebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package:
- org.eclipse.cdt.debug.internal.ui;x-internal:=true,
+ org.eclipse.cdt.debug.internal.ui;x-internal:x-friends:="org.eclipse.cdt.dsf.ui";x-friends:="org.eclipse.cdt.dsf.ui",
org.eclipse.cdt.debug.internal.ui.actions;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.memorybrowser",
+ org.eclipse.cdt.debug.internal.ui.actions.breakpoints;x-internal:=true,
+ org.eclipse.cdt.debug.internal.ui.breakpoints;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.commands;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.dialogfields;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.dialogs;x-internal:=true,
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index 15a35463bcd..e2bd92dc753 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2011 QNX Software Systems and others.
+# Copyright (c) 2000, 2012 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
@@ -35,9 +35,10 @@ ToggleInstructionStepModeAction.tooltip=Instruction Stepping Mode
ShowDebuggerConsoleAction.label=Show Debugger Console
ShowDebuggerConsoleAction.tooltip=Show Debugger Console On Target Selection
-AddBreakpoint.label=Toggle &Breakpoint
-EnableBreakpoint.label=&Toggle Breakpoint Enabled
-BreakpointProperties.label=Breakpoint P&roperties...
+AddBreakpoint.label=Toggle &Breakpoint\tDouble Click
+AddBreakpointInteractive.label=&Add Breakpoint...\tCtrl+Double Click
+EnableBreakpoint.label=&Toggle Breakpoint Enabled\tShift+Double Click
+BreakpointProperties.label=Breakpoint P&roperties...\tCtrl+Double Click
BreakpointPropertiesCommand.name=C/C++ Breakpoint Properties
BreakpointPropertiesCommand.description=View and edit properties for a given C/C++ breakpoint
ManageFunctionBreakpointAction.label=Toggle Breakpoint
@@ -57,6 +58,8 @@ AddWatchpoint.label=Add Watchpoint (C/C++)...
AddWatchpoint.tooltip=Add Watchpoint (C/C++)
AddEventBreakpoint.label=Add Event Breakpoint (C/C++)...
AddEventBreakpoint.tooltip=Add Event Breakpoint (C/C++)
+AddFunctionBreakpoint.label=Add Function Breakpoint (C/C++)...
+AddFunctionBreakpoint.tooltip=Add Function Breakpoint (C/C++)
AddGlobalsAction.label=Add Global Variables...
AddGlobalsAction.tooltip=Add Global Variables
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index fa53348e75b..afdcbfac5a5 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -416,27 +416,27 @@
targetID="#CEditorRulerContext"
id="org.eclipse.cdt.debug.ui.CEditorRulerActions">
<action
- label="%BreakpointTypes.label"
- class="org.eclipse.debug.ui.actions.RulerBreakpointTypesActionDelegate"
- id="org.eclipse.cdt.debug.ui.breakpointTypesAction"
- menubarPath="debug"
- style="pulldown">
- </action>
- <action
label="%BreakpointProperties.label"
helpContextId="breakpoint_properties_action_context"
- class="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerActionDelegate"
menubarPath="debug"
id="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerActionDelegate">
</action>
<action
label="%EnableBreakpoint.label"
helpContextId="enable_disable_breakpoint_action_context"
- class="org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerActionDelegate"
+ class="org.eclipse.debug.ui.actions.RulerEnableDisableBreakpointActionDelegate"
menubarPath="debug"
id="org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerActionDelegate">
</action>
<action
+ label="%AddBreakpointInteractive.label"
+ helpContextId="add_breakpoint_interactive_action_context"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CAddBreakpointInteractiveRulerActionDelegate"
+ menubarPath="debug"
+ id="org.eclipse.debug.ui.actions.RulerCreateBreakpointInteractiveAction">
+ </action>
+ <action
label="%AddBreakpoint.label"
helpContextId="manage_breakpoint_action_context"
class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
@@ -496,18 +496,25 @@
<action
label="%BreakpointProperties.label"
helpContextId="breakpoint_properties_action_context"
- class="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerActionDelegate"
menubarPath="debug"
id="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerActionDelegate">
</action>
<action
label="%EnableBreakpoint.label"
helpContextId="enable_disable_breakpoint_action_context"
- class="org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerActionDelegate"
+ class="org.eclipse.debug.ui.actions.RulerEnableDisableBreakpointActionDelegate"
menubarPath="debug"
id="org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerActionDelegate">
</action>
<action
+ label="%AddBreakpointInteractive.label"
+ helpContextId="create_breakpoint_interactive_action_context"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CAddBreakpointInteractiveRulerActionDelegate"
+ menubarPath="debug"
+ id="org.eclipse.debug.ui.actions.RulerCreateBreakpointInteractiveAction">
+ </action>
+ <action
label="%AddBreakpoint.label"
helpContextId="manage_breakpoint_action_context"
class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
@@ -605,7 +612,7 @@
icon="icons/elcl16/function_brkpt_co.gif"
helpContextId="manage_function_breakpoint_action_context"
tooltip="%ManageFunctionBreakpointAction.tooltip"
- class="org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CToggleMethodBreakpointActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.ui.actions.function.ToggleMethodBreakpointAction">
@@ -619,7 +626,7 @@
icon="icons/elcl16/function_brkpt_co.gif"
helpContextId="manage_function_breakpoint_action_context"
tooltip="%ManageFunctionBreakpointAction.tooltip"
- class="org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CToggleMethodBreakpointActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.ui.actions.method.ToggleMethodBreakpointAction">
@@ -629,7 +636,7 @@
objectClass="org.eclipse.cdt.debug.internal.core.ICWatchpointTarget"
id="org.eclipse.cdt.debug.ui.WatchpointActions">
<action
- class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointOnVariableActionDelegate"
enablesFor="1"
icon="icons/elcl16/watchpoint_co.gif"
id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate"
@@ -854,7 +861,7 @@
id="org.eclipse.debug.ui.MemoryView.RenderingViewPane.popupMenu.1"
targetID="org.eclipse.debug.ui.MemoryView.RenderingViewPane.1">
<action
- class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnMemoryActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointOnMemoryActionDelegate"
enablesFor="1"
icon="icons/elcl16/watchpoint_co.gif"
id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnMemoryActionDelegate.1"
@@ -867,7 +874,7 @@
id="org.eclipse.debug.ui.MemoryView.RenderingViewPane.popupMenu.2"
targetID="org.eclipse.debug.ui.MemoryView.RenderingViewPane.2">
<action
- class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnMemoryActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointOnMemoryActionDelegate"
enablesFor="1"
icon="icons/elcl16/watchpoint_co.gif"
id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnMemoryActionDelegate.2"
@@ -946,7 +953,7 @@
</enablement>
</action>
<action
- class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointActionDelegate"
icon="icons/elcl16/watchpoint_co.gif"
id="org.eclipse.cdt.debug.ui.addWatchpoint"
label="%AddWatchpoint.label"
@@ -955,7 +962,7 @@
helpContextId="add_watchpoint_action_context"
tooltip="%AddWatchpoint.tooltip"/>
<action
- class="org.eclipse.cdt.debug.internal.ui.actions.AddEventBreakpointActionDelegate"
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddEventBreakpointActionDelegate"
icon="icons/obj16/eventbreakpoint_obj.gif"
id="org.eclipse.cdt.debug.internal.ui.actions.AddEventBreakpointActionDelegate"
label="%AddEventBreakpoint.label"
@@ -963,6 +970,15 @@
style="push"
tooltip="%AddEventBreakpoint.tooltip">
</action>
+ <action
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddFunctionBreakpointActionDelegate"
+ icon="icons/elcl16/function_brkpt_co.gif"
+ id="org.eclipse.cdt.debug.ui.addFunctionBreakpoint"
+ label="%AddFunctionBreakpoint.label"
+ menubarPath="cDebugActions"
+ style="push"
+ helpContextId="add_function_breakpoint_action_context"
+ tooltip="%AddFunctionBreakpoint.tooltip"/>
</viewContribution>
<viewContribution
targetID="org.eclipse.debug.ui.VariableView"
@@ -1172,18 +1188,28 @@
<extension
point="org.eclipse.ui.propertyPages">
<page
- class="org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointPropertyPage"
+ class="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointPropertyPage"
id="org.eclipse.cdt.debug.ui.propertypages.breakpoint.common"
name="%CommonBreakpointPage.label">
<enabledWhen>
- <and>
- <adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
- </adapt>
- <not>
- <adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint">
+ <or>
+ <and>
+ <adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint">
</adapt>
- </not>
- </and>
+ <not>
+ <adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint">
+ </adapt>
+ </not>
+
+ </and>
+ <and>
+ <instanceof value="org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext"/>
+ <test property="org.eclipse.cdt.debug.ui.createBreakpointAdapt" value="org.eclipse.cdt.debug.core.model.ICBreakpoint" />
+ <not>
+ <test property="org.eclipse.cdt.debug.ui.createBreakpointAdapt" value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
+ </not>
+ </and>
+ </or>
</enabledWhen>
</page>
<page
@@ -1201,7 +1227,7 @@
</and>
</enabledWhen>
</page>
- <page class="org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointFilteringPage"
+ <page class="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointFilteringPage"
id="org.eclipse.cdt.debug.ui.propertypages.breakpoint.filtering"
name="%FilteringBreakpointPage.label">
<filter name="debugModelId" value="org.eclipse.cdt.debug.core"/>
@@ -1296,7 +1322,7 @@
<extension
point="org.eclipse.ui.editors.markerAnnotationSpecification">
<specification
- annotationImageProvider="org.eclipse.cdt.debug.internal.ui.BreakpointImageProvider"
+ annotationImageProvider="org.eclipse.cdt.debug.internal.ui.breakpoints.BreakpointImageProvider"
annotationType="org.eclipse.cdt.debug.core.breakpoint"
colorPreferenceKey="breakpointIndicationColor"
colorPreferenceValue="0,0,255"
@@ -1340,7 +1366,7 @@
<adapter type="org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget"/>
</factory>
<factory
- class="org.eclipse.cdt.debug.internal.ui.CBreakpointWorkbenchAdapterFactory"
+ class="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointWorkbenchAdapterFactory"
adaptableType="org.eclipse.cdt.debug.core.model.ICBreakpoint">
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
</factory>
@@ -1736,6 +1762,18 @@
</visibleWhen>
</command>
</menuContribution>
+ <menuContribution
+ locationURI="popup:#CEditorRulerContext?after=debug">
+ <menu
+ id="breakpointTypes"
+ label="%BreakpointTypes.label">
+ <dynamic
+ id="org.eclipse.debug.ui.actions.BreakpointTypesContribution"
+ class="org.eclipse.debug.ui.actions.BreakpointTypesContribution">
+ </dynamic>
+ </menu>
+ </menuContribution>
+
</extension>
<extension
point="org.eclipse.core.runtime.adapters">
@@ -1766,14 +1804,14 @@
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
- class="org.eclipse.cdt.debug.internal.ui.ToggleCBreakpointTester"
+ class="org.eclipse.cdt.debug.internal.ui.breakpoints.ToggleCBreakpointTester"
id="org.eclipse.cdt.debug.ui.editorToggleBreakpointTester"
namespace="org.eclipse.cdt.debug.ui"
properties="isCEditorSupportsCBreakpoint,isAsmEditorSupportsCBreakpoint,isDisassemblyEditorSupportsCBreakpoint"
type="org.eclipse.ui.IWorkbenchPart">
</propertyTester>
<propertyTester
- class="org.eclipse.cdt.debug.internal.ui.ToggleCBreakpointTester"
+ class="org.eclipse.cdt.debug.internal.ui.breakpoints.ToggleCBreakpointTester"
id="org.eclipse.cdt.debug.ui.declarationToggleBreakpointTester"
namespace="org.eclipse.cdt.debug.ui"
properties="isCDeclarationSupportsCBreakpoint"
@@ -1784,7 +1822,7 @@
<extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
<toggleTargetFactory
id="org.eclipse.cdt.debug.ui.ToggleCBreakpointsTargetFactory"
- class="org.eclipse.cdt.debug.internal.ui.actions.ToggleCBreakpointsTargetFactory">
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.ToggleCBreakpointsTargetFactory">
<enablement>
<!-- Enable the breakpoint toggle for CDT's editors and model elements -->
<or>
@@ -1802,7 +1840,7 @@
</toggleTargetFactory>
<toggleTargetFactory
id="org.eclipse.cdt.debug.ui.ToggleCTracepointsTargetFactory"
- class="org.eclipse.cdt.debug.internal.ui.actions.ToggleCTracepointsTargetFactory">
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.ToggleCTracepointsTargetFactory">
<enablement>
<!-- Enable the breakpoint toggle for CDT's editors and model elements -->
<and>
@@ -2093,7 +2131,7 @@
point="org.eclipse.ui.commands">
<command
categoryId="org.eclipse.debug.ui.category.run"
- defaultHandler="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesHandler"
+ defaultHandler="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesHandler"
description="%BreakpointPropertiesCommand.description"
helpContextId="breakpoint_properties_action_context"
id="org.eclipse.cdt.debug.command.breakpointProperties"
@@ -2534,5 +2572,15 @@
</activeWhen>
</handler>
</extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.cdt.debug.internal.ui.breakpoints.CreateBreakpointTester"
+ id="org.eclipse.cdt.debug.ui.CreateBreakpointTester"
+ namespace="org.eclipse.cdt.debug.ui"
+ properties="createBreakpointAdapt"
+ type="org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext">
+ </propertyTester>
+ </extension>
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.ui/schema/BreakpointUIContribution.exsd b/debug/org.eclipse.cdt.debug.ui/schema/BreakpointUIContribution.exsd
index 85dd1dc6465..d9b6c850f5d 100644
--- a/debug/org.eclipse.cdt.debug.ui/schema/BreakpointUIContribution.exsd
+++ b/debug/org.eclipse.cdt.debug.ui/schema/BreakpointUIContribution.exsd
@@ -107,7 +107,7 @@ If not specified this attribute will not be visible in Common page.
<attribute name="type" type="string" use="default" value="string">
<annotation>
<documentation>
- Type of the attribute: boolean, string, integer
+ Type of the attribute. Value should be one of "boolean", "string", "integer", "float".
</documentation>
</annotation>
</attribute>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
index ac66eb4759d..473330f68a3 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
@@ -11,9 +11,10 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui;
-import com.ibm.icu.text.MessageFormat;
+import java.util.Iterator;
import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType;
@@ -21,7 +22,9 @@ import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
import org.eclipse.cdt.debug.internal.ui.disassembly.rendering.DisassemblyEditorInput;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction;
import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
@@ -29,21 +32,38 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IURIEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.progress.UIJob;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
+
+import com.ibm.icu.text.MessageFormat;
/**
* Utility methods for C/C++ Debug UI.
@@ -209,7 +229,7 @@ public class CDebugUIUtils {
return null;
StringBuffer baseText = new StringBuffer( text );
if ( element instanceof ICDebugElementStatus && !((ICDebugElementStatus)element).isOK() ) {
- baseText.append( MessageFormat.format( " <{0}>", new String[] { ((ICDebugElementStatus)element).getMessage() } ) ); //$NON-NLS-1$
+ baseText.append( MessageFormat.format( " <{0}>", new Object[] { ((ICDebugElementStatus)element).getMessage() } ) ); //$NON-NLS-1$
}
if ( element instanceof IAdaptable ) {
IEnableDisableTarget target = (IEnableDisableTarget)((IAdaptable)element).getAdapter( IEnableDisableTarget.class );
@@ -251,5 +271,71 @@ public class CDebugUIUtils {
uiJob.setSystem(true);
uiJob.schedule();
}
+
+ /**
+ * Resolves the {@link IBreakpoint} from the given editor and ruler information. Returns <code>null</code>
+ * if no breakpoint exists or the operation fails.
+ *
+ * @param editor the editor
+ * @param info the current ruler information
+ * @return the {@link IBreakpoint} from the current editor position or <code>null</code>
+ */
+ public static IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
+ IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
+ IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ if (annotationModel != null) {
+ @SuppressWarnings("unchecked")
+ Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object instanceof SimpleMarkerAnnotation) {
+ SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
+ IMarker marker = markerAnnotation.getMarker();
+ try {
+ if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
+ Position position = annotationModel.getPosition(markerAnnotation);
+ int line = document.getLineOfOffset(position.getOffset());
+ if (line == info.getLineOfLastMouseButtonActivity()) {
+ IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+ if (breakpoint != null) {
+ return breakpoint;
+ }
+ }
+ }
+ } catch (CoreException e) {
+ } catch (BadLocationException e) {
+ }
+ }
+ }
+ }
+ return null;
+ }
+ public static void editBreakpointProperties(IWorkbenchPart part, final ICBreakpoint bp) {
+ final ISelection debugContext = DebugUITools.getDebugContextForPart(part);
+ CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
+ part.getSite(),
+ new ISelectionProvider() {
+ @Override
+ public ISelection getSelection() {
+ return new StructuredSelection( bp );
+ }
+ @Override public void addSelectionChangedListener( ISelectionChangedListener listener ) {}
+ @Override public void removeSelectionChangedListener( ISelectionChangedListener listener ) {}
+ @Override public void setSelection( ISelection selection ) {}
+ },
+ new IDebugContextProvider() {
+ @Override
+ public ISelection getActiveContext() {
+ return debugContext;
+ }
+ @Override public void addDebugContextListener(IDebugContextListener listener) {}
+ @Override public void removeDebugContextListener(IDebugContextListener listener) {}
+ @Override public IWorkbenchPart getPart() { return null; }
+
+ }
+ );
+ propertiesAction.run();
+ propertiesAction.dispose();
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractToggleBreakpointAdapter.java
deleted file mode 100644
index 466d291bbdb..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractToggleBreakpointAdapter.java
+++ /dev/null
@@ -1,463 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Mentor Graphics 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:
- * Mentor Graphics - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import java.math.BigInteger;
-
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.IDeclaration;
-import org.eclipse.cdt.core.model.IFunction;
-import org.eclipse.cdt.core.model.IFunctionDeclaration;
-import org.eclipse.cdt.core.model.IMethod;
-import org.eclipse.cdt.core.model.ISourceRange;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IVariable;
-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.internal.ui.CDebugUIUtils;
-import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
-import org.eclipse.cdt.ui.CDTUITools;
-import org.eclipse.core.filesystem.URIUtil;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.editors.text.ILocationProvider;
-import org.eclipse.ui.texteditor.IEditorStatusLine;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-abstract public class AbstractToggleBreakpointAdapter implements IToggleBreakpointsTargetExtension {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
- String errorMessage = null;
- if ( part instanceof ITextEditor ) {
- ITextEditor textEditor = (ITextEditor)part;
- IEditorInput input = textEditor.getEditorInput();
- if ( input == null ) {
- errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$
- }
- else {
- IDocument document = textEditor.getDocumentProvider().getDocument( input );
- if ( document == null ) {
- errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$
- }
- else {
- IResource resource = getResource( textEditor );
- if ( resource == null ) {
- errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_resource_1" ); //$NON-NLS-1$
- }
- else {
- BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
- int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine() );
- if ( lineNumber == -1 ) {
- errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
- }
- else {
- String sourceHandle = getSourceHandle( input );
- ICLineBreakpoint breakpoint = findLineBreakpoint( sourceHandle, resource, lineNumber );
- if ( breakpoint != null ) {
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
- }
- else {
- createLineBreakpoint( sourceHandle, resource, lineNumber );
- }
- return;
- }
- }
- }
- }
- }
- else {
- errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$
- }
- throw new CoreException(
- new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), IInternalCDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
- return (selection instanceof ITextSelection);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void toggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
- ICElement element = getCElementFromSelection( part, selection );
- if ( element instanceof IFunction || element instanceof IMethod ) {
- toggleMethodBreakpoints0( (IDeclaration)element );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
- ICElement element = getCElementFromSelection( part, selection );
- return (element instanceof IFunction || element instanceof IMethod);
- }
-
- protected ICElement getCElementFromSelection( IWorkbenchPart part, ISelection selection ) {
- if ( selection instanceof ITextSelection ) {
- ITextSelection textSelection = (ITextSelection)selection;
- String text = textSelection.getText();
- if ( text != null ) {
- if ( part instanceof ITextEditor ) {
- ICElement editorElement = CDTUITools.getEditorInputCElement( ((ITextEditor)part).getEditorInput() );
- if ( editorElement instanceof ITranslationUnit ) {
- ITranslationUnit tu = (ITranslationUnit)editorElement;
- try {
- if ( tu.isStructureKnown() && tu.isConsistent() ) {
- return tu.getElementAtOffset( textSelection.getOffset() );
- }
- }
- catch( CModelException exc ) {
- // ignored on purpose
- }
- }
- }
- else {
- IResource resource = getResource( part );
- if ( resource instanceof IFile ) {
- ITranslationUnit tu = getTranslationUnit( (IFile)resource );
- if ( tu != null ) {
- try {
- ICElement element = tu.getElement( text.trim() );
- if ( element == null ) {
- element = tu.getElementAtLine( textSelection.getStartLine() );
- }
- return element;
- }
- catch( CModelException e ) {
- }
- }
- }
- }
- }
- }
- else if ( selection instanceof IStructuredSelection ) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- if ( ss.size() == 1 ) {
- Object object = ss.getFirstElement();
- if ( object instanceof ICElement ) {
- return (ICElement)object;
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
- IVariable variable = getVariableFromSelection( part, selection );
- if ( variable != null ) {
- toggleVariableWatchpoint( part, variable );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
- return getVariableFromSelection( part, selection ) != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public boolean canToggleBreakpoints( IWorkbenchPart part, ISelection selection ) {
- return ( canToggleLineBreakpoints( part, selection )
- || canToggleWatchpoints( part, selection )
- || canToggleMethodBreakpoints( part, selection ) );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void toggleBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
- if ( canToggleLineBreakpoints( part, selection ) ) {
- toggleLineBreakpoints( part, selection );
- }
- else {
- ICElement element = getCElementFromSelection( part, selection );
- if ( element instanceof IFunction || element instanceof IMethod ) {
- toggleMethodBreakpoints0( (IDeclaration)element );
- }
- else if ( element instanceof IVariable ) {
- toggleVariableWatchpoint( part, (IVariable)element );
- }
- }
- }
-
- protected IVariable getVariableFromSelection( IWorkbenchPart part, ISelection selection ) {
- ICElement element = getCElementFromSelection( part, selection );
- if ( element instanceof IVariable ) {
- return (IVariable)element;
- }
- return null;
- }
-
- protected void report( String message, IWorkbenchPart part ) {
- IEditorStatusLine statusLine = (IEditorStatusLine)part.getAdapter( IEditorStatusLine.class );
- if ( statusLine != null ) {
- if ( message != null ) {
- statusLine.setMessage( true, message, null );
- }
- else {
- statusLine.setMessage( true, null, null );
- }
- }
- if ( message != null && CDebugUIPlugin.getActiveWorkbenchShell() != null ) {
- CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
- }
- }
-
- protected static IResource getResource( IWorkbenchPart part ) {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if ( part instanceof IEditorPart ) {
- IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
- IResource resource = null;
- if ( editorInput instanceof IFileEditorInput ) {
- resource = ((IFileEditorInput)editorInput).getFile();
- }
- else if ( editorInput instanceof ExternalEditorInput ) {
- resource = ((ExternalEditorInput)editorInput).getMarkerResource();
- }
- if ( resource != null )
- return resource;
- /* This file is not in a project, let default case handle it */
- ILocationProvider provider = (ILocationProvider)editorInput.getAdapter( ILocationProvider.class );
- if ( provider != null ) {
- IPath location = provider.getPath( editorInput );
- if ( location != null ) {
- IFile[] files = root.findFilesForLocationURI( URIUtil.toURI( location ) );
- if ( files.length > 0 && files[0].isAccessible())
- return files[0];
- }
- }
- }
- return root;
- }
-
- private String getSourceHandle( IEditorInput input ) throws CoreException {
- return CDebugUIUtils.getEditorFilePath( input );
- }
-
- private void toggleVariableWatchpoint( IWorkbenchPart part, IVariable variable ) throws CoreException {
- String sourceHandle = getSourceHandle( variable );
- IResource resource = getElementResource( variable );
- String expression = getVariableName( variable );
- ICWatchpoint watchpoint = findWatchpoint( sourceHandle, resource, expression );
- if ( watchpoint != null ) {
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( watchpoint, true );
- }
- else {
- AddWatchpointDialog dlg = new AddWatchpointDialog( part.getSite().getShell(), AddWatchpointActionDelegate.getMemorySpaceManagement() );
- dlg.setExpression( expression );
- if ( dlg.open() != Window.OK )
- return;
- expression = dlg.getExpression();
- int lineNumber = -1;
- int charStart = -1;
- int charEnd = -1;
- try {
- ISourceRange sourceRange = variable.getSourceRange();
- if ( sourceRange != null ) {
- charStart = sourceRange.getStartPos();
- charEnd = charStart + sourceRange.getLength();
- if ( charEnd <= 0 ) {
- charStart = -1;
- charEnd = -1;
- }
- lineNumber = sourceRange.getStartLine();
- }
- }
- catch( CModelException e ) {
- DebugPlugin.log( e );
- }
- createWatchpoint(
- sourceHandle,
- resource,
- charStart,
- charEnd,
- lineNumber,
- dlg.getWriteAccess(),
- dlg.getReadAccess(),
- expression,
- dlg.getMemorySpace(),
- dlg.getRange() );
- }
- }
-
- private String getSourceHandle( IDeclaration declaration ) {
- ITranslationUnit tu = declaration.getTranslationUnit();
- if ( tu != null ) {
- IPath location = tu.getLocation();
- if ( location != null ) {
- return location.toOSString();
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- private IResource getElementResource( IDeclaration declaration ) {
- return declaration.getUnderlyingResource();
- }
-
- private String getFunctionName( IFunction function ) {
- String functionName = function.getElementName();
- StringBuffer name = new StringBuffer( functionName );
- ITranslationUnit tu = function.getTranslationUnit();
- if ( tu != null && tu.isCXXLanguage() ) {
- appendParameters( name, function );
- }
- return name.toString();
- }
-
- private String getMethodName( IMethod method ) {
- StringBuffer name = new StringBuffer();
- String methodName = method.getElementName();
- ICElement parent = method.getParent();
- while( parent != null
- && (parent.getElementType() == ICElement.C_NAMESPACE || parent.getElementType() == ICElement.C_CLASS
- || parent.getElementType() == ICElement.C_STRUCT || parent.getElementType() == ICElement.C_UNION) ) {
- name.append( parent.getElementName() ).append( "::" ); //$NON-NLS-1$
- parent = parent.getParent();
- }
- name.append( methodName );
- appendParameters( name, method );
- return name.toString();
- }
-
- private void appendParameters( StringBuffer sb, IFunctionDeclaration fd ) {
- String[] params = fd.getParameterTypes();
- sb.append( '(' );
- for( int i = 0; i < params.length; ++i ) {
- sb.append( params[i] );
- if ( i != params.length - 1 )
- sb.append( ',' );
- }
- sb.append( ')' );
- }
-
- private String getVariableName( IVariable variable ) {
- return variable.getElementName();
- }
-
- private ITranslationUnit getTranslationUnit( IFile file ) {
- Object element = CoreModel.getDefault().create( file );
- if ( element instanceof ITranslationUnit ) {
- return (ITranslationUnit)element;
- }
- return null;
- }
-
- private void toggleMethodBreakpoints0( IDeclaration declaration ) throws CoreException {
- String sourceHandle = getSourceHandle( declaration );
- IResource resource = getElementResource( declaration );
- String functionName = (declaration instanceof IFunction) ? getFunctionName( (IFunction)declaration ) : getMethodName( (IMethod)declaration );
- ICFunctionBreakpoint breakpoint = findFunctionBreakpoint( sourceHandle, resource, functionName );
- if ( breakpoint != null ) {
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
- }
- else {
- int lineNumber = -1;
- int charStart = -1;
- int charEnd = -1;
- try {
- ISourceRange sourceRange = declaration.getSourceRange();
- if ( sourceRange != null ) {
- charStart = sourceRange.getStartPos();
- charEnd = charStart + sourceRange.getLength();
- if ( charEnd <= 0 ) {
- charStart = -1;
- charEnd = -1;
- }
- lineNumber = sourceRange.getStartLine();
- }
- }
- catch( CModelException e ) {
- DebugPlugin.log( e );
- }
- createFunctionBreakpoint(
- sourceHandle,
- resource,
- functionName,
- charStart,
- charEnd,
- lineNumber );
- }
- }
-
- protected abstract ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException;
-
- protected abstract void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException;
-
- protected abstract ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException;
-
- protected abstract void createFunctionBreakpoint(
- String sourceHandle,
- IResource resource,
- String functionName,
- int charStart,
- int charEnd,
- int lineNumber ) throws CoreException;
-
- protected abstract ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException;
-
- protected abstract void createWatchpoint(
- String sourceHandle,
- IResource resource,
- int charStart,
- int charEnd,
- int lineNumber,
- boolean writeAccess,
- boolean readAccess,
- String expression,
- String memorySpace,
- BigInteger range ) throws CoreException;
-}
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 34fed677de0..eb47e4a36bb 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
@@ -37,15 +37,15 @@ ToggleBreakpointAdapter.Missing_document_2=Missing document
ToggleBreakpointAdapter.Missing_resource_2=Missing resource
ToggleBreakpointAdapter.Invalid_expression_1=Invalid expression:
RunToLineAdapter.Operation_is_not_supported_1=Operation is not supported.
-EnableDisableBreakpointRulerAction.Enable_Breakpoint_1=&Enable Breakpoint
+EnableDisableBreakpointRulerAction.Enable_Breakpoint_1=&Enable Breakpoint\tShift+Double Click
EnableDisableBreakpointRulerAction.Enabling_disabling_breakpoints_1=Enabling/disabling breakpoints
EnableDisableBreakpointRulerAction.Exceptions_occurred_enabling_or_disabling_breakpoint_1=Exceptions occurred enabling or disabling the breakpoint
-EnableDisableBreakpointRulerAction.Disable_Breakpoint_1=&Disable Breakpoint
-ToggleBreakpointRulerAction.Toggle_Breakpoint_1=Toggle &Breakpoint
+EnableDisableBreakpointRulerAction.Disable_Breakpoint_1=&Disable Breakpoint\tShift+Double Click
ToggleWatchpointActionDelegate.Operation_failed_1=Operation failed.
ToggleBreakpointRulerAction.Error_1=Error
ToggleBreakpointRulerAction.Operation_failed_1=Operation failed
-CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...
+CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...\tCtrl+Double Click
+CBreakpointPropertiesRulerAction.Error=Unable to edit breakpoint properties.
ResumeAtLineActionDelegate.Error_1=Error
ResumeAtLineActionDelegate.1=Error
ResumeAtLineActionDelegate.2=Resume at line failed
@@ -129,3 +129,9 @@ 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.
+CAddBreakpointInteractiveRulerAction_label=&Add Breakpoint...\tCtrl+Double Click
+CAddBreakpointInteractiveRulerAction_error_title=Error
+CAddBreakpointInteractiveRulerAction_error_message=Unable to create breakpoint
+CBreakpointToggleRulerAction_error_label=Toggle Brea&kpoint\tDouble Click
+CBreakpointToggleRulerAction_error_title=Error
+CBreakpointToggleRulerAction_error_message=Unable to toggle breakpoint \ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java
deleted file mode 100644
index d51adf334fc..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.jface.text.IDocument;
-
-/**
- *
- * Enter type comment.
- *
- * @since Aug 29, 2002
- */
-public class BreakpointLocationVerifier
-{
- /**
- * Returns the line number closest to the given line number that represents a
- * valid location for a breakpoint in the given document, or -1 if a valid location
- * cannot be found.
- */
- public int getValidLineBreakpointLocation( IDocument doc, int lineNumber )
- {
- // for now
- return lineNumber + 1;
- }
-
- public int getValidAddressBreakpointLocation( IDocument doc, int lineNumber )
- {
- // for now
- return lineNumber + 1;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerAction.java
deleted file mode 100644
index 1a82827cb9f..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerAction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Anton Leherbauer (Wind River Systems) - bug 183397
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
-import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
-import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-
-/**
- * Opens a custom properties dialog to configure the attibutes of a C/C++ breakpoint
- * from the ruler popup menu.
- */
-public class CBreakpointPropertiesRulerAction extends AbstractBreakpointRulerAction {
-
- private Object fContext;
-
- /**
- * Creates the action to modify the breakpoint properties.
- */
- public CBreakpointPropertiesRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
- super( part, info );
- setText( ActionMessages.getString( "CBreakpointPropertiesRulerAction.Breakpoint_Properties" ) ); //$NON-NLS-1$
- part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.BREAKPOINT_PROPERTIES_ACTION );
- setId( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES );
- }
-
- /* (non-Javadoc)
- * @see Action#run()
- */
- @Override
- public void run() {
- if ( fContext != null ) {
- PropertyDialogAction action = new PropertyDialogAction( getTargetPart().getSite(), new ISelectionProvider() {
-
- @Override
- public void addSelectionChangedListener( ISelectionChangedListener listener ) {
- }
-
- @Override
- public ISelection getSelection() {
- return new StructuredSelection( fContext );
- }
-
- @Override
- public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
- }
-
- @Override
- public void setSelection( ISelection selection ) {
- }
- } );
- action.run();
- action.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see IUpdate#update()
- */
- @Override
- public void update() {
- IBreakpoint breakpoint = getBreakpoint();
- if (breakpoint instanceof ICBreakpoint) {
- fContext = new CBreakpointContext((ICBreakpoint)breakpoint, getDebugContext());
- } else {
- fContext = breakpoint;
- }
- setEnabled( fContext != null );
- }
-
- private ISelection getDebugContext() {
- return DebugUITools.getDebugContextManager().getContextService(getTargetPart().getSite().getWorkbenchWindow()).getActiveContext();
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerActionDelegate.java
deleted file mode 100644
index de3df78eb7d..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerActionDelegate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public class EnableDisableBreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
-
- /*
- * @see AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
- */
- @Override
- protected IAction createAction( ITextEditor editor, IVerticalRulerInfo rulerInfo ) {
- return new EnableDisableBreakpointRulerAction( editor, rulerInfo );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java
deleted file mode 100644
index 3212ffcb7f3..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
- * Warren Paul (Nokia) - Bug 217485, Bug 218342
- * Oyvind Harboe (oyvind.harboe@zylin.com) - Bug 225099
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import java.math.BigInteger;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.model.ICBreakpointType;
-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.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Toggles a line breakpoint in a C/C++ editor.
- */
-public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
- */
- @Override
- protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
- return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
- */
- @Override
- protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
- CDIDebugModel.createLineBreakpoint( sourceHandle,
- resource,
- getBreakpointType(),
- lineNumber,
- true,
- 0,
- "", //$NON-NLS-1$
- true );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
- */
- @Override
- protected ICFunctionBreakpoint findFunctionBreakpoint(
- String sourceHandle,
- IResource resource,
- String functionName ) throws CoreException {
- return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String, int, int, int)
- */
- @Override
- protected void createFunctionBreakpoint(
- String sourceHandle,
- IResource resource,
- String functionName,
- int charStart,
- int charEnd,
- int lineNumber ) throws CoreException {
- CDIDebugModel.createFunctionBreakpoint( sourceHandle,
- resource,
- getBreakpointType(),
- functionName,
- charStart,
- charEnd,
- lineNumber,
- true,
- 0,
- "", //$NON-NLS-1$
- true );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
- */
- @Override
- protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
- return CDIDebugModel.watchpointExists( sourceHandle, resource, expression );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, int, int, int, boolean, boolean, java.lang.String, java.lang.String, java.math.BigInteger)
- */
- @Override
- protected void createWatchpoint(
- String sourceHandle,
- IResource resource,
- int charStart,
- int charEnd,
- int lineNumber,
- boolean writeAccess,
- boolean readAccess,
- String expression,
- String memorySpace,
- BigInteger range ) throws CoreException {
-
- CDIDebugModel.createWatchpoint( sourceHandle,
- resource,
- charStart,
- charEnd,
- lineNumber,
- writeAccess,
- readAccess,
- expression,
- memorySpace,
- range,
- true,
- 0,
- "", //$NON-NLS-1$
- true );
- }
-
- protected int getBreakpointType() {
- return ICBreakpointType.REGULAR;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleShowColumnsAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleShowColumnsAction.java
deleted file mode 100644
index b0b57142df3..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleShowColumnsAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.internal.ui.CDebugImages;
-import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Action to toggle the use of contributed variables content providers on and off.
- * When on, all registered variables content providers for the current debug model
- * are used. When off, the default content provider (that shows all children)
- * is used for all debug models.
- */
-public class ToggleShowColumnsAction extends Action implements IUpdate {
-
- private TreeModelViewer fViewer;
-
- public ToggleShowColumnsAction( TreeModelViewer viewew ) {
- super( "&Show Columns", IAction.AS_CHECK_BOX );
- fViewer = viewew;
- setToolTipText( "Show Columns" );
- setImageDescriptor( CDebugImages.DESC_OBJS_COMMON_TAB );
- setId( CDebugUIPlugin.getUniqueIdentifier() + ".ToggleShowColumsAction" ); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.SHOW_COLUMNS_ACTION );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- if ( fViewer.getControl().isDisposed() ) {
- return;
- }
- BusyIndicator.showWhile( fViewer.getControl().getDisplay(), new Runnable() {
- @Override
- public void run() {
- fViewer.setShowColumns( isChecked() );
- }
- } );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- @Override
- public void update() {
- setEnabled( fViewer.canToggleColumns() );
- setChecked( fViewer.isShowColumns() );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleTracepointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleTracepointAdapter.java
deleted file mode 100644
index b7c07a60377..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleTracepointAdapter.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.debug.internal.ui.actions;
-
-import java.math.BigInteger;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.model.ICBreakpointType;
-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.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Toggles a tracepoint in a C/C++ editor.
- */
-public class ToggleTracepointAdapter extends AbstractToggleBreakpointAdapter {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
- */
- @Override
- protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
- return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
- */
- @Override
- protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
-
- CDIDebugModel.createLineTracepoint(
- sourceHandle,
- resource,
- getBreakpointType(),
- lineNumber,
- true,
- 0,
- "", //$NON-NLS-1$
- true );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
- */
- @Override
- protected ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException {
- return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String, int, int, int)
- */
- @Override
- protected void createFunctionBreakpoint(
- String sourceHandle,
- IResource resource,
- String functionName,
- int charStart,
- int charEnd,
- int lineNumber ) throws CoreException {
-
- CDIDebugModel.createFunctionTracepoint(
- sourceHandle,
- resource,
- getBreakpointType(),
- functionName,
- charStart,
- charEnd,
- lineNumber,
- true,
- 0,
- "", //$NON-NLS-1$
- true );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
- */
- @Override
- protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, int, int, int, boolean, boolean, java.lang.String, java.lang.String, java.math.BigInteger)
- */
- @Override
- protected void createWatchpoint(
- String sourceHandle,
- IResource resource,
- int charStart,
- int charEnd,
- int lineNumber,
- boolean writeAccess,
- boolean readAccess,
- String expression,
- String memorySpace,
- BigInteger range ) throws CoreException {
- }
-
- protected int getBreakpointType() {
- return ICBreakpointType.REGULAR;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/WatchpointExpressionVerifier.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/WatchpointExpressionVerifier.java
deleted file mode 100644
index 5335df117bf..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/WatchpointExpressionVerifier.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.jface.text.IDocument;
-
-/**
- *
- * Enter type comment.
- *
- * @since Sep 5, 2002
- */
-public class WatchpointExpressionVerifier
-{
- /**
- * Returns whether the specified expression is valid for a watchpoint.
- */
- public boolean isValidExpression( IDocument doc, String expression )
- {
- // for now
- return expression.trim().length() > 0;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AbstractBreakpointRulerAction.java
index 1578a3eb803..6402f536567 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AbstractBreakpointRulerAction.java
@@ -9,27 +9,17 @@
* QNX Software Systems - Initial API and implementation
* Anton Leherbauer (Wind River Systems) - bug 183397
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
+import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.ui.actions.RulerBreakpointAction;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
/**
* Abstract base implementation of the breakpoint ruler actions.
@@ -61,33 +51,11 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU
* @return breakpoint associated with activity in the ruler or <code>null</code>
*/
protected IBreakpoint getBreakpoint() {
- IAnnotationModel annotationModel = getAnnotationModel();
- IDocument document = getDocument();
- if (annotationModel != null) {
- Iterator<?> iterator = annotationModel.getAnnotationIterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- if (object instanceof SimpleMarkerAnnotation) {
- SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
- IMarker marker = markerAnnotation.getMarker();
- try {
- if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
- Position position = annotationModel.getPosition(markerAnnotation);
- int line = document.getLineOfOffset(position.getOffset());
- if (line == fRulerInfo.getLineOfLastMouseButtonActivity()) {
- IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
- if (breakpoint != null) {
- return breakpoint;
- }
- }
- }
- } catch (CoreException e) {
- } catch (BadLocationException e) {
- }
- }
- }
- }
- return null;
+ IWorkbenchPart targetPart = getTargetPart();
+ if (targetPart instanceof ITextEditor) {
+ return CDebugUIUtils.getBreakpointFromEditor((ITextEditor)targetPart, getVerticalRulerInfo());
+ }
+ return null;
}
/**
@@ -108,25 +76,4 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU
return fRulerInfo;
}
- private IDocument getDocument() {
- IWorkbenchPart targetPart = getTargetPart();
- if ( targetPart instanceof ITextEditor ) {
- ITextEditor textEditor = (ITextEditor)targetPart;
- IDocumentProvider provider = textEditor.getDocumentProvider();
- if ( provider != null )
- return provider.getDocument( textEditor.getEditorInput() );
- }
- return null;
- }
-
- private IAnnotationModel getAnnotationModel() {
- IWorkbenchPart targetPart = getTargetPart();
- if ( targetPart instanceof ITextEditor ) {
- ITextEditor textEditor = (ITextEditor)targetPart;
- IDocumentProvider provider = textEditor.getDocumentProvider();
- if ( provider != null )
- return provider.getAnnotationModel( textEditor.getEditorInput() );
- }
- return null;
- }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddEventBreakpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddEventBreakpointActionDelegate.java
index c4637bfbfe5..b959f77ebfe 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddEventBreakpointActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddEventBreakpointActionDelegate.java
@@ -10,9 +10,10 @@
* QNX Software Systems - Initial API and implementation
* QNX Software Systems - catchpoints - bug 226689
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.internal.ui.dialogs.AddEventBreakpointDialog;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.UIMessages;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java
new file mode 100644
index 00000000000..b6b50b235b7
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007-7 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
+*******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.actions.ActionDelegate;
+
+/**
+ * A delegate for the "Add Function Breakpoint" action.
+ */
+public class AddFunctionBreakpointActionDelegate extends ActionDelegate implements IViewActionDelegate {
+
+ private IViewPart fView;
+ private ISelection fSelection;
+ private ToggleBreakpointAdapter fDefaultToggleTarget = new ToggleBreakpointAdapter();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ @Override
+ public void init( IViewPart view ) {
+ setView( view );
+ }
+
+ private void setView(IViewPart view) {
+ fView = view;
+ }
+
+ protected IViewPart getView() {
+ return fView;
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ fSelection = selection;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ @Override
+ public void run( IAction action ) {
+ IToggleBreakpointsTarget toggleTarget = DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fView, fSelection);
+ IToggleBreakpointsTargetCExtension cToggleTarget = null;
+ if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
+ cToggleTarget = (IToggleBreakpointsTargetCExtension)toggleTarget;
+ } else {
+ cToggleTarget = fDefaultToggleTarget;
+ }
+
+ try {
+ cToggleTarget.createFunctionBreakpointInteractive(fView, fSelection);
+ } catch (CoreException e) {
+ CDebugUIPlugin.errorDialog( ActionMessages.getString( "AddWatchpointActionDelegate1.0" ), e ); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointActionDelegate.java
index 2cdfb1f1aa7..9fab7944647 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointActionDelegate.java
@@ -9,7 +9,7 @@
* QNX Software Systems - Initial API and implementation
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import java.math.BigInteger;
@@ -17,14 +17,17 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.Window;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.ActionDelegate;
@@ -35,7 +38,9 @@ import org.eclipse.ui.actions.ActionDelegate;
public class AddWatchpointActionDelegate extends ActionDelegate implements IViewActionDelegate {
private IViewPart fView;
-
+ private ISelection fSelection;
+ private ToggleBreakpointAdapter fDefaultToggleTarget = new ToggleBreakpointAdapter();
+
/* (non-Javadoc)
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
*/
@@ -52,15 +57,29 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IView
return fView;
}
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ fSelection = selection;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run( IAction action ) {
- AddWatchpointDialog dlg = new AddWatchpointDialog( CDebugUIPlugin.getActiveWorkbenchShell(), getMemorySpaceManagement() );
- if ( dlg.open() == Window.OK ) {
- addWatchpoint( dlg.getWriteAccess(), dlg.getReadAccess(), dlg.getExpression(), dlg.getMemorySpace(), dlg.getRange() );
- }
+ IToggleBreakpointsTarget toggleTarget = DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fView, fSelection);
+ IToggleBreakpointsTargetCExtension cToggleTarget = null;
+ if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
+ cToggleTarget = (IToggleBreakpointsTargetCExtension)toggleTarget;
+ } else {
+ cToggleTarget = fDefaultToggleTarget;
+ }
+
+ try {
+ cToggleTarget.createWatchpointsInteractive(fView, fSelection);
+ } catch (CoreException e) {
+ CDebugUIPlugin.errorDialog( ActionMessages.getString( "AddWatchpointActionDelegate1.0" ), e ); //$NON-NLS-1$
+ }
}
protected void addWatchpoint(boolean write, boolean read, String expression, String memorySpace, BigInteger range) {
@@ -82,7 +101,7 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IView
return ""; //$NON-NLS-1$
}
- static ICDIMemorySpaceManagement getMemorySpaceManagement(){
+ public static ICDIMemorySpaceManagement getMemorySpaceManagement(){
IAdaptable debugViewElement = DebugUITools.getDebugContext();
ICDIMemorySpaceManagement memMgr = null;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java
index 8d6bab94516..8144e4d4cd4 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java
@@ -10,13 +10,14 @@
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
* IBM Corporation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -44,6 +45,7 @@ import org.eclipse.swt.widgets.Text;
/**
* The "Add Watchpoint" dialog of the "Toggle watchpoint" action.
+ * @deprecated Replaced by opening a properties dialog on a new breakpoint.
*/
public class AddWatchpointDialog extends Dialog implements ModifyListener, SelectionListener {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnMemoryActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnMemoryActionDelegate.java
index c403a5e34ee..01e61b53471 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnMemoryActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnMemoryActionDelegate.java
@@ -8,7 +8,7 @@
* Contributors:
* Nokia - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import java.math.BigInteger;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnVariableActionDelegate.java
index 131616fb9af..66a5d5e03de 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnVariableActionDelegate.java
@@ -8,11 +8,12 @@
* Contributors:
* Nokia - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import org.eclipse.cdt.debug.internal.core.CRequest;
import org.eclipse.cdt.debug.internal.core.ICWatchpointTarget;
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java
new file mode 100644
index 00000000000..a7923b204cc
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wind River Systems - added support for IToggleBreakpointsTargetFactory
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetManagerListener;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * Action to interactively create a breakpoint from vertical ruler of a
+ * workbench part containing a document. The part must provide an
+ * <code>IToggleBreakpointsTargetExtension2</code> adapter.
+ * <p>
+ * Clients may instantiate this class.
+ * </p>
+ * @since 3.8
+ * @see org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate
+ */
+public class CAddBreakpointInteractiveRulerAction extends Action implements IUpdate {
+
+ private IWorkbenchPart fPart;
+ private IDocument fDocument;
+ private IVerticalRulerInfo fRulerInfo;
+ private IToggleBreakpointsTargetManagerListener fListener = new IToggleBreakpointsTargetManagerListener() {
+ public void preferredTargetsChanged() {
+ update();
+ }
+ };
+
+ /**
+ * Constructs a new action to toggle a breakpoint in the given
+ * part containing the given document and ruler.
+ *
+ * @param part the part in which to toggle the breakpoint - provides
+ * an <code>IToggleBreakpointsTarget</code> adapter
+ * @param document the document breakpoints are being set in or
+ * <code>null</code> when the document should be derived from the
+ * given part
+ * @param rulerInfo specifies location the user has double-clicked
+ */
+ public CAddBreakpointInteractiveRulerAction(IWorkbenchPart part, IDocument document, IVerticalRulerInfo rulerInfo) {
+ super(ActionMessages.getString("CAddBreakpointInteractiveRulerAction_label")); //$NON-NLS-1$
+ fPart = part;
+ fDocument = document;
+ fRulerInfo = rulerInfo;
+ DebugUITools.getToggleBreakpointsTargetManager().addChangedListener(fListener);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ IDocument document= getDocument();
+ if (document == null) {
+ return;
+ }
+
+ int line = fRulerInfo.getLineOfLastMouseButtonActivity();
+
+ // Test if line is valid
+ if (line == -1)
+ return;
+
+ try {
+ ITextSelection selection = getTextSelection(document, line);
+ IToggleBreakpointsTarget toggleTarget =
+ DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, selection);
+ if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
+ IToggleBreakpointsTargetCExtension extension = (IToggleBreakpointsTargetCExtension) toggleTarget;
+ if (extension.canCreateLineBreakpointsInteractive(fPart, selection)) {
+ extension.createLineBreakpointsInteractive(fPart, selection);
+ }
+ }
+ } catch (BadLocationException e) {
+ reportException(e);
+ } catch (CoreException e) {
+ reportException(e);
+ }
+ }
+
+ /**
+ * Report an error to the user.
+ *
+ * @param e underlying exception
+ */
+ private void reportException(Exception e) {
+ IStatus status= new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Error creating breakpoint: ", e); //$NON-NLS-1$
+ ErrorDialog.openError(
+ fPart.getSite().getShell(),
+ ActionMessages.getString("CAddBreakpointInteractiveRulerAction_error_title"), //$NON-NLS-1$
+ ActionMessages.getString("CAddBreakpointInteractiveRulerAction_error_message"), //$NON-NLS-1$
+ status);
+ CDebugUIPlugin.log(status); //
+ }
+
+ /**
+ * Disposes this action. Clients must call this method when
+ * this action is no longer needed.
+ */
+ public void dispose() {
+ fDocument = null;
+ fPart = null;
+ fRulerInfo = null;
+ DebugUITools.getToggleBreakpointsTargetManager().removeChangedListener(fListener);
+ }
+
+ /**
+ * Returns the document on which this action operates.
+ *
+ * @return the document or <code>null</code> if none
+ */
+ private IDocument getDocument() {
+ if (fDocument != null)
+ return fDocument;
+
+ if (fPart instanceof ITextEditor) {
+ ITextEditor editor= (ITextEditor)fPart;
+ IDocumentProvider provider = editor.getDocumentProvider();
+ if (provider != null)
+ return provider.getDocument(editor.getEditorInput());
+ }
+
+ IDocument doc = (IDocument) fPart.getAdapter(IDocument.class);
+ if (doc != null) {
+ return doc;
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ */
+ public void update() {
+ IDocument document= getDocument();
+ if (document != null) {
+ int line = fRulerInfo.getLineOfLastMouseButtonActivity();
+ if (line > -1) {
+ try {
+ ITextSelection selection = getTextSelection(document, line);
+
+ IToggleBreakpointsTarget adapter =
+ DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, selection);
+ if (adapter == null) {
+ setEnabled(false);
+ return;
+ }
+ if (adapter instanceof IToggleBreakpointsTargetCExtension) {
+ IToggleBreakpointsTargetCExtension extension = (IToggleBreakpointsTargetCExtension) adapter;
+ if (extension.canCreateLineBreakpointsInteractive(fPart, selection)) {
+ setEnabled(true);
+ return;
+ }
+ }
+ } catch (BadLocationException e) {
+ reportException(e);
+ }
+ }
+ }
+ setEnabled(false);
+ }
+
+ /**
+ * Determines the text selection for the breakpoint action. If clicking on the ruler inside
+ * the highlighted text, return the text selection for the highlighted text. Otherwise,
+ * return a text selection representing the start of the line.
+ *
+ * @param document The IDocument backing the Editor.
+ * @param line The line clicked on in the ruler.
+ * @return An ITextSelection as described.
+ * @throws BadLocationException If underlying operations throw.
+ */
+ private ITextSelection getTextSelection(IDocument document, int line) throws BadLocationException {
+ IRegion region = document.getLineInformation(line);
+ ITextSelection textSelection = new TextSelection(document, region.getOffset(), 0);
+ ISelectionProvider provider = fPart.getSite().getSelectionProvider();
+ if (provider != null){
+ ISelection selection = provider.getSelection();
+ if (selection instanceof ITextSelection
+ && ((ITextSelection) selection).getStartLine() <= line
+ && ((ITextSelection) selection).getEndLine() >= line) {
+ textSelection = (ITextSelection) selection;
+ }
+ }
+ return textSelection;
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerActionDelegate.java
new file mode 100644
index 00000000000..c6a4e0edb9b
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerActionDelegate.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2012 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+
+import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Creates a breakpoint interactively, that is with user input as well as context
+ * information gathered from editor location. This action delegate can be
+ * contributed to an editor with the <code>editorActions</code> extension point.
+ * This action is as a factory that creates another action that performs the
+ * actual breakpoint toggling. The created action acts on the editor's
+ * <code>IToggleBreakpointsTagretCExtension</code> to create the breakpoint.
+ * <p>
+ * This action should be be contributed to a vertical ruler context menu via the
+ * <code>popupMenus</code> extension point, by referencing the ruler's context
+ * menu identifier in the <code>targetID</code> attribute.
+ * <pre>
+ * &lt;extension point="org.eclipse.ui.popupMenus"&gt;
+ * &lt;viewerContribution
+ * targetID="example.rulerContextMenuId"
+ * id="example.RulerPopupActions"&gt;
+ * &lt;action
+ * label="Toggle Breakpoint"
+ * class="org.eclipse.debug.ui.actions.RulerCreateBreakpointInteractiveActionDelegate"
+ * menubarPath="additions"
+ * id="example.rulerContextMenu.createBreakpointAction"&gt;
+ * &lt;/action&gt;
+ * &lt;/viewerContribution&gt;
+ * </pre>
+ * </p>
+ * <p>
+ * Clients may refer to this class as an action delegate in plug-in XML.
+ * </p>
+ * @see IToggleBreakpointsTargetCExtension
+ * @since 7.2
+ * @noextend This class is not intended to be sub-classed by clients.
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public class CAddBreakpointInteractiveRulerActionDelegate extends AbstractRulerActionDelegate implements IActionDelegate2 {
+
+ private IEditorPart fEditor = null;
+ private CAddBreakpointInteractiveRulerAction fDelegate = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.source.IVerticalRulerInfo)
+ */
+ protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
+ fDelegate = new CAddBreakpointInteractiveRulerAction(editor, null, rulerInfo);
+ return fDelegate;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
+ */
+ public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
+ if (fEditor != null) {
+ if (fDelegate != null) {
+ fDelegate.dispose();
+ fDelegate = null;
+ }
+ }
+ fEditor = targetEditor;
+ super.setActiveEditor(callerAction, targetEditor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ if (fDelegate != null) {
+ fDelegate.dispose();
+ }
+ fDelegate = null;
+ fEditor = null;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesHandler.java
index 5dc43b5f299..10bab0d10c1 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesHandler.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesHandler.java
@@ -9,24 +9,18 @@
* QNX Software Systems - Initial API and implementation
* Wind River Systems - Converted into a command
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
+import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.ISources;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
import org.eclipse.ui.handlers.HandlerUtil;
/**
@@ -44,36 +38,12 @@ public class CBreakpointPropertiesHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
- ICBreakpoint bp = getBreakpoint(event.getApplicationContext());
+ final ICBreakpoint bp = getBreakpoint(event.getApplicationContext());
if (part != null && bp != null) {
- ISelection debugContext = DebugUITools.getDebugContextManager().
- getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
-
- final CBreakpointContext bpContext = new CBreakpointContext(bp, debugContext);
-
- PropertyDialogAction propertyAction = new PropertyDialogAction( part.getSite(), new ISelectionProvider() {
-
- @Override
- public void addSelectionChangedListener( ISelectionChangedListener listener ) {
- }
-
- @Override
- public ISelection getSelection() {
- return new StructuredSelection( bpContext );
- }
-
- @Override
- public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
- }
-
- @Override
- public void setSelection( ISelection selection ) {
- assert false; // Not supported
- }
- } );
- propertyAction.run();
- }
+ CDebugUIUtils.editBreakpointProperties(part, bp);
+ }
+
return null;
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerAction.java
new file mode 100644
index 00000000000..49f5b40c95e
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerAction.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems) - bug 183397
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
+import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.debug.ui.contexts.IDebugContextProvider;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Opens a custom properties dialog to configure the attibutes of a C/C++ breakpoint
+ * from the ruler popup menu.
+ */
+public class CBreakpointPropertiesRulerAction extends AbstractBreakpointRulerAction {
+
+ private ICBreakpoint fBreakpoint;
+
+ /**
+ * Creates the action to modify the breakpoint properties.
+ */
+ public CBreakpointPropertiesRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
+ super( part, info );
+ setText( ActionMessages.getString( "CBreakpointPropertiesRulerAction.Breakpoint_Properties" ) ); //$NON-NLS-1$
+ part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.BREAKPOINT_PROPERTIES_ACTION );
+ setId( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES );
+ }
+
+ /* (non-Javadoc)
+ * @see Action#run()
+ */
+ @Override
+ public void run() {
+ if ( fBreakpoint != null ) {
+ final ISelection debugContext = DebugUITools.getDebugContextForPart(getTargetPart());
+ CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
+ getTargetPart().getSite(),
+ new ISelectionProvider() {
+ @Override
+ public ISelection getSelection() {
+ return new StructuredSelection( fBreakpoint );
+ }
+ @Override public void addSelectionChangedListener( ISelectionChangedListener listener ) {}
+ @Override public void removeSelectionChangedListener( ISelectionChangedListener listener ) {}
+ @Override public void setSelection( ISelection selection ) {}
+ },
+ new IDebugContextProvider() {
+ @Override
+ public ISelection getActiveContext() {
+ return debugContext;
+ }
+ @Override public void addDebugContextListener(IDebugContextListener listener) {}
+ @Override public void removeDebugContextListener(IDebugContextListener listener) {}
+ @Override public IWorkbenchPart getPart() { return null; }
+
+ }
+ );
+ propertiesAction.run();
+ propertiesAction.dispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see IUpdate#update()
+ */
+ @Override
+ public void update() {
+ IBreakpoint breakpoint= getBreakpoint();
+
+ if (breakpoint instanceof ICBreakpoint) {
+ fBreakpoint = (ICBreakpoint)breakpoint;
+ } else {
+ fBreakpoint = null;
+ }
+ setEnabled( fBreakpoint != null );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerActionDelegate.java
index 30adad5629c..e4d58903a2f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerActionDelegate.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleBreakpointObjectActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleBreakpointObjectActionDelegate.java
new file mode 100644
index 00000000000..14e1e3e24be
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleBreakpointObjectActionDelegate.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wind River Systems - added support for IToggleBreakpointsTargetFactory
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * A toggle breakpoint action that can be contributed to an object. The action
+ * will perform a toggle breakpoint operation for a selected object.
+ * <p>
+ * This class is based on {@link org.eclipse.debug.internal.ui.actions.breakpoints.ToggleBreakpointObjectActionDelegate }
+ * class. In addition to the copied functionality, it adds the handling of
+ * action-triggering event.
+ * </p>
+ *
+ * @since 7.2
+ */
+public abstract class CToggleBreakpointObjectActionDelegate implements IObjectActionDelegate, IActionDelegate2 {
+
+ private IWorkbenchPart fPart;
+ private IStructuredSelection fSelection;
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ fPart = targetPart;
+ }
+
+ public void run(IAction action) {
+ runWithEvent(action, null);
+ }
+
+ public void runWithEvent(IAction action, Event event) {
+ IToggleBreakpointsTarget target =
+ DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
+ if (target != null) {
+ try {
+ performAction(target, fPart, fSelection, event);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * Performs the operation specific to this action.
+ *
+ * @param target adapter to toggle breakpoints
+ * @param part the active part
+ * @param selection the selection in the active part
+ * @param event that triggered this action
+ * @exception CoreException if an exception occurs
+ */
+ protected abstract void performAction(IToggleBreakpointsTarget target, IWorkbenchPart part, ISelection selection, Event event)
+ throws CoreException;
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ boolean enabled = false;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ this.fSelection = ss;
+ // selectionChagned() can sometimes be called before setActivePart().
+ // Guard here against that possibility.
+ if (fPart != null) {
+ IToggleBreakpointsTarget target =
+ DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
+ enabled = target != null;
+ }
+ }
+ action.setEnabled(enabled);
+ }
+
+ public void init(IAction action) {
+ }
+
+ public void dispose() {
+ fSelection = null;
+ fPart = null;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java
new file mode 100644
index 00000000000..37aa40ad275
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+
+import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * A toggle method breakpoint action that can be contributed an object
+ * contribution. The action will toggle method breakpoints on objects
+ * that provide an <code>IToggleBreakpointsTarget</code> adapter.
+ * <p>
+ * This class is based on {@link org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate }
+ * class. In addition to the copied functionality, it adds the handling of
+ * action-triggering event.
+ * </p>
+ *
+ * @since 7.2
+ */
+public class CToggleMethodBreakpointActionDelegate extends CToggleBreakpointObjectActionDelegate {
+
+ protected void performAction(IToggleBreakpointsTarget target, IWorkbenchPart part, ISelection selection, Event event)
+ throws CoreException
+ {
+ if ((event.stateMask & SWT.MOD1) != 0 &&
+ target instanceof IToggleBreakpointsTargetCExtension &&
+ ((IToggleBreakpointsTargetCExtension)target).canCreateFunctionBreakpointInteractive(part, selection))
+ {
+ ((IToggleBreakpointsTargetCExtension)target).createFunctionBreakpointInteractive(part, selection);
+ }
+ else {
+ target.toggleMethodBreakpoints(part, selection);
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/EnableDisableBreakpointRulerAction.java
index 858d371b37b..586020c4fae 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/EnableDisableBreakpointRulerAction.java
@@ -9,10 +9,11 @@
* QNX Software Systems - Initial API and implementation
* Anton Leherbauer (Wind River Systems) - bug 183397
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java
new file mode 100644
index 00000000000..41201f51497
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
+ * Warren Paul (Nokia) - Bug 217485, Bug 218342
+ * Oyvind Harboe (oyvind.harboe@zylin.com) - Bug 225099
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+
+import java.math.BigInteger;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.debug.core.model.ICBreakpointType;
+import org.eclipse.cdt.debug.core.model.ICDebugTarget;
+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.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Toggles a line breakpoint in a C/C++ editor.
+ *
+ * @since 7.2
+ */
+public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter {
+
+ @Override
+ protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
+ return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
+ }
+
+ @Override
+ protected void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
+ IResource resource, int lineNumber) throws CoreException
+ {
+ if (interactive) {
+ ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setLineBreakpointAttributes(
+ attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
+ } else {
+ CDIDebugModel.createLineBreakpoint( sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true );//$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected ICFunctionBreakpoint findFunctionBreakpoint(String sourceHandle, IResource resource, String functionName)
+ throws CoreException
+ {
+ return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
+ }
+
+ @Override
+ protected void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
+ IResource resource, String functionName, int charStart, int charEnd, int lineNumber ) throws CoreException
+ {
+ if (interactive) {
+ ICFunctionBreakpoint bp = CDIDebugModel.createBlankFunctionBreakpoint();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setFunctionBreakpointAttributes( attributes, sourceHandle, getBreakpointType(), functionName,
+ charStart, charEnd, lineNumber, true, 0, "" ); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(bp, part, resource, attributes);
+ } else {
+ CDIDebugModel.createFunctionBreakpoint(sourceHandle, resource, getBreakpointType(), functionName, charStart,
+ charEnd, lineNumber, true, 0, "", true); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
+ return CDIDebugModel.watchpointExists( sourceHandle, resource, expression );
+ }
+
+ @Override
+ protected void createWatchpoint( boolean interactive, IWorkbenchPart part, String sourceHandle, IResource resource,
+ int charStart, int charEnd, int lineNumber, String expression) throws CoreException
+ {
+ ICWatchpoint bp = CDIDebugModel.createBlankWatchpoint();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setWatchPointAttributes(attributes, sourceHandle, resource, true, false,
+ expression, "", new BigInteger("0"), true, 0, ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ openBreakpointPropertiesDialog(bp, part, resource, attributes);
+ }
+
+ protected int getBreakpointType() {
+ return ICBreakpointType.REGULAR;
+ }
+
+ public static ICDIMemorySpaceManagement getMemorySpaceManagement(){
+ IAdaptable debugViewElement = DebugUITools.getDebugContext();
+ ICDIMemorySpaceManagement memMgr = null;
+
+ if ( debugViewElement != null ) {
+ ICDebugTarget debugTarget = (ICDebugTarget)debugViewElement.getAdapter(ICDebugTarget.class);
+
+ if ( debugTarget != null ){
+ ICDITarget target = (ICDITarget)debugTarget.getAdapter(ICDITarget.class);
+
+ if (target instanceof ICDIMemorySpaceManagement)
+ memMgr = (ICDIMemorySpaceManagement)target;
+ }
+ }
+
+ return memMgr;
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCBreakpointsTargetFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCBreakpointsTargetFactory.java
index d394abe0a3a..44a38a5baa2 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCBreakpointsTargetFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCBreakpointsTargetFactory.java
@@ -8,13 +8,14 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
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.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.model.IDebugElement;
@@ -86,8 +87,7 @@ public class ToggleCBreakpointsTargetFactory implements IToggleBreakpointsTarget
}
@Override
- @SuppressWarnings("unchecked")
- public Set getToggleTargets(IWorkbenchPart part, ISelection selection) {
+ public Set<?> getToggleTargets(IWorkbenchPart part, ISelection selection) {
return TOGGLE_TARGET_IDS;
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCTracepointsTargetFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCTracepointsTargetFactory.java
index 75789e586b7..70668a699c4 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCTracepointsTargetFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCTracepointsTargetFactory.java
@@ -8,11 +8,12 @@
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
+package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory;
@@ -66,8 +67,7 @@ public class ToggleCTracepointsTargetFactory implements IToggleBreakpointsTarget
}
@Override
- @SuppressWarnings("unchecked")
- public Set getToggleTargets(IWorkbenchPart part, ISelection selection) {
+ public Set<?> getToggleTargets(IWorkbenchPart part, ISelection selection) {
return TOGGLE_TARGET_IDS;
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleTracepointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleTracepointAdapter.java
new file mode 100644
index 00000000000..375c8f7f00f
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleTracepointAdapter.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.debug.internal.ui.actions.breakpoints;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICBreakpointType;
+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.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Toggles a tracepoint in a C/C++ editor.
+ */
+public class ToggleTracepointAdapter extends AbstractToggleBreakpointAdapter {
+
+ @Override
+ protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
+ return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
+ }
+
+ @Override
+ protected void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
+ IResource resource, int lineNumber) throws CoreException
+ {
+ if (interactive) {
+ ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineTracepoint();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setLineBreakpointAttributes(
+ attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
+ } else {
+ CDIDebugModel.createLineTracepoint( sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true );//$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException {
+ return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
+ }
+
+ @Override
+ protected void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
+ IResource resource, String functionName, int charStart, int charEnd, int lineNumber ) throws CoreException
+ {
+ if (interactive) {
+ ICFunctionBreakpoint bp = CDIDebugModel.createBlankFunctionTracepoint();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setFunctionBreakpointAttributes( attributes, sourceHandle, getBreakpointType(), functionName,
+ charStart, charEnd, lineNumber, true, 0, "" ); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(bp, part, resource, attributes);
+ } else {
+ CDIDebugModel.createFunctionTracepoint(sourceHandle, resource, getBreakpointType(), functionName, charStart,
+ charEnd, lineNumber, true, 0, "", true); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
+ return null;
+ }
+
+ @Override
+ public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
+ return false;
+ }
+
+ protected void createWatchpoint( boolean interactive, IWorkbenchPart part, String sourceHandle, IResource resource,
+ int charStart, int charEnd, int lineNumber, String expression) throws CoreException
+ {
+ }
+
+ protected int getBreakpointType() {
+ return ICBreakpointType.REGULAR;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointImageProvider.java
index 3b490af3c32..c18640cccc7 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointImageProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui;
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
import org.eclipse.core.resources.IMarker;
import org.eclipse.debug.core.DebugPlugin;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.java
new file mode 100644
index 00000000000..e6742c6bbc3
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class BreakpointsMessages {
+
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.breakpoints.BreakpointsMessages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+ private BreakpointsMessages() {
+ }
+
+ public static String getString( String key ) {
+ try {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch( MissingResourceException e ) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties
new file mode 100644
index 00000000000..ecc61aa6bf0
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties
@@ -0,0 +1,40 @@
+###############################################################################
+# Copyright (c) 2003, 2009 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
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# QNX Software Systems - initial API and implementation
+# Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
+# IBM Corporation
+###############################################################################
+
+CBreakpointPropertyPage.0=Ignore count must be a nonnegative integer
+CBreakpointPropertyPage.function_valueNotAvailable_label=Not available
+CBreakpointPropertyPage.function_label=Function name:
+CBreakpointPropertyPage.function_value_errorMessage=Enter a function expression:
+CBreakpointPropertyPage.breakpointType_function_label=C/C++ Function Breakpoint
+CBreakpointPropertyPage.address_valueNotAvailable_label=Not available
+CBreakpointPropertyPage.address_label=Address:
+CBreakpointPropertyPage.breakpointType_address_label=C/C++ Address Breakpoint
+CBreakpointPropertyPage.sourceHandle_label=File:
+CBreakpointPropertyPage.breakpointType_line_label=C/C++ Line Breakpoint
+CBreakpointPropertyPage.lineNumber_label=Line number:
+CBreakpointPropertyPage.breakpointType_event_label=C/C++ Event Breakpoint
+CBreakpointPropertyPage.project_label=Project:
+CBreakpointPropertyPage.breakpointType_watchpoint_label=C/C++ Watchpoint
+CBreakpointPropertyPage.breakpointType_watchpoint_read_label=C/C++ Read Watchpoint
+CBreakpointPropertyPage.breakpointType_watchpoint_access_label=C/C++ Access Watchpoint
+CBreakpointPropertyPage.watchpointType_read_label=Read
+CBreakpointPropertyPage.watchpointType_write_label=Write
+CBreakpointPropertyPage.watchpoint_expression_label=Expression to watch:
+CBreakpointPropertyPage.watchpoint_expression_errorMessage=Enter the expression to watch:
+CBreakpointPropertyPage.condition_label=&Condition:
+CBreakpointPropertyPage.condition_invalidValue_message=Invalid condition.
+CBreakpointPropertyPage.ignoreCount_label=&Ignore count:
+CBreakpointPropertyPage.breakpointType_label=Class:
+CBreakpointPropertyPage.enabled_label=Enabled
+
+ThreadFilterEditor.0=&Restrict to Selected Targets and Threads:
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointContext.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java
index 22a7bd92f31..bc179355e35 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointContext.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java
@@ -9,10 +9,20 @@
* Wind River Systems - initial API and implementation
* Ericsson - Added tracepoint support (284286)
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui;
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
+import java.util.Map;
+
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICTracepoint;
+import org.eclipse.cdt.debug.core.model.ICWatchpoint;
+import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.core.runtime.Platform;
@@ -20,9 +30,14 @@ import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugModelProvider;
+import org.eclipse.debug.ui.contexts.IDebugContextListener;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IActionFilter;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.model.IWorkbenchAdapter;
/**
* Input for breakpoint properties dialog. It captures both the
@@ -30,7 +45,7 @@ import org.eclipse.ui.IActionFilter;
* This combined context can then be used by breakpoint property
* pages to access model and target specific breakpoint settings.
*/
-public class CBreakpointContext extends PlatformObject {
+public class CBreakpointContext extends PlatformObject implements ICBreakpointContext {
// Register an adapter factory for the class when it is first loaded.
static {
@@ -43,28 +58,60 @@ public class CBreakpointContext extends PlatformObject {
private final ICBreakpoint fBreakpoint;
/**
+ * The resource that the breakpoint is to be created for.
+ */
+ private final IResource fResource;
+
+ /**
* The active debug context held by this context.
*/
private final ISelection fDebugContext;
/**
- * Creates a new breakpoint context with given breakpoint and debbug
+ * Associated preference store.
+ */
+ private final CBreakpointPreferenceStore fPreferenceStore;
+
+ /**
+ * Creates a new breakpoint context with given breakpoint and debug
* context selection.
*/
public CBreakpointContext(ICBreakpoint breakpoint, ISelection debugContext) {
+ this (breakpoint, debugContext, null, null);
+ }
+
+ public CBreakpointContext(ICBreakpoint breakpoint, ISelection debugContext, IResource resource, Map<String, Object> attributes) {
fBreakpoint = breakpoint;
+ fResource = resource;
fDebugContext = debugContext;
+ fPreferenceStore = new CBreakpointPreferenceStore(this, attributes);
}
- /**
- * Returns the breakpoint.
- */
+ @Override
public ICBreakpoint getBreakpoint() { return fBreakpoint; }
+
+ @Override
+ public IResource getResource() { return fResource; }
+
+ @Override
+ public IPreferenceStore getPreferenceStore() { return fPreferenceStore; }
/**
* Returns the debug context.
*/
public ISelection getDebugContext() { return fDebugContext; }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.contexts.IDebugContextProvider implementation
+ */
+ public IWorkbenchPart getPart() { return null; }
+ public void addDebugContextListener(IDebugContextListener listener) {}
+ public void removeDebugContextListener(IDebugContextListener listener) {}
+
+ public ISelection getActiveContext() {
+ return fDebugContext;
+ }
}
/**
@@ -109,30 +156,84 @@ class CBreakpointContextActionFilter implements IActionFilter {
}
}
+class CBreakpointContextWorkbenchAdapter implements IWorkbenchAdapter {
+ @Override
+ public String getLabel(Object o) {
+ if (o instanceof ICBreakpointContext) {
+ ICBreakpoint bp = ((ICBreakpointContext)o).getBreakpoint();
+ return getBreakpointMainLabel(bp);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public Object[] getChildren(Object o) { return null; }
+
+ @Override
+ public ImageDescriptor getImageDescriptor(Object object) { return null; }
+
+ @Override
+ public Object getParent(Object o) { return null; }
+
+ private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
+ if (breakpoint instanceof ICFunctionBreakpoint) {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_function_label"); //$NON-NLS-1$
+ } else if (breakpoint instanceof ICAddressBreakpoint) {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_address_label"); //$NON-NLS-1$
+ } else if (breakpoint instanceof ICLineBreakpoint) {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_line_label"); //$NON-NLS-1$
+ } else if (breakpoint instanceof ICEventBreakpoint) {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_event_label"); //$NON-NLS-1$
+ } else if (breakpoint instanceof ICWatchpoint) {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_label"); //$NON-NLS-1$
+ }
+ // default main label is the label of marker type for the breakpoint
+ return CDIDebugModel.calculateMarkerType(breakpoint);
+ }
+
+}
+
/**
* Adapter factory which returns the breakpoint object and the action
* filter for the CBreakpointContext type.
*/
class CBreakpointContextAdapterFactory implements IAdapterFactory {
- private static final Class[] fgAdapterList = new Class[] {
- IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class
+ private static final Class<?>[] fgAdapterList = new Class[] {
+ IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class, IPreferenceStore.class,
+ IWorkbenchAdapter.class,
};
private static final IActionFilter fgActionFilter = new CBreakpointContextActionFilter();
+ private static final IWorkbenchAdapter fgWorkbenchAdapter = new CBreakpointContextWorkbenchAdapter();
@Override
- public Object getAdapter(Object obj, Class adapterType) {
- if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() )) {
+ public Object getAdapter(Object obj, @SuppressWarnings("rawtypes") Class adapterType) {
+ // Note: only return the breakpoint object as an adapter if it has
+ // an associated marker. Otherwise the property pages will throw multiple
+ // exceptions.
+ if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() ) &&
+ ((CBreakpointContext)obj).getBreakpoint().getMarker() != null)
+ {
return ((CBreakpointContext)obj).getBreakpoint();
}
+ if ( IPreferenceStore.class.equals(adapterType) ) {
+ return ((CBreakpointContext)obj).getPreferenceStore();
+ }
+
if (IActionFilter.class.equals(adapterType)) {
return fgActionFilter;
}
+
+ if (IWorkbenchAdapter.class.equals(adapterType)) {
+ return fgWorkbenchAdapter;
+ }
+
return null;
}
+ @SuppressWarnings("rawtypes")
@Override
public Class[] getAdapterList() {
return fgAdapterList;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointFilteringPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java
index 7879cd8ccc4..a74f4707bbe 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointFilteringPage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.propertypages;
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
@@ -48,7 +48,7 @@ public class CBreakpointFilteringPage extends PropertyPage {
ICBreakpoint bp = getBreakpoint();
if (bp != null) {
try {
- return (ICBreakpointFilterExtension)bp.getExtension(
+ return bp.getExtension(
CDIDebugModel.getPluginIdentifier(), ICBreakpointFilterExtension.class);
} catch (CoreException e) {}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java
new file mode 100644
index 00000000000..c558db83b63
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java
@@ -0,0 +1,299 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * QNX Software Systems - Refactored to use platform implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICLineBreakpoint2;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+/**
+ * A preference store that presents the state of the properties of a C/C++ breakpoint.
+ */
+public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
+
+ // This map is the current properties/values being maintained/manipulated
+ private HashMap<String, Object> fProperties = new HashMap<String, Object>();
+
+ // Original set of values. So we can see what has really changed on the save and
+ // perform appropriate change operations. We only really want to operate on changed
+ // values, to avoid generating churn.
+ private HashMap<String, Object> fOriginalValues = new HashMap<String, Object>();
+ private boolean fIsDirty = false;
+ private boolean fIsCanceled = false;
+ private ListenerList fListeners;
+ private final CBreakpointContext fContext;
+
+ // TODO: remove after fixing add event breapoint dialog.
+ public CBreakpointPreferenceStore() {
+ this (null, null);
+ }
+
+ public CBreakpointPreferenceStore(CBreakpointContext context, Map<String, Object> attributes) {
+ fListeners = new ListenerList(org.eclipse.core.runtime.ListenerList.IDENTITY);
+ fContext = context;
+
+ fOriginalValues.clear();
+ fProperties.clear();
+ if (context != null) {
+ IMarker marker = context.getBreakpoint().getMarker();
+ if (marker != null) {
+ Map<String, Object> bpAttrs = Collections.emptyMap();
+ try {
+ bpAttrs = marker.getAttributes();
+ fOriginalValues.putAll(bpAttrs);
+ fProperties.putAll(bpAttrs);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+ if (attributes != null) {
+ fProperties.putAll(attributes);
+ fIsDirty = true;
+ }
+ }
+
+ public Map<String, Object> getAttributes() {
+ return fProperties;
+ }
+
+ public void setCanceled(boolean canceled) {
+ fIsCanceled = canceled;
+ }
+
+ public void save() throws IOException {
+ if (!fIsCanceled && fContext != null && fContext.getBreakpoint() != null) {
+ ICBreakpoint bp = fContext.getBreakpoint();
+ if (bp.getMarker() != null && fIsDirty) {
+ saveToExistingMarker(bp, bp.getMarker());
+ }
+ else if (fContext.getResource() != null){
+ saveToNewMarker(bp, fContext.getResource());
+ } else {
+ throw new IOException("Unable to create breakpoint: no resource specified."); //$NON-NLS-1$
+ }
+ }
+
+ }
+
+ private void saveToExistingMarker(final ICBreakpoint breakpoint, final IMarker marker) throws IOException {
+ final List<String> changedProperties = new ArrayList<String>( 5 );
+ Set<String> valueNames = fProperties.keySet();
+ for ( String name : valueNames ) {
+ if ( fProperties.containsKey( name ) ) {
+ Object originalObject = fOriginalValues.get( name );
+ Object currentObject = fProperties.get( name );
+ if ( originalObject == null ) {
+ changedProperties.add( name );
+ }
+ else if ( ! originalObject.equals( currentObject ) ) {
+ changedProperties.add( name );
+ }
+ }
+ }
+ if ( ! changedProperties.isEmpty() ) {
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ public void run( IProgressMonitor monitor ) throws CoreException {
+ Iterator<String> changed = changedProperties.iterator();
+ while( changed.hasNext() ) {
+ String property = changed.next();
+ if ( property.equals( ICBreakpoint.ENABLED ) ) {
+ breakpoint.setEnabled( getBoolean( ICBreakpoint.ENABLED ) );
+ }
+ else if ( property.equals( ICBreakpoint.IGNORE_COUNT ) ) {
+ breakpoint.setIgnoreCount( getInt( ICBreakpoint.IGNORE_COUNT ) );
+ }
+ else if ( property.equals( ICBreakpoint.CONDITION ) ) {
+ breakpoint.setCondition( getString( ICBreakpoint.CONDITION ) );
+ }
+ else if ( property.equals( IMarker.LINE_NUMBER ) ) {
+ // already workspace runnable, setting markers are safe
+ breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getInt(IMarker.LINE_NUMBER));
+ breakpoint.getMarker().setAttribute(ICLineBreakpoint2.REQUESTED_LINE, getInt(IMarker.LINE_NUMBER));
+ } else {
+ // this allow set attributes contributed by other plugins
+ Object value = fProperties.get(property);
+ if ( value != null ) {
+ marker.setAttribute(property, value);
+ }
+ }
+ }
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run( wr, null );
+ }
+ catch( CoreException ce ) {
+ throw new IOException("Cannot save properties to breakpoint.", ce); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private void saveToNewMarker(final ICBreakpoint breakpoint, final IResource resource) throws IOException {
+ try {
+ CDIDebugModel.createBreakpointMarker(breakpoint, resource, fProperties, true);
+ }
+ catch( CoreException ce ) {
+ throw new IOException("Cannot save properties to new breakpoint.", ce); //$NON-NLS-1$
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // IPreferenceStore
+
+ public boolean needsSaving() {
+ return fIsDirty && !fIsCanceled;
+ }
+
+ public boolean contains(String name) {
+ return fProperties.containsKey(name);
+ }
+
+ public void addPropertyChangeListener(IPropertyChangeListener listener) {
+ fListeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(IPropertyChangeListener listener) {
+ fListeners.remove(listener);
+ }
+
+ public void firePropertyChangeEvent(String name,
+ Object oldValue,
+ Object newValue)
+ {
+ Object[] listeners = fListeners.getListeners();
+ // Do we need to fire an event.
+ if (listeners.length > 0 && (oldValue == null || !oldValue.equals(newValue))) {
+ PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
+ for (int i = 0; i < listeners.length; ++i) {
+ IPropertyChangeListener l = (IPropertyChangeListener) listeners[i];
+ l.propertyChange(pe);
+ }
+ }
+ }
+
+ public boolean getBoolean(String name) {
+ boolean retVal = false;
+ Object o = fProperties.get(name);
+ if (o instanceof Boolean) {
+ retVal = ((Boolean)o).booleanValue();
+ }
+ return retVal;
+ }
+
+ public int getInt(String name) {
+ int retVal = 0;
+ Object o = fProperties.get(name);
+ if (o instanceof Integer) {
+ retVal = ((Integer)o).intValue();
+ }
+ return retVal;
+ }
+
+ public String getString(String name) {
+ String retVal = null;
+ Object o = fProperties.get(name);
+ if (o instanceof String) {
+ retVal = (String)o;
+ }
+ return retVal;
+ }
+
+ public double getDouble(String name) { return 0; }
+ public float getFloat(String name) { return 0; }
+ public long getLong(String name) { return 0; }
+
+ public boolean isDefault(String name) { return false; }
+
+ public boolean getDefaultBoolean(String name) { return false; }
+ public double getDefaultDouble(String name) { return 0; }
+ public float getDefaultFloat(String name) { return 0; }
+ public int getDefaultInt(String name) { return 0; }
+ public long getDefaultLong(String name) { return 0; }
+ public String getDefaultString(String name) { return null; }
+
+ public void putValue(String name, String value) {
+ Object oldValue = fProperties.get(name);
+ if ( oldValue == null || !oldValue.equals(value) ) {
+ fProperties.put(name, value);
+ setDirty(true);
+ }
+ }
+
+ public void setDefault(String name, double value) {}
+ public void setDefault(String name, float value) {}
+ public void setDefault(String name, int value) {}
+ public void setDefault(String name, long value) {}
+ public void setDefault(String name, String defaultObject) {}
+ public void setDefault(String name, boolean value) {}
+ public void setToDefault(String name) {}
+
+ public void setValue(String name, boolean value) {
+ boolean oldValue = getBoolean(name);
+ if (oldValue != value) {
+ fProperties.put( name, new Boolean(value) );
+ setDirty(true);
+ firePropertyChangeEvent(name, new Boolean(oldValue), new Boolean(value) );
+ }
+ }
+
+ public void setValue(String name, int value) {
+ int oldValue = getInt(name);
+ if (oldValue != value) {
+ fProperties.put( name, new Integer(value) );
+ setDirty(true);
+ firePropertyChangeEvent(name, new Integer(oldValue), new Integer(value) );
+ }
+ }
+
+ public void setValue(String name, String value) {
+ Object oldValue = fProperties.get(name);
+ if ( (oldValue == null && value != null) ||
+ (oldValue != null && !oldValue.equals(value)) )
+ {
+ fProperties.put(name, value);
+ setDirty(true);
+ firePropertyChangeEvent(name, oldValue, value);
+ }
+ }
+
+ public void setValue(String name, float value) {}
+ public void setValue(String name, double value) {}
+ public void setValue(String name, long value) {}
+
+ // IPreferenceStore
+ ///////////////////////////////////////////////////////////////////////
+
+ private void setDirty(boolean isDirty) {
+ fIsDirty = isDirty;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
new file mode 100644
index 00000000000..587abcbfa04
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
@@ -0,0 +1,498 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
+ * QNX Software Systems - Catchpoints support https://bugs.eclipse.org/bugs/show_bug.cgi?id=226689
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
+
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+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.CDebugUIPlugin;
+import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory;
+import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext;
+import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContribution;
+import org.eclipse.cdt.debug.ui.preferences.ReadOnlyFieldEditor;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+
+/**
+ * The preference page used to present the properties of a breakpoint as preferences. A CBreakpointPreferenceStore is used to interface between this page and
+ * the breakpoint.
+ */
+public class CBreakpointPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
+
+ class BreakpointIntegerFieldEditor extends IntegerFieldEditor {
+
+ public BreakpointIntegerFieldEditor( String name, String labelText, Composite parent ) {
+ super( name, labelText, parent );
+ setErrorMessage( BreakpointsMessages.getString( "CBreakpointPropertyPage.0" ) ); //$NON-NLS-1$
+ }
+
+ /**
+ * @see IntegerFieldEditor#checkState()
+ */
+ @Override
+ protected boolean checkState() {
+ Text control = getTextControl();
+ if ( !control.isEnabled() ) {
+ clearErrorMessage();
+ return true;
+ }
+ return super.checkState();
+ }
+
+ /**
+ * Overrode here to be package visible.
+ */
+ @Override
+ protected void refreshValidState() {
+ super.refreshValidState();
+ }
+
+ /**
+ * Only store if the text control is enabled
+ *
+ * @see FieldEditor#doStore()
+ */
+ @Override
+ protected void doStore() {
+ Text text = getTextControl();
+ if ( text.isEnabled() ) {
+ super.doStore();
+ }
+ }
+
+ /**
+ * Clears the error message from the message line if the error message is the error message from this field editor.
+ */
+ @Override
+ protected void clearErrorMessage() {
+ if ( getPage() != null ) {
+ String message = getPage().getErrorMessage();
+ if ( message != null ) {
+ if ( getErrorMessage().equals( message ) ) {
+ super.clearErrorMessage();
+ }
+ }
+ else {
+ super.clearErrorMessage();
+ }
+ }
+ }
+ }
+
+ class BreakpointStringFieldEditor extends StringFieldEditor {
+
+ public BreakpointStringFieldEditor( String name, String labelText, Composite parent ) {
+ super( name, labelText, parent );
+ }
+
+ /**
+ * @see StringFieldEditor#checkState()
+ */
+ @Override
+ protected boolean checkState() {
+ Text control = getTextControl();
+ if ( !control.isEnabled() ) {
+ clearErrorMessage();
+ return true;
+ }
+ return super.checkState();
+ }
+
+ @Override
+ protected void doStore() {
+ Text text = getTextControl();
+ if ( text.isEnabled() ) {
+ super.doStore();
+ }
+ }
+ protected void doLoad() {
+ String value = getPreferenceStore().getString(getPreferenceName());
+ setStringValue(value);
+ }
+
+ /**
+ * @see FieldEditor#refreshValidState()
+ */
+ @Override
+ protected void refreshValidState() {
+ super.refreshValidState();
+ }
+
+ /**
+ * Clears the error message from the message line if the error message is the error message from this field editor.
+ */
+ @Override
+ protected void clearErrorMessage() {
+ if ( getPage() != null ) {
+ String message = getPage().getErrorMessage();
+ if ( message != null ) {
+ if ( getErrorMessage().equals( message ) ) {
+ super.clearErrorMessage();
+ }
+ }
+ else {
+ super.clearErrorMessage();
+ }
+ }
+ }
+ }
+
+ class LabelFieldEditor extends ReadOnlyFieldEditor {
+ private String fValue;
+
+ public LabelFieldEditor( Composite parent, String title, String value ) {
+ super(title, title, parent);
+ fValue = value;
+ }
+
+ @Override
+ protected void doLoad() {
+ if (textField != null) {
+ textField.setText(fValue);
+ }
+ }
+ @Override
+ protected void doLoadDefault() {
+ // nothing
+ }
+
+ }
+
+ private BooleanFieldEditor fEnabled;
+
+ private BreakpointStringFieldEditor fCondition;
+
+ private Text fIgnoreCountTextControl;
+
+ private BreakpointIntegerFieldEditor fIgnoreCount;
+
+ private IAdaptable fElement;
+
+ /**
+ * The preference store used to interface between the breakpoint and the
+ * breakpoint preference page. This preference store is initialized only
+ * when the preference store cannot be retrieved from the preference
+ * dialog's element.
+ * @see #getPreferenceStore()
+ */
+ private CBreakpointPreferenceStore fCBreakpointPreferenceStore;
+
+ /**
+ * Constructor for CBreakpointPropertyPage.
+ *
+ * @param breakpoint
+ */
+ public CBreakpointPropertyPage() {
+ super( GRID );
+ noDefaultAndApplyButton();
+// Control control = getControl();
+// fCBreakpointPreferenceStore = new CBreakpointPreferenceStore();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ ICBreakpoint breakpoint = getBreakpoint();
+ createMainLabel(breakpoint);
+ createContributedFieldEditors(breakpoint);
+ createTypeSpecificLabelFieldEditors( breakpoint );
+ createEnabledField( getFieldEditorParent() );
+ createConditionEditor( getFieldEditorParent() );
+ createIgnoreCountEditor( getFieldEditorParent() );
+ }
+
+ private void createMainLabel(ICBreakpoint breakpoint) {
+ String label = getBreakpointMainLabel(breakpoint);
+ addField( createLabelEditor(
+ getFieldEditorParent(),
+ BreakpointsMessages.getString( "CBreakpointPropertyPage.breakpointType_label" ), //$NON-NLS-1$
+ label) );
+ }
+
+ /**
+ * Method createTypeSpecificLabelFieldEditors.
+ *
+ * @param breakpoint
+ */
+ private void createTypeSpecificLabelFieldEditors( ICBreakpoint breakpoint ) {
+
+ if ( breakpoint instanceof ICFunctionBreakpoint ) {
+ createFunctionEditor(getFieldEditorParent());
+ }
+ else if ( breakpoint instanceof ICAddressBreakpoint ) {
+ String title = BreakpointsMessages.getString( "CBreakpointPropertyPage.address_label" ); //$NON-NLS-1$
+
+ String address = getPreferenceStore().getString(ICLineBreakpoint.ADDRESS);
+ if (address == null || address.trim().length() == 0) {
+ address = BreakpointsMessages.getString( "CBreakpointPropertyPage.address_valueNotAvailable_label" ); //$NON-NLS-1$
+ }
+ addField( createLabelEditor( getFieldEditorParent(), title, address ) );
+ }
+ else if ( breakpoint instanceof ICWatchpoint ) {
+ IResource resource = getResource();
+ if (resource != null) {
+ IProject project = resource.getProject();
+ if ( project != null ) {
+ addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.project_label" ), project.getName() ) ); //$NON-NLS-1$
+ }
+ }
+ String filename = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
+ if (filename != null && !"".equals(filename)) { //$NON-NLS-1$
+ addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.sourceHandle_label" ), filename ) ); //$NON-NLS-1$
+ }
+ createWatchExpressionEditor(getFieldEditorParent());
+ createWatchTypeEditors(getFieldEditorParent());
+
+ }
+ else if ( breakpoint instanceof ILineBreakpoint ) {
+ String fileName = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
+ if ( fileName != null ) {
+ addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.sourceHandle_label" ), fileName ) ); //$NON-NLS-1$
+ }
+ int lNumber = getPreferenceStore().getInt(IMarker.LINE_NUMBER);
+ if (lNumber > 0) {
+ getPreferenceStore().setValue( IMarker.LINE_NUMBER, lNumber);
+ createLineNumberEditor(getFieldEditorParent());
+ }
+ }
+ }
+
+ private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
+ if (breakpoint instanceof ICWatchpoint && breakpoint.getMarker() != null) {
+ // For an existing breakpoint, calculate watchpoint label based
+ // on read/write type.
+ boolean isReadType = getPreferenceStore().getBoolean(ICWatchpoint.READ);
+ boolean isWriteType = getPreferenceStore().getBoolean(ICWatchpoint.WRITE);
+ if (isReadType && !isWriteType) {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_read_label"); //$NON-NLS-1$
+ } else if (!isReadType && isWriteType) {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_label"); //$NON-NLS-1$
+ } else {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.watchpointType_breakpointType_watchpoint_access_label"); //$NON-NLS-1$
+ }
+ }
+
+ IWorkbenchAdapter labelProvider = (IWorkbenchAdapter)getElement().getAdapter(IWorkbenchAdapter.class);
+ if (labelProvider != null) {
+ return labelProvider.getLabel(getElement());
+ }
+ // default main label is the label of marker type for the breakpoint
+ return CDIDebugModel.calculateMarkerType(breakpoint);
+ }
+
+ protected void createFunctionEditor( Composite parent ) {
+
+ ICBreakpoint breakpoint = getBreakpoint();
+ String title = BreakpointsMessages.getString("CBreakpointPropertyPage.function_label"); //$NON-NLS-1$
+ if (breakpoint == null || breakpoint.getMarker() == null) {
+ BreakpointStringFieldEditor expressionEditor = new BreakpointStringFieldEditor(
+ ICLineBreakpoint.FUNCTION, title, parent);
+ expressionEditor.setErrorMessage(BreakpointsMessages.getString("CBreakpointPropertyPage.function_value_errorMessage")); //$NON-NLS-1$
+ expressionEditor.setEmptyStringAllowed(false);
+ addField(expressionEditor);
+ } else {
+ String function = getPreferenceStore().getString(ICLineBreakpoint.FUNCTION);
+ if ( function == null ) {
+ function = BreakpointsMessages.getString( "CBreakpointPropertyPage.function_valueNotAvailable_label" ); //$NON-NLS-1$
+ }
+ addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.function_label" ), function ) ); //$NON-NLS-1$
+ }
+ }
+
+ protected void createLineNumberEditor( Composite parent ) {
+ String title = BreakpointsMessages.getString( "CBreakpointPropertyPage.lineNumber_label" ); //$NON-NLS-1$
+ BreakpointIntegerFieldEditor labelFieldEditor =new BreakpointIntegerFieldEditor( IMarker.LINE_NUMBER ,title, parent);
+ labelFieldEditor.setValidRange( 1, Integer.MAX_VALUE );
+ addField( labelFieldEditor );
+ }
+
+ protected void createWatchExpressionEditor( Composite parent ) {
+ ICBreakpoint breakpoint = getBreakpoint();
+ if (breakpoint == null || breakpoint.getMarker() == null) {
+ BreakpointStringFieldEditor expressionEditor =new BreakpointStringFieldEditor(
+ ICWatchpoint.EXPRESSION,
+ BreakpointsMessages.getString("CBreakpointPropertyPage.watchpoint_expression_label"), //$NON-NLS-1$
+ parent);
+ expressionEditor.setErrorMessage(BreakpointsMessages.getString("CBreakpointPropertyPage.watchpoint_expression_errorMessage")); //$NON-NLS-1$
+ expressionEditor.setEmptyStringAllowed(false);
+ addField(expressionEditor);
+ } else {
+ addField(createLabelEditor(
+ parent,
+ BreakpointsMessages.getString("CBreakpointPropertyPage.watchpoint_expression_label"), //$NON-NLS-1$
+ getPreferenceStore().getString(ICWatchpoint.EXPRESSION) ));
+ }
+ }
+
+ protected void createWatchTypeEditors( Composite parent ) {
+ // Edit read/write options only when creating the breakpoint.
+ ICBreakpoint breakpoint = getBreakpoint();
+ if (breakpoint != null && breakpoint.getMarker() == null) {
+ addField( new BooleanFieldEditor(
+ ICWatchpoint.READ,
+ BreakpointsMessages.getString("CBreakpointPropertyPage.watchpointType_read_label"), //$NON-NLS-1$
+ parent) );
+ addField( new BooleanFieldEditor(
+ ICWatchpoint.WRITE,
+ BreakpointsMessages.getString("CBreakpointPropertyPage.watchpointType_write_label"), //$NON-NLS-1$
+ parent) );
+ }
+ }
+
+ protected void createEnabledField( Composite parent ) {
+ fEnabled = new BooleanFieldEditor( ICBreakpoint.ENABLED, BreakpointsMessages.getString( "CBreakpointPropertyPage.enabled_label" ), parent ); //$NON-NLS-1$
+ addField( fEnabled );
+ }
+
+ protected void createConditionEditor( Composite parent ) {
+ fCondition = new BreakpointStringFieldEditor( ICBreakpoint.CONDITION, BreakpointsMessages.getString( "CBreakpointPropertyPage.condition_label" ), parent ); //$NON-NLS-1$
+ fCondition.setEmptyStringAllowed( true );
+ fCondition.setErrorMessage( BreakpointsMessages.getString( "CBreakpointPropertyPage.condition_invalidValue_message" ) ); //$NON-NLS-1$
+ addField( fCondition );
+ }
+
+ protected void createIgnoreCountEditor( Composite parent ) {
+ fIgnoreCount = new BreakpointIntegerFieldEditor( ICBreakpoint.IGNORE_COUNT, BreakpointsMessages.getString( "CBreakpointPropertyPage.ignoreCount_label" ), parent ); //$NON-NLS-1$
+ fIgnoreCount.setValidRange( 0, Integer.MAX_VALUE );
+ fIgnoreCountTextControl = fIgnoreCount.getTextControl( parent );
+ fIgnoreCountTextControl.setEnabled( getPreferenceStore().getInt(ICBreakpoint.IGNORE_COUNT) >= 0 );
+ addField( fIgnoreCount );
+ }
+
+ protected FieldEditor createLabelEditor( Composite parent, String title, String value ) {
+ return new LabelFieldEditor( parent, title, value );
+ }
+
+ protected ICBreakpoint getBreakpoint() {
+ IAdaptable element = getElement();
+ if (element instanceof ICBreakpoint) {
+ return (ICBreakpoint)element;
+ } else if (element instanceof ICBreakpointContext) {
+ return ((ICBreakpointContext)element).getBreakpoint();
+ } else {
+ return (ICBreakpoint)element.getAdapter(ICBreakpoint.class);
+ }
+ }
+
+ protected IResource getResource() {
+ IAdaptable element = getElement();
+ if (element instanceof ICBreakpoint) {
+ IMarker marker = ((ICBreakpoint)element).getMarker();
+ if (marker != null) {
+ return marker.getResource();
+ }
+ } else if (element instanceof ICBreakpointContext) {
+ return ((ICBreakpointContext)element).getResource();
+ }
+ return null;
+ }
+
+ public IPreferenceStore getPreferenceStore() {
+ IAdaptable element = getElement();
+ if (element instanceof ICBreakpointContext) {
+ return ((ICBreakpointContext)element).getPreferenceStore();
+ }
+
+ if (fCBreakpointPreferenceStore == null) {
+ CBreakpointContext bpContext = element instanceof CBreakpointContext ?
+ (CBreakpointContext)element : null;
+ fCBreakpointPreferenceStore = new CBreakpointPreferenceStore(bpContext, null);
+ }
+ return fCBreakpointPreferenceStore;
+ }
+
+ @Override
+ public boolean performCancel() {
+ IPreferenceStore store = getPreferenceStore();
+ if (store instanceof CBreakpointPreferenceStore) {
+ ((CBreakpointPreferenceStore)store).setCanceled(true);
+ }
+ return super.performCancel();
+ }
+
+ @Override
+ public boolean performOk() {
+ IPreferenceStore store = getPreferenceStore();
+ if (store instanceof CBreakpointPreferenceStore) {
+ ((CBreakpointPreferenceStore)store).setCanceled(false);
+ }
+ return super.performOk();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
+ */
+ @Override
+ public IAdaptable getElement() {
+ return fElement;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public void setElement( IAdaptable element ) {
+ fElement = element;
+ }
+
+ /**
+ * Creates field editors contributed using breakpointUIContribution extension point
+ * @param breakpoint
+ */
+ private void createContributedFieldEditors(ICBreakpoint breakpoint) {
+ Composite parent = getFieldEditorParent();
+ try {
+ ICBreakpointsUIContribution[] cons;
+ CBreakpointUIContributionFactory factory = CBreakpointUIContributionFactory.getInstance();
+ IPreferenceStore prefStore = getPreferenceStore();
+ if (prefStore instanceof CBreakpointPreferenceStore) {
+ cons = factory.getBreakpointUIContributions(
+ breakpoint, ((CBreakpointPreferenceStore) prefStore).getAttributes());
+ } else {
+ cons = factory.getBreakpointUIContributions(breakpoint);
+ }
+
+ for (ICBreakpointsUIContribution con : cons) {
+ FieldEditor fieldEditor = con.getFieldEditor(con.getId(), con.getLabel()+":", parent); //$NON-NLS-1$
+ if (fieldEditor != null) {
+ addField(fieldEditor);
+ }
+ }
+ } catch (CoreException ce) {
+ CDebugUIPlugin.log(ce);
+ }
+
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointUpdater.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java
index 01556ead2e2..b555f52ce2f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointUpdater.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui;
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
import java.util.Map;
import org.eclipse.cdt.debug.core.ICBreakpointListener;
@@ -79,7 +79,7 @@ public class CBreakpointUpdater implements ICBreakpointListener {
* org.eclipse.debug.core.model.IBreakpoint, java.util.Map)
*/
@Override
- public void breakpointChanged( IDebugTarget target, final IBreakpoint breakpoint, final Map attributes ) {
+ public void breakpointChanged( IDebugTarget target, final IBreakpoint breakpoint, @SuppressWarnings("rawtypes") final Map attributes ) {
asyncExec( new Runnable() {
@Override
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointWorkbenchAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java
index 38014d83d93..53812b2ee5a 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointWorkbenchAdapterFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java
@@ -8,11 +8,12 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui;
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
+import org.eclipse.cdt.debug.internal.ui.CDebugUIMessages;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.model.WorkbenchAdapter;
@@ -26,7 +27,7 @@ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory {
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
@Override
- public Object getAdapter( Object adaptableObject, Class adapterType ) {
+ public Object getAdapter( Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType ) {
if ( adapterType != IWorkbenchAdapter.class || !(adaptableObject instanceof ICBreakpoint) ) {
return null;
}
@@ -48,7 +49,8 @@ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
- @Override
+ @SuppressWarnings("rawtypes")
+ @Override
public Class[] getAdapterList() {
return new Class[] { IWorkbenchAdapter.class };
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java
new file mode 100644
index 00000000000..a2f1824acb8
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
+
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ *
+ */
+public class CreateBreakpointTester extends PropertyTester {
+
+ private final static String PROP_CREATE_BREAKPOINT_ADAPT = "createBreakpointAdapt"; //$NON-NLS-1$
+
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (PROP_CREATE_BREAKPOINT_ADAPT.equals(property) &&
+ receiver instanceof ICBreakpointContext &&
+ expectedValue instanceof String)
+ {
+ try {
+ Class<?> expectedClass = Class.forName((String)expectedValue);
+ return expectedClass.isAssignableFrom(
+ ((ICBreakpointContext)receiver).getBreakpoint().getClass());
+ } catch (ClassNotFoundException e) {
+ CDebugUIPlugin.log(new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Unable to create class: " + expectedValue, e)); //$NON-NLS-1$
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ThreadFilterEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java
index b02390ca10f..cb341c364b8 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ThreadFilterEditor.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.propertypages;
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
import java.util.ArrayList;
import java.util.List;
@@ -149,7 +149,7 @@ public class ThreadFilterEditor {
}
}
if ( parent instanceof ILaunchManager ) {
- List children = new ArrayList();
+ List<Object> children = new ArrayList<Object>();
ILaunch[] launches = ((ILaunchManager)parent).getLaunches();
IDebugTarget[] targets;
ICDebugTarget target;
@@ -251,7 +251,7 @@ public class ThreadFilterEditor {
private void createThreadViewer( Composite parent ) {
Label label = new Label( parent, SWT.NONE );
- label.setText( PropertyPageMessages.getString( "ThreadFilterEditor.0" ) ); //$NON-NLS-1$
+ label.setText( BreakpointsMessages.getString( "ThreadFilterEditor.0" ) ); //$NON-NLS-1$
label.setFont( parent.getFont() );
label.setLayoutData( new GridData() );
GridData data = new GridData( GridData.FILL_BOTH );
@@ -338,11 +338,11 @@ public class ThreadFilterEditor {
private ICThread[] getTargetThreadFilters( ICDebugTarget target ) {
Object[] threads = ((ITreeContentProvider)getThreadViewer().getContentProvider()).getChildren( target );
- ArrayList list = new ArrayList( threads.length );
+ ArrayList<ICThread> list = new ArrayList<ICThread>( threads.length );
for ( int i = 0; i < threads.length; ++i ) {
if ( getThreadViewer().getChecked( threads[i] ) )
- list.add( threads[i] );
+ list.add( (ICThread)threads[i] );
}
- return (ICThread[])list.toArray( new ICThread[list.size()] );
+ return list.toArray( new ICThread[list.size()] );
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ToggleCBreakpointTester.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java
index 74cae165f56..d4b161db193 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ToggleCBreakpointTester.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java
@@ -9,7 +9,7 @@
* Patrick Chuong (Texas Instruments) -
* Update CDT ToggleBreakpointTargetFactory enablement (340177)
*****************************************************************/
-package org.eclipse.cdt.debug.internal.ui;
+package org.eclipse.cdt.debug.internal.ui.breakpoints;
import java.util.List;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java
index a7760a44005..5be9925b9b4 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java
@@ -18,8 +18,7 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
-import org.eclipse.cdt.debug.internal.core.breakpoints.CEventBreakpoint;
-import org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointPreferenceStore;
+import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointPreferenceStore;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory;
import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContribution;
@@ -75,10 +74,10 @@ public class AddEventBreakpointDialog extends Dialog implements ModifyListener,
protected void createFieldEditors() {
Composite parent = getFieldEditorParent();
try {
- Map map = new HashMap();
+ Map<String, Object> map = new HashMap<String, Object>();
map.put(ICEventBreakpoint.EVENT_TYPE_ID, eventType);
ICBreakpointsUIContribution cons[] = CBreakpointUIContributionFactory.getInstance()
- .getBreakpointUIContributions(modelId, CEventBreakpoint.getMarkerType(), map);
+ .getBreakpointUIContributions(modelId, ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER, map);
for (ICBreakpointsUIContribution con : cons) {
if (con.getId().equals(ICEventBreakpoint.EVENT_TYPE_ID)) continue;
@@ -116,7 +115,7 @@ public class AddEventBreakpointDialog extends Dialog implements ModifyListener,
private void loadEventTypes() {
ICBreakpointsUIContribution[] cons = factory.getBreakpointUIContributions(debugModelId,
- CEventBreakpoint.getMarkerType(), null);
+ ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER, null);
for (int i = 0; i < cons.length; i++) {
ICBreakpointsUIContribution con = cons[i];
if (con.getId().equals(ICEventBreakpoint.EVENT_TYPE_ID)) {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java
index 00f7a7e1d3d..bcc888c780d 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java
@@ -13,8 +13,8 @@ package org.eclipse.cdt.debug.internal.ui.disassembly.editor;
import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerAction;
-import org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerAction;
+import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerAction;
+import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.EnableDisableBreakpointRulerAction;
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider;
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane;
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DocumentContentProvider;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPreferenceStore.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPreferenceStore.java
deleted file mode 100644
index e873bd5bde4..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPreferenceStore.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * QNX Software Systems - Refactored to use platform implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.propertypages;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceStore;
-
-/**
- * A preference store that presents the state of the properties of a C/C++ breakpoint.
- */
-public class CBreakpointPreferenceStore extends PreferenceStore implements IPreferenceStore {
-
- protected final static String ENABLED = "ENABLED"; //$NON-NLS-1$
-
- protected final static String CONDITION = "CONDITION"; //$NON-NLS-1$
-
- protected final static String IGNORE_COUNT = "IGNORE_COUNT"; //$NON-NLS-1$
-
- protected final static String LINE = "LINE"; //$NON-NLS-1$
-
- /**
- * Constructor for CBreakpointPreferenceStore.
- */
- public CBreakpointPreferenceStore() {
-
- }
-
- /**
- * Override to not save.
- * This store used for temporary breakpoint setting in dialogs
- * and does not require permanent storage.
- */
- @Override
- public boolean needsSaving() {
- return false;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java
deleted file mode 100644
index 006f98937e8..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
- * QNX Software Systems - Catchpoints support https://bugs.eclipse.org/bugs/show_bug.cgi?id=226689
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.propertypages;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint2;
-import org.eclipse.cdt.debug.core.model.ICWatchpoint;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory;
-import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContribution;
-import org.eclipse.cdt.debug.ui.preferences.ReadOnlyFieldEditor;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.model.ILineBreakpoint;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-
-/**
- * The preference page used to present the properties of a breakpoint as preferences. A CBreakpointPreferenceStore is used to interface between this page and
- * the breakpoint.
- */
-public class CBreakpointPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
-
- class BreakpointIntegerFieldEditor extends IntegerFieldEditor {
-
- public BreakpointIntegerFieldEditor( String name, String labelText, Composite parent ) {
- super( name, labelText, parent );
- setErrorMessage( PropertyPageMessages.getString( "CBreakpointPropertyPage.0" ) ); //$NON-NLS-1$
- }
-
- /**
- * @see IntegerFieldEditor#checkState()
- */
- @Override
- protected boolean checkState() {
- Text control = getTextControl();
- if ( !control.isEnabled() ) {
- clearErrorMessage();
- return true;
- }
- return super.checkState();
- }
-
- /**
- * Overrode here to be package visible.
- */
- @Override
- protected void refreshValidState() {
- super.refreshValidState();
- }
-
- /**
- * Only store if the text control is enabled
- *
- * @see FieldEditor#doStore()
- */
- @Override
- protected void doStore() {
- Text text = getTextControl();
- if ( text.isEnabled() ) {
- super.doStore();
- }
- }
-
- /**
- * Clears the error message from the message line if the error message is the error message from this field editor.
- */
- @Override
- protected void clearErrorMessage() {
- if ( getPage() != null ) {
- String message = getPage().getErrorMessage();
- if ( message != null ) {
- if ( getErrorMessage().equals( message ) ) {
- super.clearErrorMessage();
- }
- }
- else {
- super.clearErrorMessage();
- }
- }
- }
- }
-
- class BreakpointStringFieldEditor extends StringFieldEditor {
-
- public BreakpointStringFieldEditor( String name, String labelText, Composite parent ) {
- super( name, labelText, parent );
- }
-
- /**
- * @see StringFieldEditor#checkState()
- */
- @Override
- protected boolean checkState() {
- Text control = getTextControl();
- if ( !control.isEnabled() ) {
- clearErrorMessage();
- return true;
- }
- return super.checkState();
- }
-
- @Override
- protected void doStore() {
- Text text = getTextControl();
- if ( text.isEnabled() ) {
- super.doStore();
- }
- }
-
- /**
- * @see FieldEditor#refreshValidState()
- */
- @Override
- protected void refreshValidState() {
- super.refreshValidState();
- }
-
- /**
- * Clears the error message from the message line if the error message is the error message from this field editor.
- */
- @Override
- protected void clearErrorMessage() {
- if ( getPage() != null ) {
- String message = getPage().getErrorMessage();
- if ( message != null ) {
- if ( getErrorMessage().equals( message ) ) {
- super.clearErrorMessage();
- }
- }
- else {
- super.clearErrorMessage();
- }
- }
- }
- }
-
- class LabelFieldEditor extends ReadOnlyFieldEditor {
- private String fValue;
-
- public LabelFieldEditor( Composite parent, String title, String value ) {
- super(title, title, parent);
- fValue = value;
- }
-
- @Override
- protected void doLoad() {
- if (textField != null) {
- textField.setText(fValue);
- }
- }
- @Override
- protected void doLoadDefault() {
- // nothing
- }
-
- }
-
- private BooleanFieldEditor fEnabled;
-
- private BreakpointStringFieldEditor fCondition;
-
- private Text fIgnoreCountTextControl;
-
- private BreakpointIntegerFieldEditor fIgnoreCount;
-
- private IAdaptable fElement;
-
- /**
- * The "fake" preference store used to interface between
- * the breakpoint and the breakpoint preference page.
- */
- private CBreakpointPreferenceStore fCBreakpointPreferenceStore;
-
- /**
- * Constructor for CBreakpointPropertyPage.
- *
- * @param breakpoint
- */
- public CBreakpointPropertyPage() {
- super( GRID );
- noDefaultAndApplyButton();
- fCBreakpointPreferenceStore = new CBreakpointPreferenceStore();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- @Override
- protected void createFieldEditors() {
- ICBreakpoint breakpoint = getBreakpoint();
- createMainLabel(breakpoint);
- createContributetedFieldEditors(breakpoint);
- createTypeSpecificLabelFieldEditors( breakpoint );
- createEnabledField( getFieldEditorParent() );
- IPreferenceStore store = getPreferenceStore();
- try {
- String condition = breakpoint.getCondition();
- if ( condition == null ) {
- condition = ""; //$NON-NLS-1$
- }
- store.setValue( CBreakpointPreferenceStore.CONDITION, condition );
- createConditionEditor( getFieldEditorParent() );
- store.setValue( CBreakpointPreferenceStore.ENABLED, breakpoint.isEnabled() );
- int ignoreCount = breakpoint.getIgnoreCount();
- store.setValue( CBreakpointPreferenceStore.IGNORE_COUNT, (ignoreCount >= 0) ? ignoreCount : 0 );
- createIgnoreCountEditor( getFieldEditorParent() );
- }
- catch( CoreException ce ) {
- CDebugUIPlugin.log( ce );
- }
- }
-
- private void createMainLabel(ICBreakpoint breakpoint) {
- addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), //$NON-NLS-1$
- getBreakpointMainLabel(breakpoint) ) );
- }
-
- /**
- * Method createTypeSpecificLabelFieldEditors.
- *
- * @param breakpoint
- */
- private void createTypeSpecificLabelFieldEditors( ICBreakpoint breakpoint ) {
-
- if ( breakpoint instanceof ICFunctionBreakpoint ) {
- ICFunctionBreakpoint fbrkpt = (ICFunctionBreakpoint)breakpoint;
- String function = PropertyPageMessages.getString( "CBreakpointPropertyPage.1" ); //$NON-NLS-1$
- try {
- function = fbrkpt.getFunction();
- }
- catch( CoreException e ) {
- }
- catch( NumberFormatException e ) {
- }
- if ( function != null ) {
- addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.2" ), function ) ); //$NON-NLS-1$
- }
- }
- else if ( breakpoint instanceof ICAddressBreakpoint ) {
- ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint;
- String address = PropertyPageMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$
- try {
- address = abrkpt.getAddress();
- }
- catch( CoreException e ) {
- }
- if ( address != null ) {
- addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.5" ), address ) ); //$NON-NLS-1$
- }
- }
- else if ( breakpoint instanceof ICWatchpoint ) {
- ICWatchpoint watchpoint = (ICWatchpoint)breakpoint;
- String expression = ""; //$NON-NLS-1$
- try {
- expression = watchpoint.getExpression();
- }
- catch( CoreException ce ) {
- CDebugUIPlugin.log( ce );
- }
- IProject project = breakpoint.getMarker().getResource().getProject();
- if ( project != null ) {
- addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.10" ), project.getName() ) ); //$NON-NLS-1$
- }
- IResource resource = breakpoint.getMarker().getResource();
- if ( resource instanceof IFile ) {
- String filename = resource.getLocation().toOSString();
- if ( filename != null ) {
- addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.20" ), filename ) ); //$NON-NLS-1$
- }
- }
- addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.14" ), expression ) ); //$NON-NLS-1$
- }
- else if ( breakpoint instanceof ILineBreakpoint ) {
- String fileName = null;
- try {
- fileName = breakpoint.getSourceHandle();
- }
- catch( CoreException e ) {
- }
- if ( fileName != null ) {
- addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.7" ), fileName ) ); //$NON-NLS-1$
- }
- ILineBreakpoint lBreakpoint = (ILineBreakpoint) breakpoint;
-
- int lNumber = 0;
- try {
- lNumber = lBreakpoint.getLineNumber();
- } catch (CoreException e) {
- CDebugUIPlugin.log(e);
- }
-
- if (lNumber > 0) {
- getPreferenceStore().setValue( CBreakpointPreferenceStore.LINE, lNumber);
- createLineNumberEditor(getFieldEditorParent());
- }
- }
- }
-
- private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
- if (breakpoint instanceof ICFunctionBreakpoint)
- return PropertyPageMessages.getString("CBreakpointPropertyPage.3"); //$NON-NLS-1$
- if (breakpoint instanceof ICAddressBreakpoint)
- return PropertyPageMessages.getString("CBreakpointPropertyPage.4"); //$NON-NLS-1$
- if (breakpoint instanceof ICLineBreakpoint)
- return PropertyPageMessages.getString("CBreakpointPropertyPage.8"); //$NON-NLS-1$
- if (breakpoint instanceof ICEventBreakpoint)
- return PropertyPageMessages.getString("CBreakpointPropertyPage.21"); //$NON-NLS-1$
- if (breakpoint instanceof ICWatchpoint) {
- ICWatchpoint watchpoint = (ICWatchpoint) breakpoint;
- String type = ""; //$NON-NLS-1$
- try {
- if (watchpoint.isReadType() && !watchpoint.isWriteType())
- type = PropertyPageMessages.getString("CBreakpointPropertyPage.11"); //$NON-NLS-1$
- else if (!watchpoint.isReadType() && watchpoint.isWriteType())
- type = PropertyPageMessages.getString("CBreakpointPropertyPage.12"); //$NON-NLS-1$
- else
- type = PropertyPageMessages.getString("CBreakpointPropertyPage.13"); //$NON-NLS-1$
-
- } catch (CoreException ce) {
- CDebugUIPlugin.log(ce);
- }
- return type;
- }
- // default main label is the label of marker type for the breakpoint
- String type = ""; //$NON-NLS-1$
- try {
- type = breakpoint.getMarker().getType(); // TODO: how to get label?
- } catch (CoreException ce) {
- CDebugUIPlugin.log(ce);
- }
- return type;
- }
- protected void createLineNumberEditor( Composite parent ) {
- String title = PropertyPageMessages.getString( "CBreakpointPropertyPage.9" ); //$NON-NLS-1$
- BreakpointIntegerFieldEditor labelFieldEditor =new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.LINE ,title, parent);
- labelFieldEditor.setValidRange( 1, Integer.MAX_VALUE );
- addField( labelFieldEditor );
- }
-
-
- protected void createEnabledField( Composite parent ) {
- fEnabled = new BooleanFieldEditor( CBreakpointPreferenceStore.ENABLED, PropertyPageMessages.getString( "CBreakpointPropertyPage.19" ), parent ); //$NON-NLS-1$
- addField( fEnabled );
- }
-
- protected void createConditionEditor( Composite parent ) {
- fCondition = new BreakpointStringFieldEditor( CBreakpointPreferenceStore.CONDITION, PropertyPageMessages.getString( "CBreakpointPropertyPage.15" ), parent ); //$NON-NLS-1$
- fCondition.setEmptyStringAllowed( true );
- fCondition.setErrorMessage( PropertyPageMessages.getString( "CBreakpointPropertyPage.16" ) ); //$NON-NLS-1$
- addField( fCondition );
- }
-
- protected void createIgnoreCountEditor( Composite parent ) {
- fIgnoreCount = new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.IGNORE_COUNT, PropertyPageMessages.getString( "CBreakpointPropertyPage.17" ), parent ); //$NON-NLS-1$
- fIgnoreCount.setValidRange( 0, Integer.MAX_VALUE );
- fIgnoreCountTextControl = fIgnoreCount.getTextControl( parent );
- try {
- fIgnoreCountTextControl.setEnabled( getBreakpoint().getIgnoreCount() >= 0 );
- }
- catch( CoreException ce ) {
- CDebugUIPlugin.log( ce );
- }
- addField( fIgnoreCount );
- }
-
- protected FieldEditor createLabelEditor( Composite parent, String title, String value ) {
- return new LabelFieldEditor( parent, title, value );
- }
-
- protected ICBreakpoint getBreakpoint() {
- IAdaptable element = getElement();
- return ( element instanceof ICBreakpoint ) ? (ICBreakpoint)element : (ICBreakpoint)element.getAdapter(ICBreakpoint.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
- */
- @Override
- public IAdaptable getElement() {
- return fElement;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
- */
- @Override
- public void setElement( IAdaptable element ) {
- fElement = element;
- }
-
- @Override
- public IPreferenceStore getPreferenceStore() {
- return fCBreakpointPreferenceStore;
- }
-
- @Override
- public boolean performOk() {
- final List changedProperties = new ArrayList( 5 );
- getPreferenceStore().addPropertyChangeListener( new IPropertyChangeListener() {
-
- /**
- * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- @Override
- public void propertyChange( PropertyChangeEvent event ) {
- changedProperties.add( event.getProperty() );
- }
- } );
- boolean result = super.performOk();
- setBreakpointProperties( changedProperties );
- return result;
- }
-
- protected void setBreakpointProperties( final List changedProperties ) {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-
- @Override
- public void run( IProgressMonitor monitor ) throws CoreException {
- ICBreakpoint breakpoint = getBreakpoint();
- Iterator changed = changedProperties.iterator();
- while( changed.hasNext() ) {
- String property = (String)changed.next();
- if ( property.equals( CBreakpointPreferenceStore.ENABLED ) ) {
- breakpoint.setEnabled( getPreferenceStore().getBoolean( CBreakpointPreferenceStore.ENABLED ) );
- }
- else if ( property.equals( CBreakpointPreferenceStore.IGNORE_COUNT ) ) {
- breakpoint.setIgnoreCount( getPreferenceStore().getInt( CBreakpointPreferenceStore.IGNORE_COUNT ) );
- }
- else if ( property.equals( CBreakpointPreferenceStore.CONDITION ) ) {
- breakpoint.setCondition( getPreferenceStore().getString( CBreakpointPreferenceStore.CONDITION ) );
- }
- else if ( property.equals( CBreakpointPreferenceStore.LINE ) ) {
- // already workspace runnable, setting markers are safe
- breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getPreferenceStore().getInt(CBreakpointPreferenceStore.LINE));
- breakpoint.getMarker().setAttribute(ICLineBreakpoint2.REQUESTED_LINE, getPreferenceStore().getInt(CBreakpointPreferenceStore.LINE));
- } else {
- // this allow set attributes contributed by other plugins
- String value = getPropertyAsString(property);
- breakpoint.getMarker().setAttribute(property, value);
- }
- }
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( wr, null );
- }
- catch( CoreException ce ) {
- CDebugUIPlugin.log( ce );
- }
- }
-
- /**
- * Creates field editors contributed using breakpointUIContribution extension point
- * @param breakpoint
- */
- private void createContributetedFieldEditors(ICBreakpoint breakpoint) {
- Composite parent = getFieldEditorParent();
- try {
- ICBreakpointsUIContribution cons[] = CBreakpointUIContributionFactory.getInstance()
- .getBreakpointUIContributions(breakpoint);
- for (ICBreakpointsUIContribution con : cons) {
-
- FieldEditor fieldEditor = con.getFieldEditor(con.getId(), con.getLabel()+":", parent); //$NON-NLS-1$
- if (fieldEditor != null)
- addField(fieldEditor);
- Object o = breakpoint.getMarker().getAttribute(con.getId());
- String value = o==null?"":o.toString(); //$NON-NLS-1$
- getPreferenceStore().setValue(con.getId(), value);
- }
- } catch (CoreException ce) {
- CDebugUIPlugin.log(ce);
- }
-
- }
-
- /**
- * Return string value of given property or null.
- */
- protected String getPropertyAsString(String property) {
- // currently only supports String and Integer
- IPreferenceStore store = getPreferenceStore();
-
- if (store.contains(property)) {
- String value = store.getString(property);
- return value;
- } else return null;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties
index 309d5581f45..4861ba4ac0d 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties
@@ -11,29 +11,6 @@
# IBM Corporation
###############################################################################
-CBreakpointPropertyPage.0=Ignore count must be a nonnegative integer
-CBreakpointPropertyPage.1=Not available
-CBreakpointPropertyPage.2=Function name:
-CBreakpointPropertyPage.3=C/C++ function breakpoint
-CBreakpointPropertyPage.4=Not available
-CBreakpointPropertyPage.5=Address:
-CBreakpointPropertyPage.6=C/C++ address breakpoint
-CBreakpointPropertyPage.7=File:
-CBreakpointPropertyPage.8=C/C++ line breakpoint
-CBreakpointPropertyPage.9=Line number:
-CBreakpointPropertyPage.10=Project:
-CBreakpointPropertyPage.11=C/C++ read watchpoint
-CBreakpointPropertyPage.12=C/C++ watchpoint
-CBreakpointPropertyPage.13=C/C++ access watchpoint
-CBreakpointPropertyPage.14=Expression to watch:
-CBreakpointPropertyPage.15=&Condition:
-CBreakpointPropertyPage.16=Invalid condition.
-CBreakpointPropertyPage.17=&Ignore count:
-CBreakpointPropertyPage.18=Class:
-CBreakpointPropertyPage.19=Enabled
-CBreakpointPropertyPage.20=File:
-CBreakpointPropertyPage.21=C/C++ Event Breakpoint
-ThreadFilterEditor.0=&Restrict to Selected Targets and Threads:
SignalPropertyPage.0=Description: {0}.
SignalPropertyPage.1=Pass this signal to the program.
SignalPropertyPage.2=Suspend the program when this signal happens.
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
index bf211af2577..559574ece95 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
@@ -17,7 +17,6 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICDebugElement;
-import org.eclipse.cdt.debug.internal.ui.CBreakpointUpdater;
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
import org.eclipse.cdt.debug.internal.ui.CDebuggerPageAdapter;
@@ -25,6 +24,7 @@ import org.eclipse.cdt.debug.internal.ui.CRegisterManagerProxies;
import org.eclipse.cdt.debug.internal.ui.ColorManager;
import org.eclipse.cdt.debug.internal.ui.EvaluationContextManager;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
+import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointUpdater;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyBackendCdiFactory;
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorManager;
import org.eclipse.cdt.debug.internal.ui.pinclone.ViewIDCounterManager;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java
new file mode 100644
index 00000000000..22dd8d73e79
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java
@@ -0,0 +1,752 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mentor Graphics 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:
+ * Mentor Graphics - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.ui.breakpoints;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IDeclaration;
+import org.eclipse.cdt.core.model.IFunction;
+import org.eclipse.cdt.core.model.IFunctionDeclaration;
+import org.eclipse.cdt.core.model.IMethod;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.IVariable;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+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.internal.ui.CDebugUIUtils;
+import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
+import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.EnableDisableBreakpointRulerAction;
+import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
+import org.eclipse.cdt.ui.CDTUITools;
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension2;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.ui.texteditor.IEditorStatusLine;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
+
+/**
+ * Base class for toggle adapter to create/remove CDT breakpoints. Clients may
+ * extend this class to gather additional data prior to creating the breakpoints.
+ *
+ * @since 7.2
+ */
+abstract public class AbstractToggleBreakpointAdapter
+ implements IToggleBreakpointsTargetExtension2, IToggleBreakpointsTargetCExtension
+{
+
+
+ @Override
+ public boolean canToggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) {
+ return canToggleBreakpoints(part, selection);
+ }
+
+ @Override
+ public void toggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) throws CoreException {
+ if(event != null && (event.stateMask & SWT.MOD2) > 0) {
+ if (toggleBreakpointEnable(part)) {
+ return;
+ }
+ }
+ else {
+ boolean interactive = event != null && (event.stateMask & SWT.MOD1) > 0;
+ updateBreakpoints(true, interactive, part, selection);
+ }
+ }
+
+ @Override
+ public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ updateLineBreakpoints(true, false, part, selection);
+ }
+
+ @Override
+ public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ return (selection instanceof ITextSelection);
+ }
+
+ @Override
+ public void toggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ ICElement element = getCElementFromSelection( part, selection );
+ if ( element instanceof IFunction || element instanceof IMethod) {
+ updateMethodBreakpoints(true, false, part, (IDeclaration)element);
+ }
+ }
+
+ @Override
+ public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ ICElement element = getCElementFromSelection( part, selection );
+ return (element instanceof IFunction || element instanceof IMethod);
+ }
+
+ @Override
+ public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ IVariable variable = getVariableFromSelection( part, selection );
+ if ( variable != null ) {
+ updateVariableWatchpoint(true, false, part, variable);
+ }
+ }
+
+ @Override
+ public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
+ return getVariableFromSelection( part, selection ) != null;
+ }
+
+ @Override
+ public boolean canToggleBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ return ( canToggleLineBreakpoints( part, selection )
+ || canToggleWatchpoints( part, selection )
+ || canToggleMethodBreakpoints( part, selection ) );
+ }
+
+ @Override
+ public void toggleBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ updateBreakpoints(true, false, part, selection);
+ }
+
+ @Override
+ public boolean canCreateLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) {
+ return canToggleLineBreakpoints( part, selection );
+ }
+
+ @Override
+ public void createLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
+ updateLineBreakpoints(false, true, part, selection);
+ }
+
+ @Override
+ public boolean canCreateWatchpointsInteractive(IWorkbenchPart part, ISelection selection) {
+ // Gather all input from user if needed.
+ return true;
+ }
+
+ @Override
+ public void createWatchpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
+ ICElement element = getCElementFromSelection( part, selection );
+ if (element instanceof IVariable) {
+ updateVariableWatchpoint(false, true, part, (IVariable)element);
+ } else {
+ String text = ""; //$NON-NLS-1$
+ if (selection instanceof ITextSelection) {
+ text = ((ITextSelection)selection).getText();
+ }
+ createWatchpoint(true, part, null, ResourcesPlugin.getWorkspace().getRoot(), -1, -1, -1, text);
+ }
+ }
+
+ @Override
+ public boolean canCreateFunctionBreakpointInteractive(IWorkbenchPart part, ISelection selection) {
+ return true;
+ }
+
+ @Override
+ public void createFunctionBreakpointInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
+ ICElement element = getCElementFromSelection( part, selection );
+ if ( element instanceof IFunction || element instanceof IMethod ) {
+ updateMethodBreakpoints(false, true, part, (IDeclaration)element);
+ } else {
+ String text = ""; //$NON-NLS-1$
+ if (selection instanceof ITextSelection) {
+ text = ((ITextSelection)selection).getText();
+ }
+ createFunctionBreakpoint(true, part, null, ResourcesPlugin.getWorkspace().getRoot(), text, -1, -1, -1);
+ }
+ }
+
+ /**
+ * Updates the breakpoint for given part and selection.
+ * Depending on the flags and on whether a breakpoint exists, this method
+ * executes the toggle action.
+ *
+ * @param toggle Whether the toggle action is requested. If
+ * true and the breakpoint currently exists, it will cause the
+ * toggle action to either remove breakpoint or edit its properties.
+ * Otherwise a new breakpoint will be created.
+ * @param interactive If true the toggle adapter should open a dialog before
+ * creating a breakpoint, or open a properties dialog on an existing
+ * breakpoint.
+ * @param part Workbench part where the toggle action is to be executed.
+ * @param selection Current selection on which the toggle action is to be
+ * executed.
+ * @throws CoreException Any error in creating or editing the breakpoint.
+ */
+ private void updateBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part, ISelection selection ) throws CoreException {
+ if ( canToggleLineBreakpoints( part, selection ) ) {
+ updateLineBreakpoints(toggle, interactive, part, selection);
+ }
+ else {
+ ICElement element = getCElementFromSelection( part, selection );
+ if ( element instanceof IFunction || element instanceof IMethod ) {
+ updateMethodBreakpoints(toggle, interactive, part, (IDeclaration)element);
+ }
+ else if ( element instanceof IVariable ) {
+ updateVariableWatchpoint(toggle, interactive, part, (IVariable)element);
+ }
+ }
+ }
+
+ private void updateLineBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part, ISelection selection)
+ throws CoreException {
+ String errorMessage = null;
+ if (part instanceof ITextEditor) {
+ ITextEditor textEditor = (ITextEditor) part;
+ IEditorInput input = textEditor.getEditorInput();
+ if (input == null) {
+ errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Empty_editor_1"); //$NON-NLS-1$
+ } else {
+ IDocument document = textEditor.getDocumentProvider().getDocument(input);
+ if (document == null) {
+ errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Missing_document_1"); //$NON-NLS-1$
+ } else {
+ IResource resource = getResource(textEditor);
+ if (resource == null) {
+ errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Missing_resource_1"); //$NON-NLS-1$
+ } else {
+ int lineNumber = ((ITextSelection) selection).getStartLine() + 1;
+ if (lineNumber == -1) {
+ errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Invalid_line_1"); //$NON-NLS-1$
+ } else {
+ String sourceHandle = getSourceHandle(input);
+ if (interactive && !toggle) {
+ createLineBreakpoint(true, part, sourceHandle, resource, lineNumber);
+ } else {
+ ICLineBreakpoint breakpoint = findLineBreakpoint(sourceHandle, resource, lineNumber);
+ if (breakpoint != null) {
+ if (interactive) {
+ CDebugUIUtils.editBreakpointProperties(part, breakpoint);
+ } else {
+ DebugPlugin.getDefault().getBreakpointManager()
+ .removeBreakpoint(breakpoint, true);
+ }
+ } else {
+ createLineBreakpoint(interactive, part, sourceHandle, resource, lineNumber);
+ }
+ }
+ return;
+ }
+ }
+ }
+ }
+ } else {
+ errorMessage = ActionMessages.getString("RunToLineAdapter.Operation_is_not_supported_1"); //$NON-NLS-1$
+ }
+ throw new CoreException(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(),
+ IInternalCDebugUIConstants.INTERNAL_ERROR, errorMessage, null));
+ }
+
+ private void updateMethodBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part,
+ IDeclaration declaration) throws CoreException {
+ String sourceHandle = getSourceHandle(declaration);
+ IResource resource = getElementResource(declaration);
+ String functionName = (declaration instanceof IFunction) ? getFunctionName((IFunction) declaration)
+ : getMethodName((IMethod) declaration);
+ ICFunctionBreakpoint breakpoint = findFunctionBreakpoint(sourceHandle, resource, functionName);
+ if (toggle && breakpoint != null) {
+ if (interactive) {
+ CDebugUIUtils.editBreakpointProperties(part, breakpoint);
+ } else {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(breakpoint, true);
+ }
+ } else {
+ int lineNumber = -1;
+ int charStart = -1;
+ int charEnd = -1;
+ try {
+ ISourceRange sourceRange = declaration.getSourceRange();
+ if (sourceRange != null) {
+ charStart = sourceRange.getStartPos();
+ charEnd = charStart + sourceRange.getLength();
+ if (charEnd <= 0) {
+ charStart = -1;
+ charEnd = -1;
+ }
+ lineNumber = sourceRange.getStartLine();
+ }
+ } catch (CModelException e) {
+ DebugPlugin.log(e);
+ }
+ createFunctionBreakpoint(interactive, part, sourceHandle, resource, functionName, charStart, charEnd,
+ lineNumber);
+ }
+ }
+
+ /**
+ * Updates a watchpoint. Depending on the flags and on whether a breakpoint
+ * exists, this method executes the toggle action.
+ *
+ * @param toggle
+ * Whether the toggle action is requested. If true and the
+ * breakpoint currently exists, it will cause the toggle action
+ * to either remove breakpoint or edit its properties. Otherwise
+ * a new breakpoint will be created.
+ * @param interactive
+ * If true the toggle adapter should open a dialog before
+ * creating a breakpoint, or open a properties dialog on an
+ * existing breakpoint.
+ * @param part
+ * Workbench part where the toggle action is to be executed.
+ * @param selection
+ * Variable on which to execute the toggle action.
+ * @throws CoreException
+ * Any error in creating or editing the breakpoint.
+ */
+ private void updateVariableWatchpoint(boolean toggle, boolean interactive, IWorkbenchPart part, IVariable variable)
+ throws CoreException {
+ String sourceHandle = getSourceHandle(variable);
+ IResource resource = getElementResource(variable);
+ String expression = getVariableName(variable);
+ ICWatchpoint watchpoint = findWatchpoint(sourceHandle, resource, expression);
+ if (toggle && watchpoint != null) {
+ if (interactive) {
+ CDebugUIUtils.editBreakpointProperties(part, watchpoint);
+ } else {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(watchpoint, true);
+ }
+ } else {
+ int lineNumber = -1;
+ int charStart = -1;
+ int charEnd = -1;
+ try {
+ ISourceRange sourceRange = variable.getSourceRange();
+ if (sourceRange != null) {
+ charStart = sourceRange.getStartPos();
+ charEnd = charStart + sourceRange.getLength();
+ if (charEnd <= 0) {
+ charStart = -1;
+ charEnd = -1;
+ }
+ lineNumber = sourceRange.getStartLine();
+ }
+ } catch (CModelException e) {
+ CDebugUIPlugin.log(e);
+ }
+ createWatchpoint(interactive, part, sourceHandle, resource, charStart, charEnd, lineNumber, expression);
+ }
+ }
+
+ /**
+ * Returns the C model element at the given selection.
+ * @param part Workbench part where the selection is.
+ * @param selection Selection in part.
+ * @return C model element if found.
+ */
+ protected ICElement getCElementFromSelection( IWorkbenchPart part, ISelection selection ) {
+ if ( selection instanceof ITextSelection ) {
+ ITextSelection textSelection = (ITextSelection)selection;
+ String text = textSelection.getText();
+ if ( text != null ) {
+ if ( part instanceof ITextEditor ) {
+ ICElement editorElement = CDTUITools.getEditorInputCElement( ((ITextEditor)part).getEditorInput() );
+ if ( editorElement instanceof ITranslationUnit ) {
+ ITranslationUnit tu = (ITranslationUnit)editorElement;
+ try {
+ if ( tu.isStructureKnown() && tu.isConsistent() ) {
+ return tu.getElementAtOffset( textSelection.getOffset() );
+ }
+ }
+ catch( CModelException exc ) {
+ // ignored on purpose
+ }
+ }
+ }
+ else {
+ IResource resource = getResource( part );
+ if ( resource instanceof IFile ) {
+ ITranslationUnit tu = getTranslationUnit( (IFile)resource );
+ if ( tu != null ) {
+ try {
+ ICElement element = tu.getElement( text.trim() );
+ if ( element == null ) {
+ element = tu.getElementAtLine( textSelection.getStartLine() );
+ }
+ return element;
+ }
+ catch( CModelException e ) {
+ }
+ }
+ }
+ }
+ }
+ }
+ else if ( selection instanceof IStructuredSelection ) {
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ if ( ss.size() == 1 ) {
+ Object object = ss.getFirstElement();
+ if ( object instanceof ICElement ) {
+ return (ICElement)object;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the variable object at the given selection.
+ * Returns the C model element at the given selection.
+ * @param part Workbench part where the selection is.
+ * @param selection Selection in part.
+ * @return C model variable, if found.
+ */
+ protected IVariable getVariableFromSelection( IWorkbenchPart part, ISelection selection ) {
+ ICElement element = getCElementFromSelection( part, selection );
+ if ( element instanceof IVariable ) {
+ return (IVariable)element;
+ }
+ return null;
+ }
+
+ /**
+ * Reports the given error message to the user.
+ * @param message Message to report.
+ * @param part Workbench part where action was invoked.
+ */
+ protected void report( String message, IWorkbenchPart part ) {
+ IEditorStatusLine statusLine = (IEditorStatusLine)part.getAdapter( IEditorStatusLine.class );
+ if ( statusLine != null ) {
+ if ( message != null ) {
+ statusLine.setMessage( true, message, null );
+ }
+ else {
+ statusLine.setMessage( true, null, null );
+ }
+ }
+ if ( message != null && CDebugUIPlugin.getActiveWorkbenchShell() != null ) {
+ CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
+ }
+ }
+
+ /**
+ * Returns the resource being edited in the given workbench part.
+ * @param part Workbench part to checm.
+ * @return Resource being edited.
+ */
+ protected static IResource getResource( IWorkbenchPart part ) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if ( part instanceof IEditorPart ) {
+ IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
+ IResource resource = null;
+ if ( editorInput instanceof IFileEditorInput ) {
+ resource = ((IFileEditorInput)editorInput).getFile();
+ }
+ else if ( editorInput instanceof ExternalEditorInput ) {
+ resource = ((ExternalEditorInput)editorInput).getMarkerResource();
+ }
+ if ( resource != null )
+ return resource;
+ /* This file is not in a project, let default case handle it */
+ ILocationProvider provider = (ILocationProvider)editorInput.getAdapter( ILocationProvider.class );
+ if ( provider != null ) {
+ IPath location = provider.getPath( editorInput );
+ if ( location != null ) {
+ IFile[] files = root.findFilesForLocationURI( URIUtil.toURI( location ) );
+ if ( files.length > 0 && files[0].isAccessible())
+ return files[0];
+ }
+ }
+ }
+ return root;
+ }
+
+ private String getSourceHandle( IEditorInput input ) throws CoreException {
+ return CDebugUIUtils.getEditorFilePath( input );
+ }
+
+ protected String getSourceHandle( IDeclaration declaration ) {
+ ITranslationUnit tu = declaration.getTranslationUnit();
+ if ( tu != null ) {
+ IPath location = tu.getLocation();
+ if ( location != null ) {
+ return location.toOSString();
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ protected IResource getElementResource( IDeclaration declaration ) {
+ return declaration.getUnderlyingResource();
+ }
+
+ private String getFunctionName( IFunction function ) {
+ String functionName = function.getElementName();
+ StringBuffer name = new StringBuffer( functionName );
+ ITranslationUnit tu = function.getTranslationUnit();
+ if ( tu != null && tu.isCXXLanguage() ) {
+ appendParameters( name, function );
+ }
+ return name.toString();
+ }
+
+ private String getMethodName( IMethod method ) {
+ StringBuffer name = new StringBuffer();
+ String methodName = method.getElementName();
+ ICElement parent = method.getParent();
+ while( parent != null
+ && (parent.getElementType() == ICElement.C_NAMESPACE || parent.getElementType() == ICElement.C_CLASS
+ || parent.getElementType() == ICElement.C_STRUCT || parent.getElementType() == ICElement.C_UNION) ) {
+ name.append( parent.getElementName() ).append( "::" ); //$NON-NLS-1$
+ parent = parent.getParent();
+ }
+ name.append( methodName );
+ appendParameters( name, method );
+ return name.toString();
+ }
+
+ private void appendParameters( StringBuffer sb, IFunctionDeclaration fd ) {
+ String[] params = fd.getParameterTypes();
+ sb.append( '(' );
+ for( int i = 0; i < params.length; ++i ) {
+ sb.append( params[i] );
+ if ( i != params.length - 1 )
+ sb.append( ',' );
+ }
+ sb.append( ')' );
+ }
+
+ private String getVariableName( IVariable variable ) {
+ return variable.getElementName();
+ }
+
+ private ITranslationUnit getTranslationUnit( IFile file ) {
+ Object element = CoreModel.getDefault().create( file );
+ if ( element instanceof ITranslationUnit ) {
+ return (ITranslationUnit)element;
+ }
+ return null;
+ }
+
+ private boolean toggleBreakpointEnable(IWorkbenchPart part) {
+ ITextEditor textEditor = getTextEditor(part);
+ if(textEditor != null) {
+ IVerticalRulerInfo info = (IVerticalRulerInfo) textEditor.getAdapter(IVerticalRulerInfo.class);
+ if(info != null) {
+ EnableDisableBreakpointRulerAction enableAction = new EnableDisableBreakpointRulerAction(part, info);
+ enableAction.update();
+ enableAction.run();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the text editor associated with the given part or <code>null</code>
+ * if none. In case of a multi-page editor, this method should be used to retrieve
+ * the correct editor to perform the breakpoint operation on.
+ *
+ * @param part workbench part
+ * @return text editor part or <code>null</code>
+ */
+ protected ITextEditor getTextEditor(IWorkbenchPart part) {
+ if (part instanceof ITextEditor) {
+ return (ITextEditor) part;
+ }
+ return (ITextEditor) part.getAdapter(ITextEditor.class);
+ }
+
+ /**
+ * Resolves the {@link IBreakpoint} from the given editor and ruler information. Returns <code>null</code>
+ * if no breakpoint exists or the operation fails.
+ *
+ * @param editor the editor
+ * @param info the current ruler information
+ * @return the {@link IBreakpoint} from the current editor position or <code>null</code>
+ */
+ protected IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
+ IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
+ IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ if (annotationModel != null) {
+ @SuppressWarnings("unchecked")
+ Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object instanceof SimpleMarkerAnnotation) {
+ SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
+ IMarker marker = markerAnnotation.getMarker();
+ try {
+ if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
+ Position position = annotationModel.getPosition(markerAnnotation);
+ int line = document.getLineOfOffset(position.getOffset());
+ if (line == info.getLineOfLastMouseButtonActivity()) {
+ IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+ if (breakpoint != null) {
+ return breakpoint;
+ }
+ }
+ }
+ } catch (CoreException e) {
+ } catch (BadLocationException e) {
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Opens the properties dialog for the given breakpoint. This method can be
+ * used on an existing breakpoint or on a blank breakpoint which doesn't
+ * have an associated marker yet.
+ *
+ * @param bp
+ * The breakpoint to edit. This breakpoint may not have an
+ * associated marker yet.
+ * @param part
+ * Workbench part where the action was invoked.
+ * @param resource
+ * Workbench resource to create the breakpoint on.
+ * @param attributes
+ * Breakpoint attributes to show in properties dialog. If the
+ * breakpoint already exists, this attribute map can be used to
+ * override the attributes currently in the breakpoint. Can be
+ * <code>null</code>.
+ */
+ protected void openBreakpointPropertiesDialog(ICBreakpoint bp, IWorkbenchPart part, IResource resource,
+ Map<String, Object> attributes) {
+ ISelection debugContext = DebugUITools.getDebugContextManager()
+ .getContextService(part.getSite().getWorkbenchWindow()).getActiveContext(part.getSite().getId());
+ CBreakpointContext bpContext = new CBreakpointContext(bp, debugContext, resource, attributes);
+
+ PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(part.getSite().getShell(), bpContext, null,
+ null, null);
+ if (dialog != null) {
+ dialog.open();
+ }
+ }
+
+ /**
+ * Finds the line breakpoint at the given location.
+ *
+ * @param sourceHandle
+ * Source handle for the line breakpoint.
+ * @param resource
+ * Resource of the line breakpoint.
+ * @param lineNumber
+ * Line number.
+ * @return Line breakpoint with given parameters, if found.
+ * @throws CoreException
+ * Exception thrown while reading breakpoints' properties.
+ */
+ protected abstract ICLineBreakpoint findLineBreakpoint(String sourceHandle, IResource resource, int lineNumber)
+ throws CoreException;
+
+ /**
+ * Creates a line breakpoint at the given location.
+ * @param interactive true if action should open a dialog to let user edit
+ * breakpoint properties prior to creation.
+ * @param part Workbench part where action was invoked.
+ * @param source Handle Source handle for the new breakpoint.
+ * @param resource Resource to create breakpoint on.
+ * @param lineNumber Line number for new breakpoint.
+ * @throws CoreException Exception while creating breakpoint.
+ */
+ protected abstract void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
+ IResource resource, int lineNumber) throws CoreException;
+
+ /**
+ * Finds the function breakpoint at the given location.
+ *
+ * @param sourceHandle
+ * Source handle for the line breakpoint.
+ * @param resource
+ * Resource of the line breakpoint.
+ * @param functionName
+ * Function for the breakpoint.
+ * @return Function breakpoint with given parameters, if found.
+ * @throws CoreException
+ * Exception thrown while reading breakpoints' properties.
+ */
+ protected abstract ICFunctionBreakpoint findFunctionBreakpoint(String sourceHandle, IResource resource,
+ String functionName) throws CoreException;
+
+ /**
+ * Creates a function breakpoint at the given location.
+ * @param interactive true if action should open a dialog to let user edit
+ * breakpoint properties prior to creation.
+ * @param part Workbench part where action was invoked.
+ * @param source Handle Source handle for the new breakpoint.
+ * @param resource Resource to create breakpoint on.
+ * @param charStart Beginning of range where function is located. Can be
+ * -1 if not known.
+ * @param charStart End of range where function is located. Can be
+ * -1 if not known.
+ * @param lineNumber Line number where the function is located.
+ * @throws CoreException Exception while creating breakpoint.
+ */
+ protected abstract void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
+ IResource resource, String functionName, int charStart, int charEnd, int lineNumber) throws CoreException;
+
+ /**
+ * Finds the watchpoint with given expression.
+ *
+ * @param sourceHandle Source handle for the line breakpoint.
+ * @param resource Resource of the line breakpoint.
+ * @param expression Expression of the breakpoint.
+ * @return Watchpoing with given parameters, if found.
+ * @throws CoreException Exception thrown while reading breakpoints'
+ */
+ protected abstract ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression )
+ throws CoreException;
+
+ /**
+ * Creates a watchpoint at the given location.
+ * @param interactive true if action should open a dialog to let user edit
+ * breakpoint properties prior to creation.
+ * @param part Workbench part where action was invoked.
+ * @param source Handle Source handle for the new breakpoint.
+ * @param resource Resource to create breakpoint on.
+ * @param charStart Beginning of range where variable is located. Can be
+ * -1 if not known.
+ * @param charStart End of range where variable is located. Can be
+ * -1 if not known.
+ * @param lineNumber Line number where the variable is located.
+ * @throws CoreException Exception while creating breakpoint.
+ */
+ protected abstract void createWatchpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
+ IResource resource, int charStart, int charEnd, int lineNumber, String expression) throws CoreException;
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointPropertyDialogAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointPropertyDialogAction.java
new file mode 100644
index 00000000000..16883079cf1
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointPropertyDialogAction.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *******************************************************************************/
+package org.eclipse.cdt.debug.ui.breakpoints;
+
+import java.util.Iterator;
+
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.ui.contexts.IDebugContextProvider;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.SelectionProviderAction;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
+import org.eclipse.ui.internal.WorkbenchMessages;
+
+/**
+ * Action for opening a Property Pages Dialog on the C breakpoint object
+ * in the currently selected element.
+ * <p>
+ * Generally speaking, this action is useful in pop-up menus because it allows
+ * the user to browse and change properties of selected elements. When
+ * performed, the action will bring up a Property Pages Dialog containing
+ * property pages registered with the workbench for elements of the selected
+ * type.
+ * </p>
+ * <p>
+ * Although the action is capable of calculating if there are any applicable
+ * pages for the current selection, this calculation is costly because it
+ * require searching the workbench registry. Where performance is critical, the
+ * action can simply be added to the pop-up menu. In the event of no applicable
+ * pages, the action will just open an appropriate message dialog.
+ * </p>
+ * @noextend This class is not intended to be subclassed by clients.
+ * @since 7.2
+ */
+public class CBreakpointPropertyDialogAction extends SelectionProviderAction {
+
+ /**
+ * Provides the shell in which to open the property dialog.
+ */
+ private IShellProvider fShellProvider;
+
+ private IDebugContextProvider fDebugContextProvider;
+
+ /**
+ * The id of the page to open up on.
+ */
+ private String fInitialPageId = "org.eclipse.cdt.debug.ui.propertypages.breakpoint.common"; //$NON-NLS-1$
+
+ public CBreakpointPropertyDialogAction(IShellProvider shell, ISelectionProvider selectionProvider, IDebugContextProvider debugContextProvider) {
+ super(selectionProvider, WorkbenchMessages.PropertyDialog_text);
+ Assert.isNotNull(shell);
+ fDebugContextProvider = debugContextProvider;
+ fShellProvider = shell;
+ setToolTipText(WorkbenchMessages.PropertyDialog_toolTip);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+ IWorkbenchHelpContextIds.PROPERTY_DIALOG_ACTION);
+ }
+
+ protected ISelection getDebugContext() {
+ return fDebugContextProvider.getActiveContext();
+ }
+
+ /**
+ * Returns whether this action is actually applicable to the current
+ * selection. If this action is disabled, it will return <code>false</code>
+ * without further calculation. If it is enabled, it will check with the
+ * workbench's property page manager to see if there are any property pages
+ * registered for the selected element's type.
+ * <p>
+ * This method is generally too expensive to use when updating the enabled
+ * state of the action on each selection change.
+ * </p>
+ *
+ * @return <code>true</code> if the selection is not empty and there are
+ * property pages for the selected element, and <code>false</code>
+ * otherwise
+ */
+ public boolean isCBreakpointSelection() {
+ if (!isEnabled()) {
+ return false;
+ }
+ return isApplicableForSelection(getStructuredSelection(), getDebugContext());
+ }
+
+ /**
+ * Returns whether this action is applicable to the current selection. This
+ * checks that the selection is not empty, and checks with the workbench's
+ * property page manager to see if there are any property pages registered
+ * for the selected element's type.
+ * <p>
+ * This method is generally too expensive to use when updating the enabled
+ * state of the action on each selection change.
+ * </p>
+ *
+ * @param selection
+ * The selection to test
+ * @return <code>true</code> if the selection is of not empty and there are
+ * property pages for the selected element, and <code>false</code>
+ * otherwise
+ */
+ public boolean isApplicableForSelection(IStructuredSelection selection, ISelection debugContext) {
+ return isCBreakpointSelection(selection);
+ }
+
+ /**
+ * Returns whether the given selection contains only elements of type ICBreakpoint
+ * @param selection
+ * @return
+ */
+ private boolean isCBreakpointSelection(IStructuredSelection selection) {
+ if (selection.isEmpty()) return false;
+
+ for (Iterator<?> itr = selection.iterator(); itr.hasNext();) {
+ if ( !(itr.next() instanceof ICBreakpoint) ) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ CBreakpointContext bpContext = getCBreakpointContext();
+ if (bpContext != null) {
+ PreferenceDialog dialog = createDialog(bpContext);
+
+ if (dialog != null) {
+ dialog.open();
+ }
+ }
+ }
+
+ private CBreakpointContext getCBreakpointContext() {
+ IStructuredSelection ss = getStructuredSelection();
+ if (ss.size() >= 1 && ss.getFirstElement() instanceof ICBreakpoint) {
+ return new CBreakpointContext((ICBreakpoint)ss.getFirstElement(), fDebugContextProvider.getActiveContext());
+ }
+ return null;
+ }
+
+ /**
+ * Create the dialog for the receiver. If no pages are found, an informative
+ * message dialog is presented instead.
+ *
+ * @return PreferenceDialog or <code>null</code> if no applicable pages
+ * are found.
+ */
+ protected PreferenceDialog createDialog(CBreakpointContext bpContext) {
+ IStructuredSelection ss = getStructuredSelection();
+ if (ss.isEmpty())
+ return null;
+
+ return PreferencesUtil.createPropertyDialogOn(fShellProvider.getShell(), bpContext, fInitialPageId, null, null);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void selectionChanged(IStructuredSelection selection) {
+ setEnabled(!selection.isEmpty());
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
index fb5ad942b0a..9631e55c387 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 QNX Software Systems and others.
+ * Copyright (c) 2008, 2012 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
@@ -13,8 +13,10 @@
package org.eclipse.cdt.debug.ui.breakpoints;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Map;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.IMarker;
@@ -40,23 +42,60 @@ public class CBreakpointUIContributionFactory {
}
/**
+ * Calculates the breakpoint contributions for the given breakpoint.
*
- * @param breakpoint
+ * @param breakpoint Breakpoint to find UI contributions for.
* @return non-null array of ICBreakpointsUIContribution
- * @throws CoreException
- * @throws CoreException if cannot get marker attributes from berakpoint
+ * @throws CoreException if cannot get marker attributes from bearkpoint
*/
-
public ICBreakpointsUIContribution[] getBreakpointUIContributions(IBreakpoint breakpoint) throws CoreException {
String debugModelId = breakpoint.getModelIdentifier();
IMarker bmarker = breakpoint.getMarker();
- Map attributes = bmarker.getAttributes();
- String markerType = bmarker.getType();
+ Map<String, Object> attributes = Collections.emptyMap();
+ String markerType = CDIDebugModel.calculateMarkerType(breakpoint);
+ if (bmarker != null) {
+ Map<String, Object> _attributes = bmarker.getAttributes();
+ attributes = _attributes;
+ markerType = bmarker.getType();
+ }
return getBreakpointUIContributions(debugModelId, markerType, attributes);
}
+ /**
+ * Calculates the breakpoint contributions for the given breakpoint.
+ *
+ * @param breakpoint Breakpoint to find UI contributions for.
+ * @param attributes Attributes of the breakpoint
+ * @return non-null array of ICBreakpointsUIContribution
+ * @throws CoreException if cannot get marker attributes from bearkpoint
+ * @since 7.2
+ */
+ public ICBreakpointsUIContribution[] getBreakpointUIContributions(IBreakpoint breakpoint,
+ Map<String, Object> attributes)
+ throws CoreException
+ {
+ String debugModelId = breakpoint.getModelIdentifier();
+ IMarker bmarker = breakpoint.getMarker();
+ String markerType = CDIDebugModel.calculateMarkerType(breakpoint);
+ if (bmarker != null) {
+ markerType = bmarker.getType();
+ }
+ return getBreakpointUIContributions(debugModelId, markerType, attributes);
+ }
+
+ /**
+ * Calculates the breakpoint UI contributions for the given breakpoint.
+ *
+ * @param breakpoint Breakpoint to find UI contributions for.
+ * @param markerType Marker type of the breakpoint.
+ * @param attributes Attributes of the breakpoint
+ * @return non-null array of ICBreakpointsUIContribution
+ * @throws CoreException
+ * @throws CoreException if cannot get marker attributes from berakpoint
+ */
public ICBreakpointsUIContribution[] getBreakpointUIContributions(String debugModelId, String markerType,
- Map attributes) {
+ Map<String, Object> attributes)
+ {
ArrayList<ICBreakpointsUIContribution> list = new ArrayList<ICBreakpointsUIContribution>();
for (ICBreakpointsUIContribution con : contributions) {
try {
@@ -185,9 +224,9 @@ public class CBreakpointUIContributionFactory {
String elementValue = configurationElement.getAttribute(name);
if (elementValue == null)
CDebugUIPlugin.log(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(),
- DebugPlugin.INTERNAL_ERROR, "Extension "
+ DebugPlugin.INTERNAL_ERROR, "Extension " //$NON-NLS-1$
+ configurationElement.getDeclaringExtension().getUniqueIdentifier()
- + " missing required attribute: " + name, null));
+ + " missing required attribute: " + name, null)); //$NON-NLS-1$
return elementValue;
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java
new file mode 100644
index 00000000000..8527732e80b
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *******************************************************************************/
+package org.eclipse.cdt.debug.ui.breakpoints;
+
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.debug.ui.contexts.IDebugContextProvider;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Input for the breakpoint properties dialog. It captures both the
+ * selected breakpoint object as well as the selected debug context.
+ * This combined context can then be used by breakpoint property
+ * pages to access model and target specific breakpoint settings.
+ *
+ * @since 7.2
+ */
+public interface ICBreakpointContext extends IDebugContextProvider {
+
+ /**
+ * Returns the breakpoint object that this context represents.
+ * <p>
+ * Note: The returned breakpoint may not yet have an associated marker.
+ * This is for the case where the property dialog is opened for a breakpoint
+ * that is yet to be created.
+ *
+ * @return Breakpoint object.
+ */
+ public ICBreakpoint getBreakpoint();
+
+ /**
+ * Resource object that the breakpoint marker is on. In case where
+ * the breakpoint marker is not yet created, clients can access the intended
+ * breakpoint resource object through this method.
+ *
+ * @return The breakpoint's resource object.
+ */
+ public IResource getResource();
+
+ /**
+ * Returns the preference store to be used by property pages. This
+ * preference overrides values in the breakpoint marker.
+ * @return Preference store for the property pages.
+ */
+ public IPreferenceStore getPreferenceStore();
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java
index 311b325fe56..a0a5aaf2c9a 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 QNX Software Systems and others.
+ * Copyright (c) 2008, 2012 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
@@ -82,5 +82,5 @@ public interface ICBreakpointsUIContribution {
* @param map - contains pairs of attribute=value for other breakpoint attributes
* @return
*/
- public boolean isApplicable(Map map);
+ public boolean isApplicable(Map<String, Object> map);
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java
new file mode 100644
index 00000000000..ed7fa04d634
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *******************************************************************************/
+package org.eclipse.cdt.debug.ui.breakpoints;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Second extension interface for {@link org.eclipse.debug.ui.actions.IToggleBreakpointsTarget}.
+ * This interface provides the ability open edit a breakpoint's properties and
+ * to create a breakpoint in the given context with additional user input
+ * (such as using a dialog or a wizard).
+ * <p>
+ * Clients implementing <code>IToggleBreakpointsTarget</code> may optionally
+ * implement this interface.
+ * </p>
+ * @since 7.2
+ * @see org.eclipse.debug.ui.actions.ToggleBreakpointAction
+ */
+public interface IToggleBreakpointsTargetCExtension extends IToggleBreakpointsTargetExtension {
+
+ /**
+ * Returns whether the toggle target can create a line breakpoint at the
+ * given location. If the implementation does not support creating the
+ * breakpoint interactively then it should return <code>false</code>.
+ * <p>
+ * The selection varies depending on the given part. For example,
+ * a text selection is provided for text editors, and a structured
+ * selection is provided for tree views, and may be a multi-selection.
+ * </p>
+ * @param part the part on which the action has been invoked
+ * @param selection selection on which line breakpoints should be toggled
+ * @return Returns <code>true</code> if toggle target is able interactively
+ * create a breakpoint(s) at the given location.
+ */
+ public boolean canCreateLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection);
+
+ /**
+ * Creates new line breakpoints interactively. The implementation should
+ * allows the user to edit all of the breakpoint's settings prior to
+ * creating the breakpoint. Unlike the
+ * {@link #toggleLineBreakpoints(IWorkbenchPart, ISelection)}
+ * method, this method does not remove the existing breakpoint at given
+ * location. It always creates a new breakpoint
+ * <p>
+ * The selection varies depending on the given part. For example,
+ * a text selection is provided for text editors, and a structured
+ * selection is provided for tree views, and may be a multi-selection.
+ * </p>
+ * @param part the part on which the action has been invoked
+ * @param selection selection on which line breakpoints should be toggled
+ * @throws CoreException if unable to perform the action
+ */
+ public void createLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
+
+ /**
+ * Returns whether the toggle target can create a watchpoint at the
+ * given location. If the implementation does not support creating the
+ * breakpoint interactively then it should return <code>false</code>.
+ * <p>
+ * The selection varies depending on the given part. For example,
+ * a text selection is provided for text editors, and a structured
+ * selection is provided for tree views, and may be a multi-selection.
+ * </p>
+ * @param part the part on which the action has been invoked
+ * @param selection selection on which line breakpoints should be toggled
+ * @return Returns <code>true</code> if toggle target is able interactively
+ * create a breakpoint(s) at the given location.
+ */
+ public boolean canCreateWatchpointsInteractive(IWorkbenchPart part, ISelection selection);
+
+ /**
+ * Creates new watchpoint interactively. The implementation should
+ * allows the user to edit all of the breakpoint's settings prior to
+ * creating the breakpoint. Unlike the
+ * {@link #toggleLineBreakpoints(IWorkbenchPart, ISelection)}
+ * method, this method does not remove the existing breakpoint at given
+ * location. It always creates a new breakpoint
+ * <p>
+ * The selection varies depending on the given part. For example,
+ * a text selection is provided for text editors, and a structured
+ * selection is provided for tree views, and may be a multi-selection.
+ * </p>
+ * @param part the part on which the action has been invoked
+ * @param selection selection on which line breakpoints should be toggled
+ * @throws CoreException if unable to perform the action
+ */
+ public void createWatchpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
+
+ /**
+ * Returns whether the toggle target can create a function breakpoint at the
+ * given location. If the implementation does not support creating the
+ * breakpoint interactively then it should return <code>false</code>.
+ * <p>
+ * The selection varies depending on the given part. For example,
+ * a text selection is provided for text editors, and a structured
+ * selection is provided for tree views, and may be a multi-selection.
+ * </p>
+ * @param part the part on which the action has been invoked
+ * @param selection selection on which line breakpoints should be toggled
+ * @return Returns <code>true</code> if toggle target is able interactively
+ * create a breakpoint(s) at the given location.
+ */
+ public boolean canCreateFunctionBreakpointInteractive(IWorkbenchPart part, ISelection selection);
+
+ /**
+ * Creates new function breakpoint interactively. The implementation should
+ * allows the user to edit all of the breakpoint's settings prior to
+ * creating the breakpoint. Unlike the
+ * {@link #toggleLineBreakpoints(IWorkbenchPart, ISelection)}
+ * method, this method does not remove the existing breakpoint at given
+ * location. It always creates a new breakpoint
+ * <p>
+ * The selection varies depending on the given part. For example,
+ * a text selection is provided for text editors, and a structured
+ * selection is provided for tree views, and may be a multi-selection.
+ * </p>
+ * @param part the part on which the action has been invoked
+ * @param selection selection on which line breakpoints should be toggled
+ * @throws CoreException if unable to perform the action
+ */
+ public void createFunctionBreakpointInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java
index 5b6f2615ec3..85ffee374e6 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java
@@ -75,11 +75,22 @@ public class ReadOnlyFieldEditor extends FieldEditor implements ICBreakpointsUIC
if (textField != null) {
String value = getPreferenceStore().getString(getPreferenceName());
if (contribution!=null) {
+ if ("integer".equals (contribution.getType())) { //$NON-NLS-1$
+ value = Integer.toString( getPreferenceStore().getInt(getPreferenceName()) );
+ } else if ("boolean".equals (contribution.getType()) ) {//$NON-NLS-1$
+ value = Boolean.toString( getPreferenceStore().getBoolean(getPreferenceName()) );
+ } else if ("float".equals (contribution.getType()) ) {//$NON-NLS-1$
+ value = Float.toString( getPreferenceStore().getFloat(getPreferenceName()) );
+ } else if ("double".equals (contribution.getType()) ) {//$NON-NLS-1$
+ value = Double.toString( getPreferenceStore().getDouble(getPreferenceName()) );
+ }
String tryValue = contribution.getLabelForValue(value);
if (tryValue!=null)
value = tryValue;
}
- textField.setText(value);
+ if (value != null) {
+ textField.setText(value);
+ }
}
}

Back to the top