Examples of IFileStore


Examples of org.eclipse.core.filesystem.IFileStore

    if (getEditorInput() != null) {
      if (getEditorInput() instanceof FileStoreEditorInput) {
        FileStoreEditorInput fsei = (FileStoreEditorInput) getEditorInput();
        final URI targetURI = fsei.getURI();
        try {
          final IFileStore store = EFS.getStore(targetURI);
          setValidPartName(store.getName());
        } catch (CoreException e) {
          LogService.warning(e.getMessage(), e);
        }
      } else if (getEditorInput() instanceof IFileEditorInput) {
        IFile file = ((IFileEditorInput) getEditorInput()).getFile();
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

    }

    private IEditorPart openEditor(File file) {
        String editorId = getEditorId(file);
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        IFileStore fileStore;
        try {
            fileStore = EFS.getLocalFileSystem().getStore(new Path(file.getCanonicalPath()));
            IEditorInput input = new FileStoreEditorInput(fileStore);
            return page.openEditor(input, editorId);
        } catch (IOException e) {
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

   
    if(sourceModule.isWorkingCopy()) {
      try {
        IBuffer buffer = sourceModule.getBuffer();
        if(buffer != null) {
          IFileStore fileStore = tryCast(ReflectionUtils.readField(buffer, "fFileStore"), IFileStore.class);
          return fileStore.toLocalFile(0, null).toPath();
        }
      } catch (NoSuchFieldException e) {
      } catch (CoreException e) {
      }
    }
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

      IProgressMonitor monitor) throws CoreException {
   
    File bundleCacheDir = new File(getConfigDir(configuration),
        "bundle-cache");
    {
      IFileStore bundleCacheStore = EFS.getStore(bundleCacheDir.toURI());
      bundleCacheStore.delete(EFS.NONE, monitor);
    }
    if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA,
        false)) {
      File confDir = new File(getConfigDir(configuration), "conf");
      IFileStore confDirStore = EFS.getStore(confDir.toURI());
      confDirStore.delete(EFS.NONE, monitor);
    }
  }
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

    assertNotNull(workspace);
    ProjectInfo wp = metaStore.readProject(workspace.getUniqueId(), path.segment(2));
    assertNotNull(wp);
    String userId = workspace.getUserId();
    assertNotNull(userId);
    IFileStore fsStore = getProjectStore(wp, userId);
    fsStore = fsStore.getFileStore(path.removeFirstSegments(3));

    File file = new File(fsStore.toURI());
    if (RepositoryCache.FileKey.isGitRepository(file, FS.DETECTED)) {
      // 'file' is already what we're looking for
    } else if (RepositoryCache.FileKey.isGitRepository(new File(file, Constants.DOT_GIT), FS.DETECTED)) {
      file = new File(file, Constants.DOT_GIT);
    } else {
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

    return result;
  }

  // see org.eclipse.orion.internal.server.servlets.workspace.WorkspaceResourceHandler.generateProjectLocation(WebProject, String)
  private static IFileStore getProjectStore(ProjectInfo project, String user) throws CoreException {
    IFileStore projectStore = OrionConfiguration.getMetaStore().getDefaultContentLocation(project);
    if (!projectStore.fetchInfo().exists()) {
      projectStore.mkdir(EFS.NONE, null);
    }
    return projectStore;
  }
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

    if (allow) {
      // FIXME: this code is copied from NewFileServlet, fix it
      // start copied
      String pathInfo = path.toString();
      IPath filePath = pathInfo == null ? Path.ROOT : new Path(pathInfo);
      IFileStore file = tempGetFileStore(filePath);
      if (file == null || !file.fetchInfo().exists()) {
        if (failEarlyOn404) {
          return false;
        }
        handleException(resp, new ServerStatus(IStatus.ERROR, 404, NLS.bind("File not found: {0}", filePath), null));
        return true;
      }
      if (fileSerializer.handleRequest(req, resp, file)) {
        //return;
      }
      // end copied

      if (file != null) {
        addEditHeaders(resp, site, path);
        addContentTypeHeader(resp, file.getName());
      }
    }
    return true;
  }
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

      return;
    try {
      ProjectInfo project = getProjectForLocation(representation.getString(ProtocolConstants.KEY_LOCATION));
      if (project == null)
        return;
      IFileStore store = project.getProjectStore();
      // create repository in each project if it doesn't already exist
      File localFile = store.toLocalFile(EFS.NONE, null);
      File gitDir = GitUtils.getGitDir(localFile);
      if (gitDir == null) {
        gitDir = new File(localFile, Constants.DOT_GIT);
        Repository repo = null;
        try {
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

      return;
    JSONArray children = new JSONArray();
    //more efficient to ask for child information in bulk for certain file systems
    IFileInfo[] childInfos = dir.childInfos(EFS.NONE, null);
    for (IFileInfo childInfo : childInfos) {
      IFileStore childStore = dir.getChild(childInfo.getName());
      String name = childInfo.getName();
      if (childInfo.isDirectory())
        name += "/"; //$NON-NLS-1$
      URI childLocation = URIUtil.append(location, name);
      JSONObject childResult = ServletFileStoreHandler.toJSON(childStore, childInfo, childLocation);
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileStore

    //setup and precondition checks
    JSONObject requestObject = OrionServlet.readJSONRequest(request);
    String name = computeName(request, requestObject);
    if (name.length() == 0)
      return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, "File name not specified.", null));
    IFileStore toCreate = dir.getChild(name);
    if (!name.equals(toCreate.getName()) || name.contains(":"))
      return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, "Bad file name: " + name, null));
    int options = getCreateOptions(request);
    boolean destinationExists = toCreate.fetchInfo(EFS.NONE, null).exists();
    if (!validateOptions(request, response, toCreate, destinationExists, options))
      return true;
    //perform the operation
    if (performPost(request, response, requestObject, toCreate, options)) {
      //write the response
      URI location = URIUtil.append(getURI(request), name);
      JSONObject result = ServletFileStoreHandler.toJSON(toCreate, toCreate.fetchInfo(EFS.NONE, null), location);
      result.append("FileEncoding", System.getProperty("file.encoding"));
      OrionServlet.writeJSONResponse(request, response, result);
      response.setHeader(ProtocolConstants.HEADER_LOCATION, ServletResourceHandler.resovleOrionURI(request, location).toString());
      //response code should indicate if a new resource was actually created or not
      response.setStatus(destinationExists ? HttpServletResponse.SC_OK : HttpServletResponse.SC_CREATED);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.