Commits

Anonymous committed edefb9d

Now compilation markers are shown in file but are not shown in problems.

  • Participants
  • Parent commits ca51d07

Comments (0)

Files changed (1)

File src/org/lispdev/main/LoadProjectAction.java

 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.ActionContributionItem;
 import org.eclipse.jface.action.IAction;
   @Override
   public void run(IAction action)
   {
+    if( project == null && file == null )
+    {
+      MessageBox mbox =
+        new MessageBox(part.getSite().getShell(), SWT.CANCEL | SWT.ICON_ERROR
+            | SWT.APPLICATION_MODAL);
+      mbox.setText("Error");
+      mbox.setMessage("Could not load ASD");
+      mbox.open();
+      return;
+    }
+    LispProcess process =
+      LispPlugin.get().getActiveProcess(
+          (project == null ? file.getProject() : project));
+    if( process == null )
+    {
+      MessageBox mbox =
+        new MessageBox(part.getSite().getShell(), SWT.CANCEL | SWT.ICON_ERROR
+            | SWT.APPLICATION_MODAL);
+      mbox.setText("Error");
+      mbox.setMessage("The project is not associated with any Lisp");
+      mbox.open();
+      return;
+    }
+    loadIn(file,process);
   }
 
   @Override
         {
           project = (IProject)obj;
           file = null;
-          action.setEnabled(true);
         }
         else if( obj instanceof IFile
             && ((IFile)obj).getFileExtension().equals("asd"))
         {
           project = null;
           file = (IFile)obj;
-          action.setEnabled(true);
         }
         else
         {
-          action.setEnabled(false);
+          project = null;
+          file = null;
         }
       }
       catch(CoreException e)
       {
-        action.setEnabled(false);
+        project = null;
+        file = null;
       }
     }
     else
     {
-      action.setEnabled(false);
+      project = null;
+      file = null;
     }
   }
 
             for( CompileMessage cm : info.messages )
             {
               IPath path = new Path(cm.file);
-              IFile file = proj.getFile(path);
-              if( file != null && cm.position >= 0 )
+              IPath projPath = Platform.getLocation().append(proj.getFullPath());
+              if( projPath.isPrefixOf(path) )
               {
-                LispMarkers.addMarker(file, cm.position, 1, cm.message,
-                    cm.severity, LispMarkers.COMPILE);
+                IPath relativePath = path.makeRelativeTo(projPath);
+                IFile file = proj.getFile(relativePath);
+                if( file.exists() && cm.position >= 0 )
+                {
+                  LispMarkers.addMarker(file, cm.position, 1, cm.message,
+                      cm.severity, LispMarkers.COMPILE);
+                }
+                else
+                {
+                  LispMarkers.addMarker((file == null ? proj : file),
+                      cm.message, cm.severity, LispMarkers.COMPILE);
+                }
               }
               else
               {
-                LispMarkers.addMarker((file == null ? proj : file),
+                LispMarkers.addMarker(proj,
                     cm.message, cm.severity, LispMarkers.COMPILE);
               }
             }