(10);
+ setAddressBreakpointAttributes(attributes, module, sourceHandle, type, lineNumber, address, enabled,
+ ignoreCount, condition);
+ return new CAddressBreakpoint(resource, attributes, register);
+ }
- /**
- * 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 null
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;
- }
+ /**
+ * Creates a breakpoint without associated marker.
+ *
+ * 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();
+ }
- /**
- * @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 );
- }
+ /**
+ * @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 attributes = new HashMap(10);
+ setAddressBreakpointAttributes(attributes, module, sourceHandle, type, lineNumber, address, enabled,
+ ignoreCount, condition);
+ return new CAddressTracepoint(resource, attributes, register);
+ }
- /**
- * @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 );
- }
+ /**
+ * Creates a breakpoint without associated marker.
+ *
+ * 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();
+ }
- /**
- * @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 );
- }
+ /**
+ * 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 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);
+ }
- 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$
- }
+ /**
+ * Creates a breakpoint without associated marker.
+ *
+ * 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();
+ }
- 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];
+ /**
+ * 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:
+ *
+ * - Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.
+ *
+ */
+ 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 attributes = new HashMap(10);
+ setWatchPointAttributes(attributes, sourceHandle, resource, writeAccess, readAccess, expression, "", //$NON-NLS-1$
+ BigInteger.ZERO, enabled, ignoreCount, condition);
+ return new CWatchpoint(resource, attributes, register);
+ }
- 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;
- }
+ /**
+ * 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:
+ *
+ * - Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.
+ *
+ */
+ 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 attributes = new HashMap(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);
+ }
- }
- return null;
- }
- public static ICEventBreakpoint createEventBreakpoint(String type, String arg, boolean register)
- throws CoreException {
- final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- final Map attributes = new HashMap();
- 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);
+ /**
+ * 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:
+ *
+ * - Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.
+ *
+ */
+ 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 attributes = new HashMap(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 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:
+ *
+ * - Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.
+ *
+ * @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:
+ *
+ * - Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.
+ *
+ */
+ 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 attributes = new HashMap(10);
+ setFunctionBreakpointAttributes(attributes, sourceHandle, type, function, charStart, charEnd, lineNumber,
+ enabled, ignoreCount, condition);
+ return new CFunctionBreakpoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ *
+ * 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:
+ *
+ * - Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.
+ *
+ * @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 attributes = new HashMap(10);
+ setFunctionBreakpointAttributes(attributes, sourceHandle, type, function, charStart, charEnd, lineNumber,
+ enabled, ignoreCount, condition);
+ return new CFunctionTracepoint(resource, attributes, register);
+ }
+
+ /**
+ * Creates a breakpoint without associated marker.
+ *
+ * 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 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 null
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 null
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 null
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:
+ *
+ * - Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.
+ *
+ */
+ public static ICEventBreakpoint createEventBreakpoint(String type, String arg, boolean register)
+ throws CoreException {
+ final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
+ final Map attributes = new HashMap();
+ 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 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.
+ *
+ * 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 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 "org.eclipse.cdt.debug.core.function"
).
@@ -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
* "org.eclipse.cdt.debug.core.passCount"
). 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 "org.eclipse.cdt.debug.core.expression"
).
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 attributes, boolean add ) throws CoreException {
- super( resource, markerType, attributes, add );
+ public AbstractLineBreakpoint( IResource resource, Map 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 attributes, boolean add ) throws CoreException {
- super( resource, markerType, attributes, add );
+ public AbstractTracepoint( IResource resource, Map 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 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 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 attributes, final boolean add ) throws CoreException {
+ public CBreakpoint( final IResource resource, final Map 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 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 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 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 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 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 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 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 attributes, boolean add ) throws CoreException {
- super( resource, getMarkerType(), attributes, add );
+ super( resource, attributes, add );
}
- protected CWatchpoint( IResource resource, String marker, Map 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
@@ -415,27 +415,27 @@
-
-
+
+
+
+
@@ -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">
+
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -1296,7 +1322,7 @@
@@ -1736,6 +1762,18 @@
+
+
+
+
@@ -1766,14 +1804,14 @@
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.ToggleCBreakpointsTargetFactory">
@@ -1802,7 +1840,7 @@
+ class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.ToggleCTracepointsTargetFactory">
@@ -2093,7 +2131,7 @@
point="org.eclipse.ui.commands">
+
+
+
+
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.
- Type of the attribute: boolean, string, integer
+ Type of the attribute. Value should be one of "boolean", "string", "integer", "float".
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 null
+ * 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 null
+ */
+ 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 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/AddWatchpointDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java
index 8d6bab94516..f7c4231a94e 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/AddWatchpointDialog.java
@@ -1,437 +1,29 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008, 2008 QNX Software Systems and others.
+ * 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:
- * QNX Software Systems - Initial API and implementation
- * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
- * IBM Corporation
+ * Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
/**
- * The "Add Watchpoint" dialog of the "Toggle watchpoint" action.
+ * This class was moved to the org.eclipse.cdt.debug.internal.ui.actions.breakpoints
+ * package. This class is left here for backward compatibility for extenders that
+ * reference this internal class (see Bug 374983).
+ *
+ * @deprecated Replaced by opening a properties dialog on a new breakpoint.
*/
-public class AddWatchpointDialog extends Dialog implements ModifyListener, SelectionListener {
-
- private Combo fExpressionInput;
- private String fExpression;
- private static List sExpressionHistory = new ArrayList();
-
- private boolean fHasMemorySpaceControls;
- private Button fMemorySpaceEnableButton;
- private Combo fMemorySpaceInput;
- private String fMemorySpace;
-
- private boolean fRangeInitialEnable;
- private Button fRangeEnableButton;
- private Text fRangeField;
- private String fRange = ""; //$NON-NLS-1$
-
- private Button fChkBtnWrite;
- private Button fChkBtnRead;
- private boolean fRead;
- private boolean fWrite;
-
- private ICDIMemorySpaceManagement fMemManagement;
-
-
- /**
- * Constructor for AddWatchpointDialog.
- *
- * @param parentShell
- */
- public AddWatchpointDialog( Shell parentShell, ICDIMemorySpaceManagement memMgmt ) {
- super( parentShell );
- setShellStyle( getShellStyle() | SWT.RESIZE );
- fMemManagement = memMgmt;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createDialogArea( Composite parent ) {
- // The button bar will work better if we make the parent composite
- // a single column grid layout. For the widgets we add, we want a
- // a two-column grid, so we just create a sub composite for that.
- GridLayout gridLayout = new GridLayout();
- parent.setLayout( gridLayout );
- GridData gridData = new GridData( GridData.FILL_BOTH );
- parent.setLayoutData( gridData );
- Composite composite = new Composite( parent, SWT.None );
- gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- composite.setLayout( gridLayout );
- parent = composite;
-
- // Create the controls
- createExpressionControl( parent );
- boolean hasDebugContext = DebugUITools.getDebugContext() != null;
- boolean hasMemorySpaces = hasDebugContext && fMemManagement != null && fMemManagement.getMemorySpaces() != null && fMemManagement.getMemorySpaces().length > 0;
- fHasMemorySpaceControls = !hasDebugContext || hasMemorySpaces;
- if ( fHasMemorySpaceControls ) {
- createMemorySpaceControl( parent, hasMemorySpaces );
- }
- createCountField( parent );
- createAccessWidgets( parent );
-
- // Initialize the inter-control state
- if ( fExpression != null && fExpression.length() > 0 ) {
- fExpressionInput.add( fExpression, 0 );
- fExpressionInput.select( 0 );
- }
- fExpressionInput.setFocus();
- if ( fHasMemorySpaceControls ) {
- fMemorySpaceInput.setEnabled( fMemorySpaceEnableButton.getEnabled() );
- }
- fRangeField.setEnabled( fRangeEnableButton.getEnabled() );
- updateUI();
- return parent;
- }
-
- private void createExpressionControl(Composite parent ) {
-
- Label l = new Label( parent, GridData.FILL_HORIZONTAL );
- l.setText( ActionMessages.getString( "AddWatchpointDialog.1" ) ); //$NON-NLS-1$
- GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 2;
- l.setLayoutData( gridData );
-
- fExpressionInput = new Combo( parent, SWT.BORDER );
- gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 2;
- fExpressionInput.setLayoutData( gridData );
- fExpressionInput.addModifyListener( this );
- for (String expression : sExpressionHistory) {
- fExpressionInput.add( expression );
- }
- }
-
- private void createMemorySpaceControl( Composite parent, boolean hasMemorySpaces ) {
- fMemorySpaceEnableButton = new Button( parent, SWT.CHECK );
- GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 1;
- fMemorySpaceEnableButton.setLayoutData( gridData );
- fMemorySpaceEnableButton.setText( ActionMessages.getString( "AddWatchpointDialog.5" ) ); //$NON-NLS-1$
- fMemorySpaceEnableButton.setSelection( false );
- fMemorySpaceEnableButton.addSelectionListener( this );
-
- if ( hasMemorySpaces ) {
- fMemorySpaceInput = new Combo( parent, SWT.BORDER | SWT.READ_ONLY );
- } else {
- fMemorySpaceInput = new Combo( parent, SWT.BORDER );
- }
- gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 1;
- fMemorySpaceInput.setLayoutData( gridData );
- fMemorySpaceInput.addSelectionListener( this );
- if ( fMemManagement != null ) {
- String [] memorySpaces = fMemManagement.getMemorySpaces();
- for ( int i = 0; i < memorySpaces.length; i++ ) {
- fMemorySpaceInput.add( memorySpaces[i] );
- }
- }
- if ( fMemorySpace != null && fMemorySpace.length() > 0 ) {
- int i = fMemorySpaceInput.indexOf( fMemorySpace );
- if ( i >= 0 ) {
- fMemorySpaceInput.select( i );
- fMemorySpaceEnableButton.setSelection( true );
- } else {
- fMemorySpaceInput.add( fMemorySpace );
- }
- }
- fMemorySpaceInput.addModifyListener( this );
- //234909 - for accessibility
- fMemorySpaceInput.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = ActionMessages.getString( "AddWatchpointDialog.5" ); //$NON-NLS-1$
- }
-
- });
- }
-
- /**
- * @param text
- * @param c
- * @return true if the concatenation of text + c results
- * in a valid string representation of an integer
- * @see verifyIntegerText()
- */
- private static boolean verifyIntegerTextAddition( String text, char c ) {
-
- // pass through all control characters
- if ( Character.isISOControl( c ) ) {
- return true;
- }
-
- // case-insensitive
- c = Character.toLowerCase( c );
- text = text.toLowerCase();
-
- // first character has to be 0-9
- if ( text.length() == 0 ) {
- return Character.isDigit( c );
- }
-
- // second character must be x if preceded by a 0, otherwise 0-9 will do
- if ( text.length() == 1 ) {
- if ( text.equals( "0" ) ) { //$NON-NLS-1$
- return c == 'x';
- }
- return Character.isDigit( c );
- }
-
- // all subsequent characters must be 0-9 or a-f if started with 0x
- return Character.isDigit( c )
- || text.startsWith( "0x" ) && 'a' <= c && c <= 'f'; //$NON-NLS-1$
- }
-
- /**
- * @param text integer string built up using verifyIntegerTextAddition()
- * @return true if text represents a valid string representation of
- * an integer
- */
- private static boolean verifyIntegerText( String text ) {
- if ( text.length() == 0 ) {
- return false;
- }
- if ( text.length() == 1 ) {
- return true;
- }
- if ( text.length() == 2 ) {
- return !text.equals("0x"); //$NON-NLS-1$
- }
- return true;
- }
-
- private void createCountField( Composite parent ) {
- fRangeEnableButton = new Button( parent, SWT.CHECK );
- GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 1;
- fRangeEnableButton.setLayoutData( gridData );
- fRangeEnableButton.setText( ActionMessages.getString( "AddWatchpointDialog.6" ) ); //$NON-NLS-1$
- fRangeEnableButton.setSelection( fRangeInitialEnable && fRange.length() > 0 );
- fRangeEnableButton.addSelectionListener( this );
-
- fRangeField = new Text( parent, SWT.BORDER );
- gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 1;
- GC gc = new GC( fRangeField );
- FontMetrics fm = gc.getFontMetrics();
- gridData.minimumWidth = 8 * fm.getAverageCharWidth();
- fRangeField.setLayoutData( gridData );
- fRangeField.setText( fRange );
- fRangeField.addVerifyListener( new VerifyListener() {
- @Override
- public void verifyText( VerifyEvent e ) {
- e.doit = verifyIntegerTextAddition( fRangeField.getText(), e.character );
- }
- });
- fRangeField.addModifyListener( this );
- //234909 - for accessibility
- fRangeField.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = ActionMessages.getString( "AddWatchpointDialog.6" ); //$NON-NLS-1$
- }
-
- });
- }
-
- private void createAccessWidgets( Composite parent ) {
- GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
- gridData.horizontalSpan = 3;
-
- Group group = new Group( parent, SWT.NONE );
- group.setLayout( new GridLayout() );
- group.setLayoutData( gridData );
- group.setText( ActionMessages.getString( "AddWatchpointDialog.2" ) ); //$NON-NLS-1$
- fChkBtnWrite = new Button( group, SWT.CHECK );
- fChkBtnWrite.setText( ActionMessages.getString( "AddWatchpointDialog.3" ) ); //$NON-NLS-1$
- fChkBtnWrite.setSelection( true );
- fChkBtnWrite.addSelectionListener( this );
- fChkBtnRead = new Button( group, SWT.CHECK );
- fChkBtnRead.setText( ActionMessages.getString( "AddWatchpointDialog.4" ) ); //$NON-NLS-1$
- fChkBtnRead.setSelection( false );
- fChkBtnRead.addSelectionListener( this );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
- @Override
- protected void configureShell( Shell newShell ) {
- super.configureShell( newShell );
-
- // use the same title used by the platform dialog
- newShell.setText( ActionMessages.getString( "AddWatchpointDialog.0" ) ); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- @Override
- protected void okPressed() {
- fExpression = fExpressionInput.getText().trim();
- if ( fExpression.length() > 0 ) {
- addHistory( fExpression );
- }
- if ( fHasMemorySpaceControls ) {
- fMemorySpace = fMemorySpaceEnableButton.getSelection() ? fMemorySpaceInput.getText().trim() : ""; //$NON-NLS-1$
- }
- fRange = fRangeEnableButton.getSelection() ? fRangeField.getText().trim() : "0"; //$NON-NLS-1$
- fRead = fChkBtnRead.getSelection();
- fWrite = fChkBtnWrite.getSelection();
- super.okPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void modifyText( ModifyEvent e ) {
- updateUI();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createButtonBar( Composite parent ) {
- return super.createButtonBar( parent );
- }
-
- public String getExpression() {
- return fExpression;
- }
-
- public String getMemorySpace() {
- return fMemorySpace;
- }
-
- private static void addHistory( String item ) {
- if ( !sExpressionHistory.contains( item ) ) {
- sExpressionHistory.add( 0, item );
-
- if ( sExpressionHistory.size() > 5 )
- sExpressionHistory.remove( sExpressionHistory.size() - 1 );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetDefaultSelected( SelectionEvent e ) {
- // ignore
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected( SelectionEvent e ) {
- updateUI();
- }
-
- private void updateUI() {
- if ( fHasMemorySpaceControls ) {
- fMemorySpaceInput.setEnabled( fMemorySpaceEnableButton.getSelection() );
- }
- fRangeField.setEnabled( fRangeEnableButton.getSelection() );
- Button b = getButton( IDialogConstants.OK_ID );
- if ( b == null ) {
- return;
- }
- b.setEnabled( okayEnabled() );
- }
-
- private boolean okayEnabled() {
- if ( !fChkBtnRead.getSelection() && !fChkBtnWrite.getSelection() ) {
- return false ;
- }
- if ( fExpressionInput.getText().length() == 0 ) {
- return false;
- }
- if ( fHasMemorySpaceControls && fMemorySpaceInput.getEnabled() && fMemorySpaceInput.getText().length() == 0 ) {
- return false;
- }
- if ( fRangeField.getEnabled()
- && ( fRangeField.getText().length() == 0 || !verifyIntegerText( fRangeField.getText() ) ) ) {
- return false;
- }
- return true;
- }
-
- public boolean getWriteAccess() {
- return fWrite;
- }
-
- public boolean getReadAccess() {
- return fRead;
- }
-
- public void setExpression(String expressionString ) {
- fExpression = expressionString;
- }
-
- public BigInteger getRange() {
- return BigInteger.valueOf( Long.decode(fRange).longValue() );
- }
-
- public void initializeRange( boolean enable, String range ) {
- fRangeInitialEnable = enable;
- fRange = range;
- }
-
- public void initializeMemorySpace( String memorySpace ) {
- fMemorySpace = memorySpace;
- }
-
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- // override so we can change the initial okay enabled state
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
- true ).setEnabled( okayEnabled() );
- createButton( parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false );
- }
+public class AddWatchpointDialog extends org.eclipse.cdt.debug.internal.ui.actions.breakpoints.AddWatchpointDialog {
+ public AddWatchpointDialog( Shell parentShell, ICDIMemorySpaceManagement memMgmt ) {
+ super(parentShell, memMgmt);
+ }
+
}
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
similarity index 50%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java
rename to 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 null
*/
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
similarity index 95%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddEventBreakpointActionDelegate.java
rename to 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
similarity index 70%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointActionDelegate.java
rename to 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/breakpoints/AddWatchpointDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java
new file mode 100644
index 00000000000..8144e4d4cd4
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java
@@ -0,0 +1,439 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 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
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
+ * IBM Corporation
+ *******************************************************************************/
+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;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+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 {
+
+ private Combo fExpressionInput;
+ private String fExpression;
+ private static List sExpressionHistory = new ArrayList();
+
+ private boolean fHasMemorySpaceControls;
+ private Button fMemorySpaceEnableButton;
+ private Combo fMemorySpaceInput;
+ private String fMemorySpace;
+
+ private boolean fRangeInitialEnable;
+ private Button fRangeEnableButton;
+ private Text fRangeField;
+ private String fRange = ""; //$NON-NLS-1$
+
+ private Button fChkBtnWrite;
+ private Button fChkBtnRead;
+ private boolean fRead;
+ private boolean fWrite;
+
+ private ICDIMemorySpaceManagement fMemManagement;
+
+
+ /**
+ * Constructor for AddWatchpointDialog.
+ *
+ * @param parentShell
+ */
+ public AddWatchpointDialog( Shell parentShell, ICDIMemorySpaceManagement memMgmt ) {
+ super( parentShell );
+ setShellStyle( getShellStyle() | SWT.RESIZE );
+ fMemManagement = memMgmt;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea( Composite parent ) {
+ // The button bar will work better if we make the parent composite
+ // a single column grid layout. For the widgets we add, we want a
+ // a two-column grid, so we just create a sub composite for that.
+ GridLayout gridLayout = new GridLayout();
+ parent.setLayout( gridLayout );
+ GridData gridData = new GridData( GridData.FILL_BOTH );
+ parent.setLayoutData( gridData );
+ Composite composite = new Composite( parent, SWT.None );
+ gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout( gridLayout );
+ parent = composite;
+
+ // Create the controls
+ createExpressionControl( parent );
+ boolean hasDebugContext = DebugUITools.getDebugContext() != null;
+ boolean hasMemorySpaces = hasDebugContext && fMemManagement != null && fMemManagement.getMemorySpaces() != null && fMemManagement.getMemorySpaces().length > 0;
+ fHasMemorySpaceControls = !hasDebugContext || hasMemorySpaces;
+ if ( fHasMemorySpaceControls ) {
+ createMemorySpaceControl( parent, hasMemorySpaces );
+ }
+ createCountField( parent );
+ createAccessWidgets( parent );
+
+ // Initialize the inter-control state
+ if ( fExpression != null && fExpression.length() > 0 ) {
+ fExpressionInput.add( fExpression, 0 );
+ fExpressionInput.select( 0 );
+ }
+ fExpressionInput.setFocus();
+ if ( fHasMemorySpaceControls ) {
+ fMemorySpaceInput.setEnabled( fMemorySpaceEnableButton.getEnabled() );
+ }
+ fRangeField.setEnabled( fRangeEnableButton.getEnabled() );
+ updateUI();
+ return parent;
+ }
+
+ private void createExpressionControl(Composite parent ) {
+
+ Label l = new Label( parent, GridData.FILL_HORIZONTAL );
+ l.setText( ActionMessages.getString( "AddWatchpointDialog.1" ) ); //$NON-NLS-1$
+ GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
+ gridData.horizontalSpan = 2;
+ l.setLayoutData( gridData );
+
+ fExpressionInput = new Combo( parent, SWT.BORDER );
+ gridData = new GridData( GridData.FILL_HORIZONTAL );
+ gridData.horizontalSpan = 2;
+ fExpressionInput.setLayoutData( gridData );
+ fExpressionInput.addModifyListener( this );
+ for (String expression : sExpressionHistory) {
+ fExpressionInput.add( expression );
+ }
+ }
+
+ private void createMemorySpaceControl( Composite parent, boolean hasMemorySpaces ) {
+ fMemorySpaceEnableButton = new Button( parent, SWT.CHECK );
+ GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
+ gridData.horizontalSpan = 1;
+ fMemorySpaceEnableButton.setLayoutData( gridData );
+ fMemorySpaceEnableButton.setText( ActionMessages.getString( "AddWatchpointDialog.5" ) ); //$NON-NLS-1$
+ fMemorySpaceEnableButton.setSelection( false );
+ fMemorySpaceEnableButton.addSelectionListener( this );
+
+ if ( hasMemorySpaces ) {
+ fMemorySpaceInput = new Combo( parent, SWT.BORDER | SWT.READ_ONLY );
+ } else {
+ fMemorySpaceInput = new Combo( parent, SWT.BORDER );
+ }
+ gridData = new GridData( GridData.FILL_HORIZONTAL );
+ gridData.horizontalSpan = 1;
+ fMemorySpaceInput.setLayoutData( gridData );
+ fMemorySpaceInput.addSelectionListener( this );
+ if ( fMemManagement != null ) {
+ String [] memorySpaces = fMemManagement.getMemorySpaces();
+ for ( int i = 0; i < memorySpaces.length; i++ ) {
+ fMemorySpaceInput.add( memorySpaces[i] );
+ }
+ }
+ if ( fMemorySpace != null && fMemorySpace.length() > 0 ) {
+ int i = fMemorySpaceInput.indexOf( fMemorySpace );
+ if ( i >= 0 ) {
+ fMemorySpaceInput.select( i );
+ fMemorySpaceEnableButton.setSelection( true );
+ } else {
+ fMemorySpaceInput.add( fMemorySpace );
+ }
+ }
+ fMemorySpaceInput.addModifyListener( this );
+ //234909 - for accessibility
+ fMemorySpaceInput.getAccessible().addAccessibleListener(
+ new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = ActionMessages.getString( "AddWatchpointDialog.5" ); //$NON-NLS-1$
+ }
+
+ });
+ }
+
+ /**
+ * @param text
+ * @param c
+ * @return true if the concatenation of text + c results
+ * in a valid string representation of an integer
+ * @see verifyIntegerText()
+ */
+ private static boolean verifyIntegerTextAddition( String text, char c ) {
+
+ // pass through all control characters
+ if ( Character.isISOControl( c ) ) {
+ return true;
+ }
+
+ // case-insensitive
+ c = Character.toLowerCase( c );
+ text = text.toLowerCase();
+
+ // first character has to be 0-9
+ if ( text.length() == 0 ) {
+ return Character.isDigit( c );
+ }
+
+ // second character must be x if preceded by a 0, otherwise 0-9 will do
+ if ( text.length() == 1 ) {
+ if ( text.equals( "0" ) ) { //$NON-NLS-1$
+ return c == 'x';
+ }
+ return Character.isDigit( c );
+ }
+
+ // all subsequent characters must be 0-9 or a-f if started with 0x
+ return Character.isDigit( c )
+ || text.startsWith( "0x" ) && 'a' <= c && c <= 'f'; //$NON-NLS-1$
+ }
+
+ /**
+ * @param text integer string built up using verifyIntegerTextAddition()
+ * @return true if text represents a valid string representation of
+ * an integer
+ */
+ private static boolean verifyIntegerText( String text ) {
+ if ( text.length() == 0 ) {
+ return false;
+ }
+ if ( text.length() == 1 ) {
+ return true;
+ }
+ if ( text.length() == 2 ) {
+ return !text.equals("0x"); //$NON-NLS-1$
+ }
+ return true;
+ }
+
+ private void createCountField( Composite parent ) {
+ fRangeEnableButton = new Button( parent, SWT.CHECK );
+ GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
+ gridData.horizontalSpan = 1;
+ fRangeEnableButton.setLayoutData( gridData );
+ fRangeEnableButton.setText( ActionMessages.getString( "AddWatchpointDialog.6" ) ); //$NON-NLS-1$
+ fRangeEnableButton.setSelection( fRangeInitialEnable && fRange.length() > 0 );
+ fRangeEnableButton.addSelectionListener( this );
+
+ fRangeField = new Text( parent, SWT.BORDER );
+ gridData = new GridData( GridData.FILL_HORIZONTAL );
+ gridData.horizontalSpan = 1;
+ GC gc = new GC( fRangeField );
+ FontMetrics fm = gc.getFontMetrics();
+ gridData.minimumWidth = 8 * fm.getAverageCharWidth();
+ fRangeField.setLayoutData( gridData );
+ fRangeField.setText( fRange );
+ fRangeField.addVerifyListener( new VerifyListener() {
+ @Override
+ public void verifyText( VerifyEvent e ) {
+ e.doit = verifyIntegerTextAddition( fRangeField.getText(), e.character );
+ }
+ });
+ fRangeField.addModifyListener( this );
+ //234909 - for accessibility
+ fRangeField.getAccessible().addAccessibleListener(
+ new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = ActionMessages.getString( "AddWatchpointDialog.6" ); //$NON-NLS-1$
+ }
+
+ });
+ }
+
+ private void createAccessWidgets( Composite parent ) {
+ GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
+ gridData.horizontalSpan = 3;
+
+ Group group = new Group( parent, SWT.NONE );
+ group.setLayout( new GridLayout() );
+ group.setLayoutData( gridData );
+ group.setText( ActionMessages.getString( "AddWatchpointDialog.2" ) ); //$NON-NLS-1$
+ fChkBtnWrite = new Button( group, SWT.CHECK );
+ fChkBtnWrite.setText( ActionMessages.getString( "AddWatchpointDialog.3" ) ); //$NON-NLS-1$
+ fChkBtnWrite.setSelection( true );
+ fChkBtnWrite.addSelectionListener( this );
+ fChkBtnRead = new Button( group, SWT.CHECK );
+ fChkBtnRead.setText( ActionMessages.getString( "AddWatchpointDialog.4" ) ); //$NON-NLS-1$
+ fChkBtnRead.setSelection( false );
+ fChkBtnRead.addSelectionListener( this );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell( Shell newShell ) {
+ super.configureShell( newShell );
+
+ // use the same title used by the platform dialog
+ newShell.setText( ActionMessages.getString( "AddWatchpointDialog.0" ) ); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ fExpression = fExpressionInput.getText().trim();
+ if ( fExpression.length() > 0 ) {
+ addHistory( fExpression );
+ }
+ if ( fHasMemorySpaceControls ) {
+ fMemorySpace = fMemorySpaceEnableButton.getSelection() ? fMemorySpaceInput.getText().trim() : ""; //$NON-NLS-1$
+ }
+ fRange = fRangeEnableButton.getSelection() ? fRangeField.getText().trim() : "0"; //$NON-NLS-1$
+ fRead = fChkBtnRead.getSelection();
+ fWrite = fChkBtnWrite.getSelection();
+ super.okPressed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ @Override
+ public void modifyText( ModifyEvent e ) {
+ updateUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createButtonBar( Composite parent ) {
+ return super.createButtonBar( parent );
+ }
+
+ public String getExpression() {
+ return fExpression;
+ }
+
+ public String getMemorySpace() {
+ return fMemorySpace;
+ }
+
+ private static void addHistory( String item ) {
+ if ( !sExpressionHistory.contains( item ) ) {
+ sExpressionHistory.add( 0, item );
+
+ if ( sExpressionHistory.size() > 5 )
+ sExpressionHistory.remove( sExpressionHistory.size() - 1 );
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetDefaultSelected( SelectionEvent e ) {
+ // ignore
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected( SelectionEvent e ) {
+ updateUI();
+ }
+
+ private void updateUI() {
+ if ( fHasMemorySpaceControls ) {
+ fMemorySpaceInput.setEnabled( fMemorySpaceEnableButton.getSelection() );
+ }
+ fRangeField.setEnabled( fRangeEnableButton.getSelection() );
+ Button b = getButton( IDialogConstants.OK_ID );
+ if ( b == null ) {
+ return;
+ }
+ b.setEnabled( okayEnabled() );
+ }
+
+ private boolean okayEnabled() {
+ if ( !fChkBtnRead.getSelection() && !fChkBtnWrite.getSelection() ) {
+ return false ;
+ }
+ if ( fExpressionInput.getText().length() == 0 ) {
+ return false;
+ }
+ if ( fHasMemorySpaceControls && fMemorySpaceInput.getEnabled() && fMemorySpaceInput.getText().length() == 0 ) {
+ return false;
+ }
+ if ( fRangeField.getEnabled()
+ && ( fRangeField.getText().length() == 0 || !verifyIntegerText( fRangeField.getText() ) ) ) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean getWriteAccess() {
+ return fWrite;
+ }
+
+ public boolean getReadAccess() {
+ return fRead;
+ }
+
+ public void setExpression(String expressionString ) {
+ fExpression = expressionString;
+ }
+
+ public BigInteger getRange() {
+ return BigInteger.valueOf( Long.decode(fRange).longValue() );
+ }
+
+ public void initializeRange( boolean enable, String range ) {
+ fRangeInitialEnable = enable;
+ fRange = range;
+ }
+
+ public void initializeMemorySpace( String memorySpace ) {
+ fMemorySpace = memorySpace;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ // override so we can change the initial okay enabled state
+ createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
+ true ).setEnabled( okayEnabled() );
+ createButton( parent, IDialogConstants.CANCEL_ID,
+ IDialogConstants.CANCEL_LABEL, false );
+ }
+
+}
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
similarity index 98%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnMemoryActionDelegate.java
rename to 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
similarity index 97%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java
rename to 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
+ * IToggleBreakpointsTargetExtension2
adapter.
+ *
+ * Clients may instantiate this class.
+ *
+ * @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 IToggleBreakpointsTarget
adapter
+ * @param document the document breakpoints are being set in or
+ * null
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 null
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 editorActions
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
+ * IToggleBreakpointsTagretCExtension
to create the breakpoint.
+ *
+ * This action should be be contributed to a vertical ruler context menu via the
+ * popupMenus
extension point, by referencing the ruler's context
+ * menu identifier in the targetID
attribute.
+ *
+ * <extension point="org.eclipse.ui.popupMenus">
+ * <viewerContribution
+ * targetID="example.rulerContextMenuId"
+ * id="example.RulerPopupActions">
+ * <action
+ * label="Toggle Breakpoint"
+ * class="org.eclipse.debug.ui.actions.RulerCreateBreakpointInteractiveActionDelegate"
+ * menubarPath="additions"
+ * id="example.rulerContextMenu.createBreakpointAction">
+ * </action>
+ * </viewerContribution>
+ *
+ *
+ *
+ * Clients may refer to this class as an action delegate in plug-in XML.
+ *
+ * @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
similarity index 59%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesHandler.java
rename to 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
similarity index 95%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerActionDelegate.java
rename to 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.
+ *
+ * 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.
+ *
+ *
+ * @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 IToggleBreakpointsTarget
adapter.
+ *
+ * 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.
+ *
+ *
+ * @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
similarity index 95%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerAction.java
rename to 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 attributes = new HashMap();
+ 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 attributes = new HashMap();
+ 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 attributes = new HashMap();
+ 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
similarity index 95%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCBreakpointsTargetFactory.java
rename to 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
similarity index 92%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCTracepointsTargetFactory.java
rename to 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 attributes = new HashMap();
+ 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 attributes = new HashMap();
+ 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
similarity index 97%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java
rename to 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
similarity index 51%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointContext.java
rename to 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 {
@@ -42,29 +57,61 @@ 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) {
- fBreakpoint = breakpoint;
- fDebugContext = debugContext;
+ this (breakpoint, debugContext, null, null);
}
- /**
- * Returns the breakpoint.
- */
+ public CBreakpointContext(ICBreakpoint breakpoint, ISelection debugContext, IResource resource, Map attributes) {
+ fBreakpoint = breakpoint;
+ fResource = resource;
+ fDebugContext = debugContext;
+ fPreferenceStore = new CBreakpointPreferenceStore(this, attributes);
+ }
+
+ @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
similarity index 95%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointFilteringPage.java
rename to 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 fProperties = new HashMap();
+
+ // 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 fOriginalValues = new HashMap();
+ 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 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 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 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 changedProperties = new ArrayList( 5 );
+ Set 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 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
similarity index 97%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointUpdater.java
rename to 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
similarity index 87%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointWorkbenchAdapterFactory.java
rename to 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
similarity index 96%
rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ThreadFilterEditor.java
rename to 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