Пример #1
0
 /**
  * Helper method - returns the file item (ie. which returns true to {@link java.io.File#isFile()},
  * or null if unbound
  */
 public static synchronized IFileHandle getFile(Object target) {
   if (existingExternalConfirmedFiles.contains(target)) return (IFileHandle) target;
   if (target instanceof IFileHandle) {
     IFileHandle f = (IFileHandle) target;
     if (f.isFile()) {
       existingExternalConfirmedFiles.add(f);
       return f;
     }
   }
   return null;
 }
Пример #2
0
 /**
  * Helper method - returns the targeted item (IResource if internal or IFileHandle if external),
  * or null if unbound Internal items must be referred to using container relative paths.
  */
 public static Object getTarget(IContainer container, IPath path, boolean checkResourceExistence) {
   if (path == null) return null;
   // lookup - inside the container
   if (path.getDevice() == null) { // container relative paths should not
     // contain a device
     // (see http://dev.eclipse.org/bugs/show_bug.cgi?id=18684)
     // (case of a workspace rooted at d:\ )
     IResource resource = container.findMember(path);
     if (resource != null) {
       if (!checkResourceExistence || resource.exists()) return resource;
       return null;
     }
   }
   // if path is relative, it cannot be an external path
   // (see http://dev.eclipse.org/bugs/show_bug.cgi?id=22517)
   if (!path.isAbsolute()) return null;
   // lookup - outside the container
   IFileHandle externalFile = EnvironmentPathUtils.getFile(path);
   if (externalFile != null) {
     if (!checkResourceExistence) {
       return externalFile;
     } else if (existingExternalFiles.contains(externalFile)) {
       return externalFile;
     } else {
       if (ModelManager.ZIP_ACCESS_VERBOSE) {
         System.out.println(
             "("
                 + Thread.currentThread()
                 + ") [Model.getTarget(...)] Checking existence of "
                 + path.toString()); // $NON-NLS-1$ //$NON-NLS-2$
       }
       if (externalFile.exists()) {
         // cache external file
         existingExternalFiles.add(externalFile);
         return externalFile;
       }
     }
   }
   return null;
 }
Пример #3
0
 public String[] renderCommandLine(IEnvironment environment, String interpreter) {
   IFileHandle interpreterPath =
       PlatformFileUtils.findAbsoluteOrEclipseRelativeFile(environment, new Path(interpreter));
   IPath localPath = EnvironmentPathUtils.getLocalPath(interpreterPath.getFullPath());
   return renderCommandLine(environment, localPath);
 }