Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspaceRoot


    return javaProjects;
  }

  public IJavaProject getJavaProject(String projectName) {
    if (projectName != null && projectName.length() > 0) {
      IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
      IJavaModel javaModel = JavaCore.create(workspaceRoot);
      return javaModel.getJavaProject(projectName);
    } else {
      return null;
    }
View Full Code Here


    public void dialyzeWithExternalInclude() throws Exception {
        // http://www.assembla.com/spaces/erlide/tickets/608-dialyzer---navigate-to-external-includes-from-markers
        File externalFile = null;
        IErlProject erlProject = null;
        File externalIncludesFile = null;
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        try {
            // given
            // an erlang project and an external file not in any project
            final String projectName = "testproject";
            erlProject = createTmpErlProject(projectName);
            final String externalFileName = "external.hrl";
            externalFile = createTmpFile(externalFileName,
                    "f([_ | _]=L) ->\n    atom_to_list(L).\n");
            externalIncludesFile = createTmpFile("external_includes",
                    externalFile.getAbsolutePath());
            erlProject.getProperties().setExternalIncludesFile(
                    externalIncludesFile.getAbsolutePath());
            DialyzerMarkerUtils.removeDialyzerMarkersFor(root);
            // when
            // putting dialyzer warning markers on the external file
            final String message = "test message";
            final int lineNumber = 2;
            final IErlElementLocator model = ErlangEngine.getInstance().getModel();
            DialyzerMarkerUtils.addDialyzerWarningMarker(model,
                    externalFile.getAbsolutePath(), lineNumber, message);
            // then
            // the marker should have the proper file name and the include file
            // should appear in External Files
            final IMarker[] markers = root.findMarkers(
                    DialyzerMarkerUtils.DIALYZE_WARNING_MARKER, true,
                    IResource.DEPTH_INFINITE);
            assertThat(markers.length, is(greaterThan(0)));
            for (final IMarker marker : markers) {
                // for some reason, when running on Hudson, we get two identical
View Full Code Here

public class DirectorySelectUtil {

    public static IContainer chooseLocation(final String dialogTitle,
            final String labelText, final IProject project2, final String outputLocation,
            final Shell shell) {
        final IWorkspaceRoot root = project2.getWorkspace().getRoot();
        final Class<?>[] acceptedClasses = new Class[] { IProject.class, IFolder.class };
        final IProject[] allProjects = root.getProjects();
        final List<IProject> rejectedElements = new ArrayList<IProject>(
                allProjects.length);
        for (int i = 0; i < allProjects.length; i++) {
            if (!allProjects[i].equals(project2)) {
                rejectedElements.add(allProjects[i]);
            }
        }
        final ViewerFilter filter = new TypedViewerFilter(acceptedClasses,
                rejectedElements.toArray());

        final ILabelProvider lp = new WorkbenchLabelProvider();
        final ITreeContentProvider cp = new WorkbenchContentProvider();

        IResource initSelection = null;
        if (outputLocation != null) {
            initSelection = root.findMember(outputLocation);
        }

        final FolderSelectionDialog dialog = new FolderSelectionDialog(shell, lp, cp);
        dialog.setTitle(dialogTitle);
View Full Code Here

        // ErlLogger.debug("Generating a file with skeleton: "+skeleton);

        // create a sample file
        monitor.beginTask("Creating " + fileName, 2);
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        final IResource resource = root.findMember(containerFullPath);
        if (!resource.exists() || !(resource instanceof IContainer)) {
            throwCoreException("Container \"" + containerFullPath + "\" does not exist.");
        }
        final IContainer container = (IContainer) resource;
        IPath path = new Path(fileName);
View Full Code Here

 
  public void validateExistence() {
  }
 
  protected void buildStructure(final Body body, final Map<IHandle, Body> newElements) throws CoreException {
    IWorkspaceRoot _root = this.workspace.getRoot();
    final IProject[] projects = _root.getProjects();
    final List<IErlProject> erlProjects = CollectionLiterals.<IErlProject>newArrayList();
    for (final IProject project : projects) {
      boolean _and = false;
      boolean _isOpen = project.isOpen();
      if (!_isOpen) {
View Full Code Here

      throw Exceptions.sneakyThrow(_e);
    }
  }
 
  public IErlProject getProject(final String name) {
    IWorkspaceRoot _root = this.workspace.getRoot();
    IProject _project = _root.getProject(name);
    ErlangProjectProperties _erlangProjectProperties = new ErlangProjectProperties();
    return new ErlProject(this, _project, _erlangProjectProperties);
  }
View Full Code Here

     *
     * @return the container resource specified in the container name entry
     *         field, or <code>null</code>
     */
    protected IContainer getSpecifiedContainer() {
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        final IPath path = getContainerFullPath();
        if (root.exists(path)) {
            final IResource resource = root.findMember(path);
            if (resource.getType() == IResource.FILE) {
                return null;
            }
            return (IContainer) resource;
        }
View Full Code Here

        // ErlLogger.debug("Generating a file with skeleton: "+skeleton);

        // create a sample file
        monitor.beginTask("Creating " + fileName, 2);
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        final IResource resource = root.findMember(new Path(containerName));
        if (!resource.exists() || !(resource instanceof IContainer)) {
            throwCoreException("Container \"" + containerName + "\" does not exist.");
        }
        final IContainer container = (IContainer) resource;
        IPath path = new Path(fileName);
View Full Code Here

    }

    public List<IProject> getSelectedProjects() {
        final Object[] sel = projectsTable.getCheckedElements();
        final List<IProject> result = new ArrayList<IProject>();
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        for (final Object o : sel) {
            final String p = (String) o;
            result.add(root.getProject(p));
        }
        return result;
    }
View Full Code Here

    }

    public static Collection<IProject> getProjects(final String[] projectNames) {
        final Collection<IProject> result = Sets
                .newHashSetWithExpectedSize(projectNames.length);
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        for (final String i : projectNames) {
            final IProject project = root.getProject(i);
            result.add(project);
        }
        return result;
    }
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.