Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspaceRoot.findFilesForLocationURI()


        IPath result = null;

        File absolute = file.getCanonicalFile();

        IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
        IFile[] candidates = wsroot.findFilesForLocationURI(absolute.toURI());
        if (candidates != null && candidates.length > 0) {
            result = candidates[0].getFullPath();
        } else {
            String workspacePath = getWorkspace().getBase().getAbsolutePath();
            String absolutePath = absolute.getPath();
View Full Code Here


        return null;
    }

    public static IFile[] getWorkspaceFiles(File javaFile) {
        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        return root.findFilesForLocationURI(javaFile.toURI());
    }

    public static File toFile(IWorkspaceRoot root, IPath path) {
        IFile wsfile;
        IFolder wsfolder;
View Full Code Here

        IPath result = null;

        File absolute = file.getCanonicalFile();

        IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
        IFile[] candidates = wsroot.findFilesForLocationURI(absolute.toURI());
        if (candidates != null && candidates.length > 0) {
            result = candidates[0].getFullPath();
        } else {
            String workspacePath = getWorkspace().getBase().getAbsolutePath();
            String absolutePath = absolute.getPath();
View Full Code Here

        return null;
    }

    public static IFile getFileFromLocation(final String location) {
        final IWorkspaceRoot wr = ResourcesPlugin.getWorkspace().getRoot();
        final IFile[] f = wr.findFilesForLocationURI(URIUtil.toURI(location));
        if (f.length > 0) {
            return f[0];
        }
        return null;
    }
View Full Code Here

     * @return IFile object
     */
    public static IFile getFileFromPath(final IPath path) {
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        final IFile[] files = // root.findFilesForLocation(path);
        root.findFilesForLocationURI(org.eclipse.core.filesystem.URIUtil.toURI(path));

        if (files.length > 0) {
            return files[0];// else
        }
        return root.getFile(path);
View Full Code Here

                        String className = importUsedBy.getClazz().getFQN();
                        IType type = null;
                        if (selectedFiles != null) {
                            IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
                            for (File selectedFile : selectedFiles) {
                                IFile[] wsfiles = wsroot.findFilesForLocationURI(selectedFile.toURI());
                                for (IFile wsfile : wsfiles) {
                                    IJavaProject javaProject = JavaCore.create(wsfile.getProject());
                                    try {
                                        type = javaProject.findType(className);
                                        if (type != null)
View Full Code Here

    public void resourceChanged(IResourceChangeEvent event) {
        if (selectedFiles != null) {
            IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
            for (File file : selectedFiles) {
                IFile[] wsfiles = wsroot.findFilesForLocationURI(file.toURI());
                for (IFile wsfile : wsfiles) {
                    if (event.getDelta().findMember(wsfile.getFullPath()) != null) {
                        executeAnalysis();
                        break;
                    }
View Full Code Here

    super.performSaveAs(progressMonitor);
  }

  private IFile getWorkspaceFile(IFileStore fileStore) {
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    IFile[] files = workspaceRoot.findFilesForLocationURI(fileStore.toURI());
    if(files != null && files.length == 1)
      return files[0];
    return null;
  }
View Full Code Here

  }
  protected IResource getResource(IPath path) {
    if (path != null) {
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
      // look for files or folders with the given path
      IFile[] files = root.findFilesForLocationURI(path.toFile().toURI());
      if (files.length > 0) {
        return files[0];
      }
      IContainer[] containers = root.findContainersForLocationURI(path.toFile().toURI());
      if (containers.length > 0) {
View Full Code Here

  }
  protected IResource getResource(IPath path) {
    if (path != null) {
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
      // look for files or folders with the given path
      IFile[] files = root.findFilesForLocationURI(path.toFile().toURI());
      if (files.length > 0) {
        return files[0];
      }
      IContainer[] containers = root.findContainersForLocationURI(path.toFile().toURI());
      if (containers.length > 0) {
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.