Ignore:
Timestamp:
11/09/05 17:43:12 (19 years ago)
Author:
remar
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.modelica.mdt/src/org/modelica/mdt/builder/ModelicaBuildDeltaVisitor.java

    r124 r130  
    11package org.modelica.mdt.builder;
    22
     3import org.eclipse.core.resources.IFile;
     4import org.eclipse.core.resources.IMarker;
     5import org.eclipse.core.resources.IResource;
    36import org.eclipse.core.resources.IResourceDelta;
    47import org.eclipse.core.resources.IResourceDeltaVisitor;
    58import org.eclipse.core.runtime.CoreException;
     9import org.eclipse.core.runtime.IPath;
     10import org.eclipse.osgi.service.datalocation.Location;
     11import org.modelica.mdt.MdtPlugin;
     12import org.modelica.mdt.internal.omcproxy.InitializationException;
     13import org.modelica.mdt.internal.omcproxy.OMCProxy;
    614
    715public class ModelicaBuildDeltaVisitor implements IResourceDeltaVisitor {
    816
    9     public boolean visit(IResourceDelta delta) throws CoreException {
     17    public boolean visit(IResourceDelta delta) throws CoreException
     18    {
    1019        // 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        }
    1169        return false;
    1270    }
Note: See TracChangeset for help on using the changeset viewer.