Changeset 130 for trunk/org.modelica.mdt/src/org/modelica/mdt/builder/ModelicaBuildDeltaVisitor.java
- Timestamp:
- 11/09/05 17:43:12 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt/src/org/modelica/mdt/builder/ModelicaBuildDeltaVisitor.java
r124 r130 1 1 package org.modelica.mdt.builder; 2 2 3 import org.eclipse.core.resources.IFile; 4 import org.eclipse.core.resources.IMarker; 5 import org.eclipse.core.resources.IResource; 3 6 import org.eclipse.core.resources.IResourceDelta; 4 7 import org.eclipse.core.resources.IResourceDeltaVisitor; 5 8 import org.eclipse.core.runtime.CoreException; 9 import org.eclipse.core.runtime.IPath; 10 import org.eclipse.osgi.service.datalocation.Location; 11 import org.modelica.mdt.MdtPlugin; 12 import org.modelica.mdt.internal.omcproxy.InitializationException; 13 import org.modelica.mdt.internal.omcproxy.OMCProxy; 6 14 7 15 public class ModelicaBuildDeltaVisitor implements IResourceDeltaVisitor { 8 16 9 public boolean visit(IResourceDelta delta) throws CoreException { 17 public boolean visit(IResourceDelta delta) throws CoreException 18 { 10 19 // TODO Auto-generated method stub 20 String changedFile = delta.getResource().getLocation().toString(); 21 String extension = delta.getResource().getFileExtension(); 22 23 if(extension != null && extension.equals("mo")) 24 { 25 IPath path = delta.getProjectRelativePath(); 26 IFile file = delta.getResource().getProject().getFile(path); 27 28 file.deleteMarkers(IMarker.PROBLEM, false, 29 IResource.DEPTH_INFINITE); 30 try 31 { 32 String[] retval = OMCProxy.loadFileInteractive(changedFile); 33 34 // TODO If contents are error strings, set up problem markers 35 for(String s: retval) 36 { 37 if(s.contains("error")) 38 { 39 String msg; 40 int lineno; 41 42 String[] s2 = s.split("]"); 43 String[] s3 = s2[0].split(":"); 44 String[] s4 = s2[1].split(":"); 45 46 msg = s4[2].trim(); 47 lineno = Integer.parseInt(s3[1]); 48 49 delta.getResource().getProject(); 50 51 ModelicaBuilder.reportProblem(msg, file, lineno); 52 } 53 } 54 } 55 catch(InitializationException e) 56 { 57 MdtPlugin.log(e); 58 } 59 } 60 61 IResourceDelta[] d = delta.getAffectedChildren(); 62 if(d == null) 63 return false; 64 65 for(IResourceDelta d1 : d) 66 { 67 d1.accept(new ModelicaBuildDeltaVisitor()); 68 } 11 69 return false; 12 70 }
Note: See TracChangeset
for help on using the changeset viewer.