Fixed: 1760857 - Avoid refreshing the preview when phpeditor got focus.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / CompilationUnitAnnotationModelEvent.java
index 56204d3..fa55f33 100644 (file)
@@ -10,8 +10,6 @@
  *******************************************************************************/
 package net.sourceforge.phpeclipse.phpeditor;
 
-
-
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 
 import org.eclipse.core.resources.IMarker;
@@ -23,44 +21,48 @@ import org.eclipse.jface.text.source.AnnotationModelEvent;
 import org.eclipse.jface.text.source.IAnnotationModel;
 import org.eclipse.ui.texteditor.MarkerAnnotation;
 
-
 /**
  * Event sent out by changes of the compilation unit annotation model.
  */
-public class CompilationUnitAnnotationModelEvent  extends AnnotationModelEvent {
-       
+public class CompilationUnitAnnotationModelEvent extends AnnotationModelEvent {
+
        private boolean fIncludesProblemMarkerAnnotations;
+
        private IResource fUnderlyingResource;
-       
+
        /**
         * Constructor for CompilationUnitAnnotationModelEvent.
+        * 
         * @param model
-        * @param underlyingResource The annotation model's underlying resource 
+        * @param underlyingResource
+        *            The annotation model's underlying resource
         */
-       public CompilationUnitAnnotationModelEvent(IAnnotationModel model, IResource underlyingResource) {
+       public CompilationUnitAnnotationModelEvent(IAnnotationModel model,
+                       IResource underlyingResource) {
                super(model);
-               fUnderlyingResource= underlyingResource;
-               fIncludesProblemMarkerAnnotations= false;
+               fUnderlyingResource = underlyingResource;
+               fIncludesProblemMarkerAnnotations = false;
        }
-       
+
        private void testIfProblemMarker(Annotation annotation) {
                if (fIncludesProblemMarkerAnnotations) {
                        return;
                }
                if (annotation instanceof JavaMarkerAnnotation) {
-                       fIncludesProblemMarkerAnnotations= ((JavaMarkerAnnotation) annotation).isProblem();
+                       fIncludesProblemMarkerAnnotations = ((JavaMarkerAnnotation) annotation)
+                                       .isProblem();
                } else if (annotation instanceof MarkerAnnotation) {
                        try {
-                               IMarker marker= ((MarkerAnnotation) annotation).getMarker();
+                               IMarker marker = ((MarkerAnnotation) annotation).getMarker();
                                if (!marker.exists() || marker.isSubtypeOf(IMarker.PROBLEM)) {
-                                       fIncludesProblemMarkerAnnotations= true;
+                                       fIncludesProblemMarkerAnnotations = true;
                                }
                        } catch (CoreException e) {
                                PHPeclipsePlugin.log(e);
                        }
-               }       
+               }
        }
-       
+
        /*
         * @see org.eclipse.jface.text.source.AnnotationModelEvent#annotationAdded(org.eclipse.jface.text.source.Annotation)
         */
@@ -69,7 +71,6 @@ public class CompilationUnitAnnotationModelEvent  extends AnnotationModelEvent {
                testIfProblemMarker(annotation);
        }
 
-
        /*
         * @see org.eclipse.jface.text.source.AnnotationModelEvent#annotationRemoved(org.eclipse.jface.text.source.Annotation)
         */
@@ -79,13 +80,14 @@ public class CompilationUnitAnnotationModelEvent  extends AnnotationModelEvent {
        }
 
        /*
-        * @see org.eclipse.jface.text.source.AnnotationModelEvent#annotationRemoved(org.eclipse.jface.text.source.Annotation, org.eclipse.jface.text.Position)
+        * @see org.eclipse.jface.text.source.AnnotationModelEvent#annotationRemoved(org.eclipse.jface.text.source.Annotation,
+        *      org.eclipse.jface.text.Position)
         */
        public void annotationRemoved(Annotation annotation, Position position) {
                super.annotationRemoved(annotation, position);
                testIfProblemMarker(annotation);
        }
-       
+
        /*
         * @see org.eclipse.jface.text.source.AnnotationModelEvent#annotationChanged(org.eclipse.jface.text.source.Annotation)
         */
@@ -93,7 +95,7 @@ public class CompilationUnitAnnotationModelEvent  extends AnnotationModelEvent {
                testIfProblemMarker(annotation);
                super.annotationChanged(annotation);
        }
-               
+
        /**
         * Returns whether the change included problem marker annotations.
         * 
@@ -102,7 +104,7 @@ public class CompilationUnitAnnotationModelEvent  extends AnnotationModelEvent {
        public boolean includesProblemMarkerAnnotationChanges() {
                return fIncludesProblemMarkerAnnotations;
        }
-       
+
        /**
         * Returns the annotation model's underlying resource
         */