[139141] Breakpoint image in ruler not updated if breakpoint enablement is toggled
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredMarkerAnnotation.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredMarkerAnnotation.java index 184e33f..197bb5a 100644 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredMarkerAnnotation.java +++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredMarkerAnnotation.java
@@ -15,9 +15,6 @@ import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.source.IAnnotationPresentation; import org.eclipse.swt.SWT; @@ -26,7 +23,6 @@ import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.MarkerAnnotation; -import org.eclipse.ui.texteditor.MarkerUtilities; import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation; @@ -37,115 +33,93 @@ * in the OverviewRuler */ public class StructuredMarkerAnnotation extends MarkerAnnotation implements IAnnotationPresentation { - - private IDebugModelPresentation fPresentation; - //controls if icon should be painted gray + // controls if icon should be painted gray private boolean fIsGrayed = false; String fAnnotationType = null; StructuredMarkerAnnotation(IMarker marker) { super(marker); - initAnnotationType(); } - + public final String getAnnotationType() { return fAnnotationType; } - + /** - * Eventually will have to use IAnnotationPresentation & IAnnotationExtension + * Eventually will have to use IAnnotationPresentation & + * IAnnotationExtension + * * @see org.eclipse.ui.texteditor.MarkerAnnotation#getImage(org.eclipse.swt.widgets.Display) */ protected Image getImage(Display display) { Image image = null; - if (fAnnotationType == TemporaryAnnotation.ANNOT_BREAKPOINT) { - image = super.getImage(display); - if (image == null) { - IMarker marker = getMarker(); - if (marker != null && marker.exists()) { - image = fPresentation.getImage(getMarker()); - } - } - } - else if(fAnnotationType == TemporaryAnnotation.ANNOT_ERROR) { + if (fAnnotationType == TemporaryAnnotation.ANNOT_ERROR) { image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); } - else if(fAnnotationType == TemporaryAnnotation.ANNOT_WARNING) { + else if (fAnnotationType == TemporaryAnnotation.ANNOT_WARNING) { image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK); } - else if(fAnnotationType == TemporaryAnnotation.ANNOT_INFO) { + else if (fAnnotationType == TemporaryAnnotation.ANNOT_INFO) { image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK); } - - if(image != null && isGrayed()) + + if (image != null && isGrayed()) setImage(getGrayImage(display, image)); - else + else setImage(image); - + return super.getImage(display); } private Image getGrayImage(Display display, Image image) { if (image != null) { - String key= Integer.toString(image.hashCode()); + String key = Integer.toString(image.hashCode()); // make sure we cache the gray image Image grayImage = JFaceResources.getImageRegistry().get(key); if (grayImage == null) { - grayImage= new Image(display, image, SWT.IMAGE_GRAY); + grayImage = new Image(display, image, SWT.IMAGE_GRAY); JFaceResources.getImageRegistry().put(key, grayImage); } - image= grayImage; + image = grayImage; } return image; } - + public final boolean isGrayed() { return fIsGrayed; } - + public final void setGrayed(boolean grayed) { fIsGrayed = grayed; } - + /** * Initializes the annotation's icon representation and its drawing layer * based upon the properties of the underlying marker. */ protected void initAnnotationType() { - + IMarker marker = getMarker(); - if (MarkerUtilities.isMarkerType(marker, IBreakpoint.BREAKPOINT_MARKER)) { - - if (fPresentation == null) - fPresentation = DebugUITools.newDebugModelPresentation(); - - setImage(null); // see bug 32469 - setLayer(4); - //fImageType = BREAKPOINT_IMAGE; - fAnnotationType = TemporaryAnnotation.ANNOT_BREAKPOINT; - - } else { - - fAnnotationType = TemporaryAnnotation.ANNOT_UNKNOWN; - try { - if (marker.isSubtypeOf(IMarker.PROBLEM)) { - int severity = marker.getAttribute(IMarker.SEVERITY, -1); - switch (severity) { - case IMarker.SEVERITY_ERROR : - fAnnotationType = TemporaryAnnotation.ANNOT_ERROR; - break; - case IMarker.SEVERITY_WARNING : - fAnnotationType = TemporaryAnnotation.ANNOT_WARNING; - break; - case IMarker.SEVERITY_INFO : - fAnnotationType = TemporaryAnnotation.ANNOT_INFO; - break; - } + fAnnotationType = TemporaryAnnotation.ANNOT_UNKNOWN; + try { + if (marker.isSubtypeOf(IMarker.PROBLEM)) { + int severity = marker.getAttribute(IMarker.SEVERITY, -1); + switch (severity) { + case IMarker.SEVERITY_ERROR : + fAnnotationType = TemporaryAnnotation.ANNOT_ERROR; + break; + case IMarker.SEVERITY_WARNING : + fAnnotationType = TemporaryAnnotation.ANNOT_WARNING; + break; + case IMarker.SEVERITY_INFO : + fAnnotationType = TemporaryAnnotation.ANNOT_INFO; + break; } - - } catch (CoreException e) { - Logger.logException(e); } + + } + catch (CoreException e) { + Logger.logException(e); } } }
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModel.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModel.java index ad6597d..c6af5e5 100644 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModel.java +++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModel.java
@@ -15,7 +15,6 @@ import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.jface.text.Position; import org.eclipse.ui.texteditor.MarkerAnnotation; import org.eclipse.ui.texteditor.MarkerUtilities; @@ -59,7 +58,7 @@ * a special marker annotation for those markers. Otherwise, use * default. */ - if (MarkerUtilities.isMarkerType(marker, IBreakpoint.BREAKPOINT_MARKER) || (MarkerUtilities.isMarkerType(marker, IMarker.PROBLEM))) { + if (MarkerUtilities.isMarkerType(marker, IMarker.PROBLEM)) { return new StructuredMarkerAnnotation(marker); } return super.createMarkerAnnotation(marker);
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/TemporaryAnnotation.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/TemporaryAnnotation.java index 97b9dff..21a05c8 100644 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/TemporaryAnnotation.java +++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/TemporaryAnnotation.java
@@ -44,8 +44,6 @@ public final static String ANNOT_UNKNOWN = Annotation.TYPE_UNKNOWN; public final static String ANNOT_WARNING = "org.eclipse.wst.sse.ui.temp.warning"; //$NON-NLS-1$ - public final static String ANNOT_BREAKPOINT = "org.eclipse.wst.sse.ui.breakpoint"; //$NON-NLS-1$ - // copied from CompilationUnitDocumentProvider.ProblemAnnotation //XXX: To be fully correct these constants should be non-static