Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspaceRoot


        }
        return null;
    }

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


            return null;
        }

        IPath bundlePath = path;
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IWorkspaceRoot root = workspace.getRoot();
        IResource resource = root.findMember(path);
        if (resource != null) {
            bundlePath = resource.getLocation();
        }

        JarInputStream jarStream = null;
View Full Code Here

      @Override
      public String isValid(Object selection) {
        if (!(selection instanceof IPath)) {
                    return "Please select a valid import location";
        }
        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                IContainer container = (IContainer) root.findMember((IPath) selection);
        if (container instanceof IProject) {
          return "Please select a folder inside the project";
        }
       
                if (!ProjectHelper.isContentProject(container.getProject())) {
View Full Code Here

    }

    private void handleContainerBrowseButtonPressed() {
        IPath result = queryForLocation(project, "Select a location to import data to", "Select location");
      if (result!=null) {
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
            importRoot = (IFolder) root.findMember(result);
            project = importRoot.getProject();
         
            containerNameField.setText(importRoot.getFullPath().toPortableString());
            repositoryCombo.setProject(project);
            repositoryCombo.refreshRepositoryList(new NullProgressMonitor());
View Full Code Here

        else
            workspaceInitCallbackQueue.add(callback);
    }

    private static File getWorkspaceDirectory() throws CoreException {
        IWorkspaceRoot eclipseWorkspace = ResourcesPlugin.getWorkspace().getRoot();

        IProject cnfProject = eclipseWorkspace.getProject("bnd");
        if (!cnfProject.exists())
            cnfProject = eclipseWorkspace.getProject("cnf");

        if (cnfProject.exists()) {
            if (!cnfProject.isOpen())
                cnfProject.open(null);
            return cnfProject.getLocation().toFile().getParentFile();
        }

        // Have to assume that the eclipse workspace == the bnd workspace,
        // and cnf hasn't been imported yet.
        return eclipseWorkspace.getLocation().toFile();
    }
View Full Code Here

    public static IPath toPath(File file) throws Exception {
        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

        } catch (Exception e) {
            logger.logError("Internal error querying projects.", e);
            return Collections.emptyList();
        }
        List<IProject> result = new ArrayList<IProject>(projects.size());
        IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
        for (Project project : projects) {
            IProject iproject = workspaceRoot.getProject(project.getName());
            if (iproject != null && iproject.isOpen()) {
                result.add(iproject);
            }
        }
        return result;
View Full Code Here

        if (IFile.class.equals(adapter)) {
            try {
                File file = getFile();
                if (file != null) {
                    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                    result = root.getFileForLocation(new Path(file.getAbsolutePath()));
                }
            } catch (Exception e) {
                logger.logError(MessageFormat.format("Failed to query repository {0} for bundle {1}.", repo.getName(), bsn), e);
            }
        } else if (File.class.equals(adapter)) {
View Full Code Here

        if (file != null) {
            if (IFile.class.equals(adapter)) { // ||
                // IResource.class.equals(adapter))
                // {
                // Note that if the file is outside the workspace the IFile result will be null
                IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                result = root.getFileForLocation(new Path(file.getAbsolutePath()));
            } else if (File.class.equals(adapter)) {
                result = file;
            } else if (URI.class.equals(adapter)) {
                result = file.toURI();
            }
View Full Code Here

        List<ExportedPackage> exports = new ArrayList<ExportedPackage>();
        List<VersionedClause> buildPath = new ArrayList<VersionedClause>();

        // Add JARs to project build path
        IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
        Collection<IPath> paths = classPathPage.getPaths();
        if (paths != null && !paths.isEmpty()) {
            int workRemaining = paths.size();
            SubMonitor progress = SubMonitor.convert(monitor, workRemaining);
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IWorkspaceRoot

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.