Commits

Anonymous committed c7e7ca5

Loading projects create markers for compile errors. However at this point they are not yet displayed - there are some bugs.

  • Participants
  • Parent commits 358e1b1

Comments (0)

Files changed (7)

File META-INF/MANIFEST.MF

 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Import-Package: org.eclipse.ui.part
+Export-Package: org.lispdev.editor

File src/org/lispdev/editor/LispEditor.java

     }
     catch(BadLocationException e)
     {
-      Log.logException("", e);
+      Log.logException(e);
     }
 
   }

File src/org/lispdev/editor/LispMarkers.java

 
 public class LispMarkers
 {
-  static final String LISP_MARKER = "org.lispdev.marker";
-  static final String LISP_PARSING_ERROR = LISP_MARKER + ".parsingError";
+  static final String MARKER = "org.lispdev.marker";
+  static final String PARSING_ERROR = MARKER + ".parsingError";
+  public static final String COMPILE = MARKER + ".compile";
 
   private static void deleteMarkers(IFile file, String marketType)
   {
       }
       catch(CoreException e1)
       {
-        Log.logException("", e1);
+        Log.logException(e1);
       }
     }
   }
 
+  private static HashMap<String, Object> getMarketAttributes(
+      String msg, int severity)
+  {
+    HashMap<String,Object> attr = new HashMap<String, Object>(2);
+    attr.put(IMarker.MESSAGE, msg);
+    attr.put(IMarker.SEVERITY, severity);
+
+    return attr;
+  }
+
   private static HashMap<String, Object> getMarketAttributes(int offset,
       int length, String msg, int severity)
   {
   private static HashMap<String, Object> getMarketAttributes(int offset,
       int length, int lineNum, String msg, int severity)
   {
-    HashMap<String, Object> attr =
-      getMarketAttributes(offset, length, msg, severity);
-    attr.put(IMarker.LINE_NUMBER, lineNum);
+    HashMap<String,Object> attr = new HashMap<String, Object>(6);
+    attr.put(IMarker.CHAR_START, new Integer(offset));
+    attr.put(IMarker.CHAR_END, new Integer(offset + length));
+
+    attr.put(IMarker.MESSAGE, msg);
+    attr.put(IMarker.SEVERITY, severity);
+
     return attr;
   }
 
-  private static void addMarker(IFile file, int offset, int length,
+  public static void addMarker(IFile file, int offset, int length,
       int lineNum, String msg, int severity, String markerType)
   {
     try
     }
     catch(CoreException e)
     {
-      Log.logException("", e);
+      Log.logException(e);
+    }
+  }
+
+  public static void addMarker(IFile file, int offset, int length,
+      String msg, int severity, String markerType)
+  {
+    try
+    {
+      MarkerUtilities.createMarker(file,
+          getMarketAttributes(offset, length, msg, severity), markerType);
+    }
+    catch(CoreException e)
+    {
+      Log.logException(e);
+    }
+  }
+
+  public static void addMarker(IResource project, String msg, int severity,
+      String markerType)
+  {
+    try
+    {
+      MarkerUtilities.createMarker(project, getMarketAttributes(msg, severity),
+          markerType);
+    }
+    catch(CoreException e)
+    {
+      Log.logException(e);
     }
   }
 
     }
     catch(BadLocationException e)
     {
-      Log.logException("", e);
+      Log.logException(e);
     }
   }
 
   {
     TreeRoot tree = EditorPlugin.get().getAst(doc);
     if( file == null || tree == null ) return;
-    deleteMarkers(file, LISP_PARSING_ERROR);
+    deleteMarkers(file, PARSING_ERROR);
     Map<ParseError, int[]> errors = tree.errors();
     final int len = doc.getLength();
     for( Map.Entry<ParseError,int[]> e : errors.entrySet() )
       int[] range = e.getValue();
       addMarker(file,doc,range[0],range[1],
           getErrMessage(err, range[0]+1 >= len),
-          IMarker.SEVERITY_ERROR, LISP_PARSING_ERROR);
+          IMarker.SEVERITY_ERROR, PARSING_ERROR);
     }
   }
 
     }
     catch(CoreException e)
     {
-      Log.logException("", e);
+      Log.logException(e);
     }
   }
 

File src/org/lispdev/editor/LispPartitioner.java

     }
     catch(Exception e)
     {
-      Log.logException("", e);
+      Log.logException(e);
     }
 
     final Region res = new Region(range[0], range[1]);

File src/org/lispdev/editor/LispScanner.java

       }
       catch(BadLocationException e)
       {
-        Log.logException("", e);
+        Log.logException(e);
       }
     }
     fOffset = offset;

File src/org/lispdev/editor/actions/IndentAction.java

     }
     catch(BadLocationException e)
     {
-      Log.logException("", e);
+      Log.logException(e);
     }
 
     return new int[]{newOffset, newOffsetLength, newi0Offset};

File src/org/lispdev/editor/autoedits/IndentOnEnter.java

       }
       catch(BadLocationException e)
       {
-        Log.logException("", e);
+        Log.logException(e);
       }
       final String indent = getIndent(command.offset, document);
       command.text += indent;
     }
     catch(BadLocationException e)
     {
-      Log.logException("", e);
+      Log.logException(e);
     }
 
     return res.toString();
     }
     catch(BadLocationException e)
     {
-      Log.logException("", e);
+      Log.logException(e);
       return "";
     }
   }