mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 316905 - DebugMarkerAnnotationModel does not reliably remove annotations for removed breakpoints
This commit is contained in:
parent
b788d43334
commit
a529a397d0
1 changed files with 13 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2007 QNX Software Systems and others.
|
||||
* 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
|
||||
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.debug.internal.ui;
|
||||
|
||||
import java.io.File;
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IMarkerDelta;
|
||||
|
@ -24,7 +23,7 @@ import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
|
|||
|
||||
public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel implements IBreakpointsListener {
|
||||
|
||||
private File fFile;
|
||||
private final File fFile;
|
||||
|
||||
public DebugMarkerAnnotationModel( File file ) {
|
||||
super();
|
||||
|
@ -32,7 +31,7 @@ public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel im
|
|||
}
|
||||
|
||||
protected IMarker[] retrieveMarkers() throws CoreException {
|
||||
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints( CDIDebugModel.getPluginIdentifier() );
|
||||
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
|
||||
IMarker[] markers = new IMarker[breakpoints.length];
|
||||
for ( int i = 0; i < markers.length; ++i ) {
|
||||
markers[i] = breakpoints[i].getMarker();
|
||||
|
@ -51,9 +50,10 @@ public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel im
|
|||
}
|
||||
|
||||
protected boolean isAcceptable( IMarker marker ) {
|
||||
IBreakpoint b = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint( marker );
|
||||
if ( b != null ) {
|
||||
return isAcceptable( b );
|
||||
String handle = marker.getAttribute(ICBreakpoint.SOURCE_HANDLE, null);
|
||||
if (handle != null) {
|
||||
File file = new File( handle );
|
||||
return file.equals( getFile() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -64,37 +64,23 @@ public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel im
|
|||
|
||||
public void breakpointsAdded( IBreakpoint[] breakpoints ) {
|
||||
for ( int i = 0; i < breakpoints.length; ++i ) {
|
||||
if ( isAcceptable( breakpoints[i] ) ) {
|
||||
addMarkerAnnotation( breakpoints[i].getMarker() );
|
||||
fireModelChanged();
|
||||
}
|
||||
addMarkerAnnotation( breakpoints[i].getMarker() );
|
||||
}
|
||||
fireModelChanged();
|
||||
}
|
||||
|
||||
public void breakpointsRemoved( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) {
|
||||
for ( int i = 0; i < breakpoints.length; ++i ) {
|
||||
if ( isAcceptable( breakpoints[i] ) ) {
|
||||
removeMarkerAnnotation( breakpoints[i].getMarker() );
|
||||
fireModelChanged();
|
||||
}
|
||||
removeMarkerAnnotation( breakpoints[i].getMarker() );
|
||||
}
|
||||
fireModelChanged();
|
||||
}
|
||||
|
||||
public void breakpointsChanged( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) {
|
||||
for ( int i = 0; i < breakpoints.length; ++i ) {
|
||||
if ( isAcceptable( breakpoints[i] ) ) {
|
||||
modifyMarkerAnnotation( breakpoints[i].getMarker() );
|
||||
fireModelChanged();
|
||||
}
|
||||
modifyMarkerAnnotation( breakpoints[i].getMarker() );
|
||||
}
|
||||
fireModelChanged();
|
||||
}
|
||||
|
||||
private boolean isAcceptable( IBreakpoint b ) {
|
||||
String handle = b.getMarker().getAttribute(ICBreakpoint.SOURCE_HANDLE, null);
|
||||
if (handle != null) {
|
||||
File file = new File( handle );
|
||||
return file.equals( getFile() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue