Examples of IFileInfo


Examples of org.eclipse.core.filesystem.IFileInfo

   */
  protected boolean isSystemFileReadOnly(FileInfo info)  {
    IFileStore fileStore= getFileStore(info);
    if (fileStore == null)
      return false;
    IFileInfo fileInfo= fileStore.fetchInfo();
    return fileInfo.exists() && fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY);
  }
View Full Code Here

Examples of org.eclipse.core.filesystem.IFileInfo

    if (path == null)
      return;

    IFileStore fileStore= EFS.getLocalFileSystem().getStore(new Path(path));
    IFileInfo fileInfo= fileStore.fetchInfo();

    if (fileInfo.getAttribute(EFS.ATTRIBUTE_HIDDEN)) {
      String title= TextEditorTemplateMessages.TemplatePreferencePage_export_error_title;
      String message= NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_error_hidden, fileStore.toString());
      MessageDialog.openError(getShell(), title, message);
      return;
    }

    if (fileInfo.exists() && fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY)) {
      String title= TextEditorTemplateMessages.TemplatePreferencePage_export_error_title;
      String message= NLSUtility.format(TextEditorTemplateMessages.TemplatePreferencePage_export_error_canNotWrite, fileStore.toString());
      MessageDialog.openError(getShell(), title, message);
      return;
    }

    if (!fileInfo.exists() || confirmOverwrite(fileStore)) {
      OutputStream output= null;
      try {
        output= new BufferedOutputStream(fileStore.openOutputStream(EFS.NONE, null));
        TemplateReaderWriter writer= new TemplateReaderWriter();
        writer.save(templates, output);
View Full Code Here

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

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

Examples of org.eclipse.core.filesystem.IFileInfo

    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

Examples of org.eclipse.core.filesystem.IFileInfo

      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

Examples of org.eclipse.core.filesystem.IFileInfo

      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

Examples of org.eclipse.core.filesystem.IFileInfo

  /**
   * 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

Examples of org.eclipse.core.filesystem.IFileInfo

  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

Examples of org.eclipse.core.filesystem.IFileInfo

  @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
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.