mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-07 10:33: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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,7 +12,6 @@
|
||||||
package org.eclipse.cdt.debug.internal.ui;
|
package org.eclipse.cdt.debug.internal.ui;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IMarkerDelta;
|
import org.eclipse.core.resources.IMarkerDelta;
|
||||||
|
@ -24,7 +23,7 @@ import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
|
||||||
|
|
||||||
public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel implements IBreakpointsListener {
|
public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel implements IBreakpointsListener {
|
||||||
|
|
||||||
private File fFile;
|
private final File fFile;
|
||||||
|
|
||||||
public DebugMarkerAnnotationModel( File file ) {
|
public DebugMarkerAnnotationModel( File file ) {
|
||||||
super();
|
super();
|
||||||
|
@ -32,7 +31,7 @@ public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel im
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IMarker[] retrieveMarkers() throws CoreException {
|
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];
|
IMarker[] markers = new IMarker[breakpoints.length];
|
||||||
for ( int i = 0; i < markers.length; ++i ) {
|
for ( int i = 0; i < markers.length; ++i ) {
|
||||||
markers[i] = breakpoints[i].getMarker();
|
markers[i] = breakpoints[i].getMarker();
|
||||||
|
@ -51,9 +50,10 @@ public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel im
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAcceptable( IMarker marker ) {
|
protected boolean isAcceptable( IMarker marker ) {
|
||||||
IBreakpoint b = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint( marker );
|
String handle = marker.getAttribute(ICBreakpoint.SOURCE_HANDLE, null);
|
||||||
if ( b != null ) {
|
if (handle != null) {
|
||||||
return isAcceptable( b );
|
File file = new File( handle );
|
||||||
|
return file.equals( getFile() );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -64,37 +64,23 @@ public class DebugMarkerAnnotationModel extends AbstractMarkerAnnotationModel im
|
||||||
|
|
||||||
public void breakpointsAdded( IBreakpoint[] breakpoints ) {
|
public void breakpointsAdded( IBreakpoint[] breakpoints ) {
|
||||||
for ( int i = 0; i < breakpoints.length; ++i ) {
|
for ( int i = 0; i < breakpoints.length; ++i ) {
|
||||||
if ( isAcceptable( breakpoints[i] ) ) {
|
addMarkerAnnotation( breakpoints[i].getMarker() );
|
||||||
addMarkerAnnotation( breakpoints[i].getMarker() );
|
|
||||||
fireModelChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
fireModelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void breakpointsRemoved( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) {
|
public void breakpointsRemoved( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) {
|
||||||
for ( int i = 0; i < breakpoints.length; ++i ) {
|
for ( int i = 0; i < breakpoints.length; ++i ) {
|
||||||
if ( isAcceptable( breakpoints[i] ) ) {
|
removeMarkerAnnotation( breakpoints[i].getMarker() );
|
||||||
removeMarkerAnnotation( breakpoints[i].getMarker() );
|
|
||||||
fireModelChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
fireModelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void breakpointsChanged( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) {
|
public void breakpointsChanged( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) {
|
||||||
for ( int i = 0; i < breakpoints.length; ++i ) {
|
for ( int i = 0; i < breakpoints.length; ++i ) {
|
||||||
if ( isAcceptable( breakpoints[i] ) ) {
|
modifyMarkerAnnotation( breakpoints[i].getMarker() );
|
||||||
modifyMarkerAnnotation( breakpoints[i].getMarker() );
|
|
||||||
fireModelChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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