Package org.eclipse.core.internal.filesystem.local

Examples of org.eclipse.core.internal.filesystem.local.LocalFile


        result = getUniqueDirectory(cacheDir, false);
      } else {
        result = File.createTempFile(source.getFileSystem().getScheme(), "efs", cacheDir); //$NON-NLS-1$
      }
      monitor.worked(25);
      IFileStore resultStore = new LocalFile(result);
      source.copy(resultStore, EFS.OVERWRITE, Policy.subMonitorFor(monitor, 25));
      result.deleteOnExit();
      return result;
    } catch (IOException e) {
      Policy.error(EFS.ERROR_WRITE, NLS.bind(Messages.couldNotWrite, toString()));
View Full Code Here


   * Performs initial cleanup of any old cached state left over from previous
   * sessions.
   */
  private void cleanOldCache(File cacheParent) throws CoreException {
    //clear any old cache - this could be moved to a background thread
    new LocalFile(cacheParent).delete(EFS.NONE, null);
  }
View Full Code Here

      String randomName = UUID.randomUUID().toString();
      tmp = File.createTempFile(randomName, ".zip"); //$NON-NLS-1$

      /* check whether the application store is a war file */
      if (applicationStore.getName().endsWith(".war")) { //$NON-NLS-1$
        applicationStore.copy(new LocalFile(tmp), EFS.OVERWRITE, null);
        return tmp;
      }

      /* check whether the application store contains a war file */
      for (IFileStore child : applicationStore.childStores(EFS.NONE, null)) {
        if (child.getName().endsWith(".war")) { //$NON-NLS-1$
          child.copy(new LocalFile(tmp), EFS.OVERWRITE, null);
          return tmp;
        }
      }

      /* war is not the answer, zip application contents */
 
View Full Code Here

          return new Object[] { openable };
        }

        File file = new File(fileName);
        if (file.exists()) {
          return new Object[] { new LocalFile(file) };
        }

        // try a phar
        final PharPath pharPath = PharPath.getPharPath(new Path(
            fileName));
View Full Code Here

      }
    }

    if (obj instanceof LocalFile && element instanceof IStackFrame) {
      IStackFrame stackFrame = (IStackFrame) element;
      LocalFile localFile = (LocalFile) obj;
      IProject project = null;
      try {
        if (stackFrame.getLaunch() != null
            && stackFrame.getLaunch().getLaunchConfiguration() != null) {
          String file = stackFrame
              .getLaunch()
              .getLaunchConfiguration()
              .getAttribute(IPHPDebugConstants.ATTR_FILE,
                  (String) null);
          if (file != null) {
            IWorkspaceRoot workspaceRoot = ResourcesPlugin
                .getWorkspace().getRoot();
            IResource resource = workspaceRoot.findMember(file);
            if (resource != null) {
              project = resource.getProject();
            }
          }
        }
      } catch (CoreException e1) {
      }
      if (project != null) {
        IDebugTarget debugTarget = (IDebugTarget) stackFrame
            .getDebugTarget();
        try {
          ProjectDescription desc = ((Project) project)
              .internalGetDescription();
          if (desc != null) {
            HashMap links = desc.getLinks();
            if (links != null) {

              for (Entry entry : (Set<Entry>) links.entrySet()) {
                IPath relativePath = (IPath) entry.getKey();
                LinkDescription linkDescription = (LinkDescription) entry
                    .getValue();
                IPath linkPath = new Path(linkDescription
                    .getLocationURI().getPath());
                IPath filePath = new Path(localFile
                    .toLocalFile(EFS.NONE, null)
                    .getAbsolutePath());
                if (linkPath.isPrefixOf(filePath)) {
                  filePath = filePath.removeFirstSegments(
                      linkPath.segmentCount()).setDevice(
View Full Code Here

  /**
   * Change to executable permissions for non-windows machines.
   */
  public static void changePermissions(File file) {
    if (!Platform.getOS().equals(Platform.OS_WIN32)) {
      LocalFile localFile = new LocalFile(file);
      IFileInfo info = localFile.fetchInfo();
      if (!info.getAttribute(EFS.ATTRIBUTE_EXECUTABLE)) {
        info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true);
        try {
          localFile.putInfo(info, EFS.SET_ATTRIBUTES, null);
        } catch (CoreException e) {
          Logger.logException(e);
        }
      }
    }
View Full Code Here

      phpIniFile = new File(tempDir, PHP_INI_FILE);
      phpIniFile.createNewFile();
      phpIniFile.deleteOnExit();

      if (originalPHPIniFile != null && originalPHPIniFile.exists()) {
        new LocalFile(originalPHPIniFile).copy(
            new LocalFile(phpIniFile), EFS.OVERWRITE,
            new NullProgressMonitor());
      }

      appendDefaultPHPIniContent(phpIniFile);
    } catch (Exception e) {
View Full Code Here

      HashMap<String, String> map = new HashMap<String, String>();
      map.put("$nl$", Platform.getNL()); //$NON-NLS-1$
      URL url = FileLocator.find(provider.getPlugin().getBundle(),
          provider.getPath(project), map);
      File sourceFile = new File(FileLocator.toFileURL(url).getPath());
      LocalFile sourceDir = new LocalFile(sourceFile);

      IPath targetPath = LanguageModelInitializer.getTargetLocation(
          provider, Path.fromOSString(sourceFile.getAbsolutePath()),
          project);
      LocalFile targetDir = new LocalFile(targetPath.toFile());

      IFileInfo targetInfo = targetDir.fetchInfo();
      boolean update = !targetInfo.exists();
      if (!update) {
        IFileInfo sourceInfo = sourceDir.fetchInfo();
        update = targetInfo.getLastModified() < sourceInfo
            .getLastModified();
      }

      if (update) {
        targetDir.delete(EFS.NONE, new NullProgressMonitor());
        sourceDir.copy(targetDir, EFS.NONE, new NullProgressMonitor());
      }

      return targetPath;
View Full Code Here

      }

      // Support external files opened using File -> Open
      File localFile = new File(location);
      if (localFile.exists()) {
        return new FileStoreEditorInput(new LocalFile(localFile));
      }
    } catch (CoreException e) {
      DLTKUIPlugin.log(e);
    }
    return null;
View Full Code Here

TOP

Related Classes of org.eclipse.core.internal.filesystem.local.LocalFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.