Package org.eclipse.core.filesystem

Examples of org.eclipse.core.filesystem.IFileInfo


            StringBuffer notFound = new StringBuffer();
            IWorkbenchPage page = window.getActivePage();
            for ( String name : names )
            {
                IFileStore fileStore = EFS.getLocalFileSystem().getStore( new Path( filterPath ) ).getChild( name );
                IFileInfo fetchInfo = fileStore.fetchInfo();
                if ( !fetchInfo.isDirectory() && fetchInfo.exists() )
                {
                    try
                    {
                        IDE.openEditorOnFileStore( page, fileStore );
                    }
View Full Code Here


    dir.delete(EFS.NONE, null);
    return true;
  }

  private boolean handlePut(HttpServletRequest request, HttpServletResponse response, IFileStore dir) throws JSONException, IOException, CoreException {
    IFileInfo info = ServletFileStoreHandler.fromJSON(request);
    dir.putInfo(info, EFS.NONE, null);
    return true;
  }
View Full Code Here

      handler = genericFileSerializer;
    return handler.handleRequest(request, response, file);
  }

  public boolean handleRequest(HttpServletRequest request, HttpServletResponse response, IFileStore file) throws ServletException {
    IFileInfo fileInfo;
    try {
      fileInfo = file.fetchInfo(EFS.NONE, null);
    } catch (CoreException e) {
      if (handleAuthFailure(request, response, e))
        return true;
      //assume file does not exist
      fileInfo = new FileInfo(file.getName());
      ((FileInfo) fileInfo).setExists(false);
    }
    if (!request.getMethod().equals("PUT") && !fileInfo.exists()) //$NON-NLS-1$
      return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, 404, NLS.bind("File not found: {0}", EncodingUtils.encodeForHTML(request.getPathInfo())), null));
    if (fileInfo.isDirectory())
      return handleDirectory(request, response, file);
    return handleFile(request, response, file);
  }
View Full Code Here

      return;
    }
    IFileStore file = getFileStore(req, path);
    IFileStore testLink = file;
    while (testLink != null) {
      IFileInfo info = testLink.fetchInfo();
      if (info.getAttribute(EFS.ATTRIBUTE_SYMLINK)) {
        if (file == testLink) {
          handleException(resp, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_FORBIDDEN, NLS.bind("Forbidden: {0}", EncodingUtils.encodeForHTML(pathInfo.toString())), null));
        } else {
          handleException(resp, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, NLS.bind("File not found: {0}", EncodingUtils.encodeForHTML(pathInfo.toString())), null));
        }
View Full Code Here

  /**
   * Creates a new directory in the server's local file system at the root location for the file servlet.
   */
  protected IFileStore createDirectory(String path) throws CoreException {
    IFileInfo info = null;
    URI location = makeLocalPathAbsolute(path);
    IFileStore dir = EFS.getStore(location);
    dir.mkdir(EFS.NONE, null);
    info = dir.fetchInfo();
    assertTrue("Coudn't create directory " + path, info.exists() && info.isDirectory());

    return dir;
  }
View Full Code Here

  protected static IFileStore createFile(URI uri, String fileContent) throws CoreException {
    IFileStore outputFile = EFS.getStore(uri);
    outputFile.delete(EFS.NONE, null);
    InputStream input = new ByteArrayInputStream(fileContent.getBytes());
    transferData(input, outputFile.openOutputStream(EFS.NONE, null));
    IFileInfo info = outputFile.fetchInfo();
    assertTrue("Coudn't create file " + uri, info.exists() && !info.isDirectory());

    return outputFile;
  }
View Full Code Here

  @Override
  public void delete(int options, IProgressMonitor monitor) throws CoreException {
    SynchronizedChannel channel = getChannel();
    try {
      //we need to know if we are a directory or file, but used the last fetched info if available
      IFileInfo info = cachedInfo;
      //use local field in case of concurrent change to cached info
      if (info == null)
        info = fetchInfo();
      if (info.isDirectory())
        channel.rmdir(getPathString(channel));
      else
        channel.rm(getPathString(channel));
    } catch (Exception e) {
      ChannelCache.flush(host);
View Full Code Here

      return super.isModifiable(element);
  }

  public boolean isReadOnly(Object element) {
    if (element instanceof FileStoreEditorInput) {
      IFileInfo info = fileInfoMap.get(element);
      if (info == null)
        return true// fail safe
      return info.getAttribute(EFS.ATTRIBUTE_READ_ONLY);
    } else
      return super.isReadOnly(element);
  }
View Full Code Here

            StringBuffer notFound = new StringBuffer();
            IWorkbenchPage page = window.getActivePage();
            for ( String name : names )
            {
                IFileStore fileStore = EFS.getLocalFileSystem().getStore( new Path( filterPath ) ).getChild( name );
                IFileInfo fetchInfo = fileStore.fetchInfo();
                if ( !fetchInfo.isDirectory() && fetchInfo.exists() )
                {
                    try
                    {
                        IDE.openEditorOnFileStore( page, fileStore );
                    }
View Full Code Here

            IResource resource = resources[i];
            if (resource != null) {
                URI location = resource.getLocationURI();
                String message = null;
                if (location != null) {
                    IFileInfo info = IDEResourceInfoUtils.getFileInfo(location);
                    if (info == null || info.exists() == false) {
                        if (resource.isLinked()) {
                            message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_missingLinkTarget,
                                    resource.getName());
                        } else {
                            message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_resourceDeleted,
View Full Code Here

TOP

Related Classes of org.eclipse.core.filesystem.IFileInfo

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.