Author: pkluegl
Date: Tue Nov 12 10:18:54 2019
New Revision: 1869686

URL: http://svn.apache.org/viewvc?rev=1869686&view=rev
Log:
UIMA-5669: deactivate refreshing of generated descriptors

Modified:
    
uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java

Modified: 
uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java
URL: 
http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java?rev=1869686&r1=1869685&r2=1869686&view=diff
==============================================================================
--- 
uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java
 (original)
+++ 
uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/builder/RutaBuilder.java
 Tue Nov 12 10:18:54 2019
@@ -53,7 +53,6 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
 import org.eclipse.dltk.core.DLTKCore;
 import org.eclipse.dltk.core.IScriptProject;
@@ -72,6 +71,7 @@ import org.eclipse.jface.preference.IPre
 public class RutaBuilder extends AbstractBuildParticipantType implements 
IBuildParticipant,
         IBuildParticipantExtension, IBuildParticipantExtension2, 
IBuildParticipantExtension3 {
 
+  @SuppressWarnings("unused")
   private IScriptProject project;
 
   public RutaBuilder() {
@@ -90,6 +90,7 @@ public class RutaBuilder extends Abstrac
       IContainer container = getContainer(sourceModule);
 
       IPath outputPath = getAbsolutePath(sourceModule);
+      @SuppressWarnings("unused")
       IPath[] generateResources = generateResources(moduleDeclaration, 
outputPath, container,
               sourceModule);
 
@@ -98,30 +99,39 @@ public class RutaBuilder extends Abstrac
       for (IFolder iFolder : allDescriptorFolders) {
         RutaProjectUtils.addProjectDataPath(proj, iFolder);
       }
-      
-      monitor.worked(2);
-      String defaultDescriptorLocation = 
RutaProjectUtils.getDefaultDescriptorLocation();
-      IFolder folder = 
container.getProject().getFolder(defaultDescriptorLocation);
-      for (IPath iPath : generateResources) {
-        iPath = iPath.makeRelativeTo(folder.getLocation());
-        IResource findMember = folder.findMember(iPath);
-        if (findMember != null) {
-          findMember.refreshLocal(IResource.DEPTH_INFINITE, new 
NullProgressMonitor());
-          findMember.getParent().refreshLocal(IResource.DEPTH_ONE, new 
NullProgressMonitor());
-        }
-
-      }
-      folder.refreshLocal(IResource.DEPTH_INFINITE, new 
SubProgressMonitor(monitor,
-              generateResources.length));
 
-      monitor.worked(1);
+      monitor.worked(2);
+      // refreshing deactivated in context of UIMA-5669
+      // String defaultDescriptorLocation = 
RutaProjectUtils.getDefaultDescriptorLocation();
+      // IFolder folder = 
container.getProject().getFolder(defaultDescriptorLocation);
+      // for (IPath iPath : generateResources) {
+      // IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+      // IFile[] files = root.findFilesForLocationURI(iPath.toFile().toURI());
+      // for (IFile file : files) {
+      // file.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
+      // }
+      //
+      // IResource findMember2 = root.findMember(iPath);
+      //
+      // iPath = iPath.makeRelativeTo(folder.getLocation());
+      // IResource findMember = folder.findMember(iPath);
+      // if (findMember != null) {
+      // findMember.refreshLocal(IResource.DEPTH_INFINITE, new 
NullProgressMonitor());
+      // findMember.getParent().refreshLocal(IResource.DEPTH_ONE, new 
NullProgressMonitor());
+      // }
+      //
+      // }
+      // folder.refreshLocal(IResource.DEPTH_INFINITE, new 
SubProgressMonitor(monitor,
+      // generateResources.length));
+      //
+      // monitor.worked(1);
     } catch (ModelException e) {
       if (DLTKCore.DEBUG_PARSER) {
-        e.printStackTrace();
+        RutaIdeCorePlugin.error(e);
       }
     } catch (CoreException e) {
       if (DLTKCore.DEBUG_PARSER) {
-        e.printStackTrace();
+        RutaIdeCorePlugin.error(e);
       }
     }
     monitor.done();
@@ -137,32 +147,35 @@ public class RutaBuilder extends Abstrac
       String elementName = RutaProjectUtils.getModuleName(pathToModule);
 
       IScriptProject scriptProject = sourceModule.getScriptProject();
-      
+
       IProject project = scriptProject.getProject();
-      
+
       IPath descPath = RutaProjectUtils.getDescriptorRootPath(project);
       String basicTS = 
descPath.append("BasicTypeSystem.xml").toPortableString();
       String basicE = descPath.append("BasicEngine.xml").toPortableString();
-      
+
       List<IFolder> descriptorFolders = 
