TokenMgrError handled (no more exception on unterminated String), I now accept all...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / test / PHPParserSuperclass.java
index bdf9f88..687cbf4 100644 (file)
@@ -153,4 +153,33 @@ public abstract class PHPParserSuperclass {
       MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
     }
   }
+
+    public static void setMarker(IFile file,
+                                String message,
+                                int charStart,
+                                int charEnd,
+                                int errorLevel,
+                                String location)
+    throws CoreException {
+    if (file != null) {
+      Hashtable attributes = new Hashtable();
+      MarkerUtilities.setMessage(attributes, message);
+      switch (errorLevel) {
+        case Parser.ERROR :
+          attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
+          break;
+        case Parser.WARNING :
+          attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
+          break;
+        case Parser.INFO :
+          attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
+          break;
+      }
+      attributes.put(IMarker.LOCATION,location);
+      MarkerUtilities.setCharStart(attributes, charStart);
+      MarkerUtilities.setCharEnd(attributes, charEnd);
+      // setLineNumber(attributes, lineNumber);
+      MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
+    }
+  }
 }