Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspaceRoot


            final ILaunchConfiguration configuration) throws CoreException {
        final String projectNamesString = configuration.getAttribute(
                ErlRuntimeAttributes.PROJECTS, "");
        final String[] projectNames = projectNamesString.split(";");
        final List<IProject> projects = new ArrayList<IProject>();
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        for (final String s : projectNames) {
            if (s != null && s.length() > 0) {
                final IProject p = root.getProject(s);
                if (p != null) {
                    projects.add(p);
                }
            }
        }
View Full Code Here


        super(info, "run", getDefaultWorkingDir());
        projects = Lists.newArrayList();
    }

    private static String getDefaultWorkingDir() {
        final IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace().getRoot();
        return wroot.getLocation().toPortableString();
    }
View Full Code Here

     * @throws IOException
     *             if the given path could not be found on the workspace
     */
    private IFile findEclipseRepresentation(final String anOldPath) throws IOException {
        final IWorkspace workspace = ResourcesPlugin.getWorkspace();
        final IWorkspaceRoot root = workspace.getRoot();
        final Path p = new Path(anOldPath);
        @SuppressWarnings("deprecation")
        final IFile[] files = root.findFilesForLocation(p);
        if (files == null || files.length != 1) {
            throw new IOException("File not found");
        }

        return files[0];
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

     * @param path
     *            file path
     * @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);
        /*
         * if (file != null) return file;
         */
        /*
         * else throw new WranglerException("File not found!");
View Full Code Here

    Path baseIPath = new Path(basePath);
    IResource baseResource = FileBuffers.getWorkspaceFileAtLocation(baseIPath);

    if (baseResource == null) {
      IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
      // Try the base path as a folder first
      if (baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFolder(baseIPath);
      }
      // If not a folder, then try base path as a file
      if (baseResource != null && !baseResource.exists() && baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFile(baseIPath);
      }
      if (baseResource == null && baseIPath.segmentCount() == 1) {
        baseResource = workspaceRoot.getProject(baseIPath.segment(0));
      }
    }

    if (baseResource == null) {
      /*
 
View Full Code Here

   */
  private void createHtmlEditor()
  {
    IPath filepath = getFilePath("html");
   
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    if(root.exists(filepath))
    {
      try
      {
        FileEditorInput htmlEditorInput = new FileEditorInput(root.getFile(filepath));
        htmlEditor = new StructuredTextEditor();
       
        htmlEditorIndex = addPage(htmlEditor, htmlEditorInput);
        setPageText(htmlEditorIndex, htmlEditor.getTitle());
      } catch (PartInitException e) {
View Full Code Here

   */
  private void createCssEditor()
  {
    IPath filepath = getFilePath("css");
   
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    if(root.exists(filepath))
    {
      try
      {
        FileEditorInput cssEditorInput = new FileEditorInput(root.getFile(filepath));
        cssEditor = new StructuredTextEditor();
       
        cssEditorIndex = addPage(cssEditor, cssEditorInput);
        setPageText(cssEditorIndex, cssEditor.getTitle());
      } catch (PartInitException e) {
View Full Code Here

    String propertiesRegEx = String.format(PROPERTIES_REGEX, getFileNameWithoutExtension(javafile));
   
    propertiesEditors = new ArrayList<PropertiesFileEditor>();
    propertiesEditorIndexs = new ArrayList<Integer>();
   
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IFolder folder = root.getFolder(javafile.getFullPath().removeLastSegments(1));
    IResource[] members;
    try {
      members = folder.members();
    } catch (CoreException e1) {
      System.err.print("Folder members error");
View Full Code Here

   *
   * @return an array of IProject objects
   */
  public static List<IProject> getIProjects() {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();
    // get all projects in the workspace
    IProject[] projects = root.getProjects();

    return Arrays.asList(projects);
  }
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.