RutaProjectUtils.getDescriptorFolders(project);
       for (IFolder iFolder : descriptorFolders) {
         File btsd = 
iFolder.getLocation().append("BasicTypeSystem.xml").toFile();
         File baed = iFolder.getLocation().append("BasicEngine.xml").toFile();
-        if(btsd.exists() && baed.exists()) {
+        if (btsd.exists() && baed.exists()) {
           basicTS = btsd.getAbsolutePath();
           basicE = baed.getAbsolutePath();
           descPath = iFolder.getLocation();
           break;
         }
       }
-      
-      IPath relativePackagePath = 
RutaProjectUtils.getPackagePath(sourceModule.getResource()
-              .getLocation(), project);
+
+      IPath relativePackagePath = RutaProjectUtils
+              .getPackagePath(sourceModule.getResource().getLocation(), 
project);
       IPath descPackagePath = descPath.append(relativePackagePath);
-      String typeSystem = descPackagePath.append(elementName + 
RutaProjectUtils.getTypeSystemSuffix(project) + ".xml").toPortableString();
-      String engine = descPackagePath.append(elementName + 
RutaProjectUtils.getAnalysisEngineSuffix(project) + ".xml").toPortableString();
+      String typeSystem = descPackagePath
+              .append(elementName + 
RutaProjectUtils.getTypeSystemSuffix(project) + ".xml")
+              .toPortableString();
+      String engine = descPackagePath
+              .append(elementName + 
RutaProjectUtils.getAnalysisEngineSuffix(project) + ".xml")
+              .toPortableString();
 
-      
       String scriptWithPackagePath = 
RutaProjectUtils.getScriptWithPackage(pathToModule, project);
       List<String> scriptPathList = new ArrayList<String>();
       List<String> descriptorPathList = new ArrayList<String>();
@@ -182,7 +195,7 @@ public class RutaBuilder extends Abstrac
       } catch (Exception e) {
         RutaIdeCorePlugin.error(e);
       }
-      
+
       try {
         List<IFolder> allResourceFolders = 
RutaProjectUtils.getAllResourceFolders(project);
         
resourcePathList.addAll(RutaProjectUtils.getFolderLocations(allResourceFolders));
@@ -192,8 +205,8 @@ public class RutaBuilder extends Abstrac
 
       String[] descriptorPaths = descriptorPathList.toArray(new String[0]);
       String[] scriptPaths = scriptPathList.toArray(new String[0]);
-      String[] resourcePaths =  resourcePathList.toArray(new String[0]);
-              
+      String[] resourcePaths = resourcePathList.toArray(new String[0]);
+
       String mainScript = scriptWithPackagePath;
       mainScript = mainScript.replaceAll("/", ".");
       if (mainScript.endsWith(RutaEngine.SCRIPT_FILE_EXTENSION)) {
@@ -206,13 +219,14 @@ public class RutaBuilder extends Abstrac
         try {
           urls[counter] = new File(dep).toURI().toURL();
         } catch (MalformedURLException e) {
-          throw new CoreException(new Status(IStatus.ERROR,
-                  RutaIdeCorePlugin.PLUGIN_ID, e.getMessage()));
+          throw new CoreException(
+                  new Status(IStatus.ERROR, RutaIdeCorePlugin.PLUGIN_ID, 
e.getMessage()));
         }
         counter++;
       }
       ClassLoader classloader = new URLClassLoader(urls);
-      build(basicTS, basicE, typeSystem, engine, sm, scriptPaths, 
descriptorPaths, resourcePaths, classloader);
+      build(basicTS, basicE, typeSystem, engine, sm, scriptPaths, 
descriptorPaths, resourcePaths,
+              classloader);
 
       IPath tsPath = Path.fromPortableString(typeSystem);
       IPath ePath = Path.fromPortableString(engine);
@@ -228,7 +242,7 @@ public class RutaBuilder extends Abstrac
     RutaDescriptorBuilder builder = null;
     try {
       URL tsUrl = new File(basicTypesystem).toURI().toURL();
-      URL aeUrl= new File(basicEngine).toURI().toURL();
+      URL aeUrl = new File(basicEngine).toURI().toURL();
       builder = new RutaDescriptorBuilder(tsUrl, aeUrl);
     } catch (Exception e) {
       DLTKCore.error(e.getMessage(), e);
@@ -283,7 +297,8 @@ public class RutaBuilder extends Abstrac
       
option.setImportByName(store.getBoolean(RutaCorePreferences.BUILDER_IMPORT_BY_NAME));
       
option.setResolveImports(store.getBoolean(RutaCorePreferences.BUILDER_RESOLVE_IMPORTS));
       option.setClassLoader(classloader);
-      builder.build(sm, typeSystemDest, engineDest, option, scriptPaths, 
enginePaths, resourcePaths);
+      builder.build(sm, typeSystemDest, engineDest, option, scriptPaths, 
enginePaths,
+              resourcePaths);
     } catch (Exception e) {
       DLTKCore.error(e.getMessage(), e);
       if (DLTKCore.DEBUG_PARSER) {
@@ -330,24 +345,30 @@ public class RutaBuilder extends Abstrac
     return relativeFilePath;
   }
 
+  @Override
   public void clean() {
   }
 
+  @Override
   public void prepare(IBuildChange buildChange, IBuildState buildState) throws 
CoreException {
   }
 
+  @Override
   public void buildExternalModule(IBuildContext context) throws CoreException {
 
   }
 
+  @Override
   public boolean beginBuild(int buildType) {
     return buildType != RECONCILE_BUILD;
   }
 
+  @Override
   public void endBuild(IProgressMonitor monitor) {
 
   }
 
+  @Override
   public void build(IBuildContext context) throws CoreException {
     final ModuleDeclaration ast = (ModuleDeclaration) context
             .get(IBuildContext.ATTR_MODULE_DECLARATION);


Reply via email to