Package org.eclipse.core.filesystem

Examples of org.eclipse.core.filesystem.IFileInfo


      public void run() {
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (window == null)
          return;
        IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(path));
        IFileInfo fetchInfo = fileStore.fetchInfo();
        if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
          IWorkbenchPage page = window.getActivePage();
          if (page == null) {
            String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_noWindow, path);
            MessageDialog.open(MessageDialog.ERROR, window.getShell(),
                IDEWorkbenchMessages.OpenDelayedFileAction_title,
View Full Code Here


        if (filePath != null) {
            final IPath path = new Path(filePath);
            IFileStore fileStore = EFS.getLocalFileSystem().getStore(
                    path.removeLastSegments(1));
            fileStore = fileStore.getChild(path.lastSegment());
            final IFileInfo fetchInfo = fileStore.fetchInfo();
            if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
                if (element instanceof IErlModule
                        && element.getParent() instanceof IErlExternal) {
                    return new ErlangExternalEditorInput(fileStore, (IErlModule) element);
                }
                return new FileStoreEditorInput(fileStore);
View Full Code Here

    private static IFile resolveFile(final IFile file) {
        IFile result = file;
        if (file.getResourceAttributes().isSymbolicLink()) {
            try {
                final File f = new File(file.getLocation().toString());
                final IFileInfo info = EFS.getFileSystem(EFS.SCHEME_FILE)
                        .fromLocalFile(f).fetchInfo();
                final String target = info.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET);
                if (target != null) {
                    // FIXME this is wrong in the general case
                    // find the file in the externals!
                    result = (IFile) file.getParent().findMember(target);
                    if (result == null) {
View Full Code Here

      try {
        File localFile = store.getLocalFile();
        if (logger.isDebugEnabled())
          logger.debug("[" + uri + "]: Downloading to " + (localFile == null ? "(null)" : localFile.toString()));
        HDFSManager.INSTANCE.startServerOperation(uri.toString());
        final IFileInfo serverInfo = store.fetchInfo();
        if (serverInfo.exists()) {
          monitor.beginTask("Downloading " + uri.toString(), (int) serverInfo.getLength());
          if (!localFile.exists()) {
            localFile.getParentFile().mkdirs();
            localFile.createNewFile();
          }
          InputStream openInputStream = store.openRemoteInputStream(EFS.NONE, new NullProgressMonitor());
          FileOutputStream fos = new FileOutputStream(localFile);
          try {
            if (!monitor.isCanceled()) {
              byte[] data = new byte[8 * 1024];
              int totalRead = 0;
              int read = openInputStream.read(data);
              while (read > -1) {
                if (monitor.isCanceled())
                  throw new InterruptedException();
                fos.write(data, 0, read);
                totalRead += read;
                monitor.worked(read);
                read = openInputStream.read(data);
                if (logger.isDebugEnabled())
                  logger.debug("Downloaded " + totalRead + " out of " + serverInfo.getLength() + " [" + (((float)totalRead*100.0f) / (float)serverInfo.getLength())
                      + "]");
              }
            }
          } catch (IOException e) {
            throw e;
View Full Code Here

        if (location == null) {
            result.addFatalError(String.format("The location for file %s is unknown", path));
            return result;
        }

        IFileInfo jFile = EFS.getStore(location).fetchInfo();
        if (jFile.exists()) {
            result.addFatalError(String.format("File %s already exists", path));
            return result;
        }
        return result;
    }
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

    return locationInFileSystem(path);
  }

  private String locationInFileSystem(IPath path) {
    IFileSystem fileSystem = EFS.getLocalFileSystem();
    IFileInfo fileInfo = fileSystem.getStore(path).fetchInfo();
    if (!fileInfo.isDirectory()) {
      return null;
    }
    return value;
  }
View Full Code Here

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

    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

            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

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.