X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java index 2e6c47f..e72f265 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java @@ -11,7 +11,6 @@ package net.sourceforge.phpeclipse.phpeditor; - import java.util.Iterator; import net.sourceforge.phpdt.core.ICompilationUnit; @@ -25,37 +24,40 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.texteditor.MarkerAnnotation; +public class JavaMarkerAnnotation extends MarkerAnnotation implements + IJavaAnnotation { + + public static final String JAVA_MARKER_TYPE_PREFIX = "net.sourceforge.phpdt"; //$NON-NLS-1$ + + public static final String ERROR_ANNOTATION_TYPE = "net.sourceforge.phpdt.ui.error"; //$NON-NLS-1$ + public static final String WARNING_ANNOTATION_TYPE = "net.sourceforge.phpdt.ui.warning"; //$NON-NLS-1$ -public class JavaMarkerAnnotation extends MarkerAnnotation implements IJavaAnnotation { + public static final String INFO_ANNOTATION_TYPE = "net.sourceforge.phpdt.ui.info"; //$NON-NLS-1$ - public static final String JAVA_MARKER_TYPE_PREFIX= "net.sourceforge.phpdt"; //$NON-NLS-1$ - public static final String ERROR_ANNOTATION_TYPE= "net.sourceforge.phpdt.ui.error"; //$NON-NLS-1$ - public static final String WARNING_ANNOTATION_TYPE= "net.sourceforge.phpdt.ui.warning"; //$NON-NLS-1$ - public static final String INFO_ANNOTATION_TYPE= "net.sourceforge.phpdt.ui.info"; //$NON-NLS-1$ - public static final String TASK_ANNOTATION_TYPE= "org.eclipse.ui.workbench.texteditor.task"; //$NON-NLS-1$ + public static final String TASK_ANNOTATION_TYPE = "org.eclipse.ui.workbench.texteditor.task"; //$NON-NLS-1$ private IJavaAnnotation fOverlay; - - + public JavaMarkerAnnotation(IMarker marker) { super(marker); } - + /* * @see net.sourceforge.phpdt.internal.ui.javaeditor.IJavaAnnotation#getImage(org.eclipse.swt.widgets.Display) */ public Image getImage(Display display) { return super.getImage(display); } - + /* * @see IJavaAnnotation#getArguments() */ public String[] getArguments() { - IMarker marker= getMarker(); + IMarker marker = getMarker(); if (marker != null && marker.exists() && isProblem()) - return JavaModelUtil.getProblemArgumentsFromMarker(marker.getAttribute(IJavaModelMarker.ARGUMENTS, "")); //$NON-NLS-1$ + return JavaModelUtil.getProblemArgumentsFromMarker(marker + .getAttribute(IJavaModelMarker.ARGUMENTS, "")); //$NON-NLS-1$ return null; } @@ -63,65 +65,67 @@ public class JavaMarkerAnnotation extends MarkerAnnotation implements IJavaAnnot * @see IJavaAnnotation#getId() */ public int getId() { - IMarker marker= getMarker(); - if (marker == null || !marker.exists()) + IMarker marker = getMarker(); + if (marker == null || !marker.exists()) return -1; - + if (isProblem()) return marker.getAttribute(IJavaModelMarker.ID, -1); - -// if (TASK_ANNOTATION_TYPE.equals(getAnnotationType())) { -// try { -// if (marker.isSubtypeOf(IJavaModelMarker.TASK_MARKER)) { -// return IProblem.Task; -// } -// } catch (CoreException e) { -// JavaPlugin.log(e); // should no happen, we test for marker.exists -// } -// } - + + // if (TASK_ANNOTATION_TYPE.equals(getAnnotationType())) { + // try { + // if (marker.isSubtypeOf(IJavaModelMarker.TASK_MARKER)) { + // return IProblem.Task; + // } + // } catch (CoreException e) { + // JavaPlugin.log(e); // should no happen, we test for marker.exists + // } + // } + return -1; } - + /* * @see IJavaAnnotation#isProblem() */ public boolean isProblem() { - String type= getType(); - return WARNING_ANNOTATION_TYPE.equals(type) || ERROR_ANNOTATION_TYPE.equals(type); + String type = getType(); + return WARNING_ANNOTATION_TYPE.equals(type) + || ERROR_ANNOTATION_TYPE.equals(type); } /** * Overlays this annotation with the given javaAnnotation. * - * @param javaAnnotation annotation that is overlaid by this annotation + * @param javaAnnotation + * annotation that is overlaid by this annotation */ public void setOverlay(IJavaAnnotation javaAnnotation) { if (fOverlay != null) fOverlay.removeOverlaid(this); - - fOverlay= javaAnnotation; + + fOverlay = javaAnnotation; if (!isMarkedDeleted()) markDeleted(fOverlay != null); - + if (fOverlay != null) fOverlay.addOverlaid(this); } - + /* * @see IJavaAnnotation#hasOverlay() */ public boolean hasOverlay() { return fOverlay != null; } - + /* * @see net.sourceforge.phpdt.internal.ui.javaeditor.IJavaAnnotation#getOverlay() */ public IJavaAnnotation getOverlay() { return fOverlay; } - + /* * @see IJavaAnnotation#addOverlaid(IJavaAnnotation) */ @@ -135,7 +139,7 @@ public class JavaMarkerAnnotation extends MarkerAnnotation implements IJavaAnnot public void removeOverlaid(IJavaAnnotation annotation) { // not supported } - + /* * @see IJavaAnnotation#getOverlaidIterator() */ @@ -144,14 +148,16 @@ public class JavaMarkerAnnotation extends MarkerAnnotation implements IJavaAnnot return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see net.sourceforge.phpdt.internal.ui.javaeditor.IJavaAnnotation#getCompilationUnit() */ public ICompilationUnit getCompilationUnit() { - IJavaElement element= JavaCore.create(getMarker().getResource()); + IJavaElement element = JavaCore.create(getMarker().getResource()); if (element instanceof ICompilationUnit) { - ICompilationUnit cu= (ICompilationUnit)element; - ICompilationUnit workingCopy= EditorUtility.getWorkingCopy(cu); + ICompilationUnit cu = (ICompilationUnit) element; + ICompilationUnit workingCopy = EditorUtility.getWorkingCopy(cu); if (workingCopy != null) { return workingCopy; }