Examples of IProjectDescription


Examples of org.eclipse.core.resources.IProjectDescription

    project.create(null);
    project.open(null);

    // configure nature
    IProjectDescription desc = project.getDescription();
    desc.setNatureIds(new String[] { PHPNature.ID });
    project.setDescription(desc, null);

    for (PdttFile pdttFile : filesMap.keySet()) {
      IFile file = createFile(pdttFile.getFile().trim());
      filesMap.put(pdttFile, file);
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

  public void before() throws CoreException {
    project = ResourcesPlugin.getWorkspace().getRoot().getProject("validator_preference"); //$NON-NLS-1$
    project.create(null);
    project.open(null);
   
    IProjectDescription desc = project.getDescription();
    desc.setNatureIds(new String[] {
        PHPNature.ID
    });
    project.setDescription(desc, null);
   
    scriptProject = DLTKCore.create(project);
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

    /**
     * Removes the given builder from the build spec for the given project.
     */
    protected void removeFromBuildSpec(final String builderID) throws CoreException {

        final IProjectDescription description = fProject.getDescription();
        final ICommand[] commands = description.getBuildSpec();
        for (int i = 0; i < commands.length; ++i) {
            if (commands[i].getBuilderName().equals(builderID)) {
                final ICommand[] newCommands = new ICommand[commands.length - 1];
                System.arraycopy(commands, 0, newCommands, 0, i);
                System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
                description.setBuildSpec(newCommands);
                fProject.setDescription(description, null);
                return;
            }
        }
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

        if (newProjectHandle.exists()) {
            throw new CoreException(Status.OK_STATUS);
        }

        final IProjectDescription description = workspace.newProjectDescription(name);
        description.setLocationURI(location);

        // // update the referenced project if provided
        if (referencedProjects != null) {
            description.setReferencedProjects(referencedProjects);
        }

        // create the new project operation
        final IRunnableWithProgress op = new IRunnableWithProgress() {
            @Override
            public void run(final IProgressMonitor monitor)
                    throws InvocationTargetException {

                final CreateProjectOperation op1 = new CreateProjectOperation(
                        description, WizardMessages.NewProject_windowTitle);
                try {
                    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=219901
                    // Making this undoable would be a bad idea
                    op1.execute(monitor, notifier);

                    newProjectHandle.open(monitor);
                    description.setNatureIds(new String[] { ErlangCore.NATURE_ID });
                    newProjectHandle.setDescription(description, null);

                    final BuilderTool builder = info.getBuilder();
                    ErlangNature.setErlangProjectBuilder(newProjectHandle, builder);
                    createBuilderConfig(builder);
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

            throws ErlModelException {
        final IWorkspace ws = ResourcesPlugin.getWorkspace();
        final IProject project = ws.getRoot().getProject(name);
        try {
            if (!project.exists()) {
                IProjectDescription description = ws.newProjectDescription(name);
                description.setLocation(new Path(path));
                project.create(description, null);
                project.open(null);

                description = project.getDescription();
                description.setNatureIds(new String[] { ModelPlugin.NATURE_ID });
                description.setName(name);
                project.setDescription(description, null);
            }
            if (!project.isOpen()) {
                project.open(null);
            }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

     * @param project
     *            to have sample nature added or removed
     */
    private void toggleNature(final IProject project) {
        try {
            final IProjectDescription description = project.getDescription();
            final String[] natures = description.getNatureIds();
            for (int i = 0; i < natures.length; ++i) {
                if (ErlangCore.NATURE_ID.equals(natures[i])) {
                    // Remove the nature
                    final String[] newNatures = new String[natures.length - 1];
                    System.arraycopy(natures, 0, newNatures, 0, i);
                    System.arraycopy(natures, i + 1, newNatures, i, natures.length - i
                            - 1);
                    description.setNatureIds(newNatures);
                    project.setDescription(description, null);

                    return;
                }
            }

            // Add the nature, it will be put first
            final String[] newNatures = new String[natures.length + 1];
            System.arraycopy(natures, 0, newNatures, 1, natures.length);
            newNatures[0] = ErlangCore.NATURE_ID;
            description.setNatureIds(newNatures);
            project.setDescription(description, null);

        } catch (final CoreException e) {
            ErlLogger.warn(e);
        }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule z2 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule z3 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(new IProject[] { project1
                    .getWorkspaceProject() });
            workspaceProject.setDescription(description, null);
            myProject.open(null);
            final IErlModule z4 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule z5 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule z6 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final String ww = "ww";
            final IErlModule w1 = model.findIncludeFromModule(module, ww, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlElementLocator mymodel = ErlangEngine.getInstance().getModel();
            final IErlModule w2 = mymodel.findIncludeFromProject(myProject, ww, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            // then
            // scope should be respected
            assertNotNull(x1);
            assertEquals(xxHrl, x1.getName());
            assertNotNull(x2);
            assertEquals(xxHrl, x2.getName());
            assertNotNull(x3);
            assertEquals(xxHrl, x3.getName());
            assertEquals(include, y1);
            assertEquals(include, y2);
            assertEquals(include, y3);
            assertNull(z1);
            assertEquals(referencedInclude, z2);
            assertNull(z3);
            assertNull(z4);
            assertEquals(referencedInclude, z5);
            assertEquals(referencedInclude, z6);
            assertEquals(includeInModuleDir, w1);
            assertNull(w2);
        } finally {
            if (externalIncludeFile != null && externalIncludeFile.exists()) {
                externalIncludeFile.delete();
            }
            ((ErlProject) myProject).setIncludeDirs(includeDirs);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(referencedProjects);
            workspaceProject.setDescription(description, null);
        }
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule z2 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule z3 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(new IProject[] { project1
                    .getWorkspaceProject() });
            workspaceProject.setDescription(description, null);
            aProject.open(null);
            final IErlModule z4 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule z5 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule z6 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            // then
            // scope should be respected
            assertNotNull(x1);
            assertEquals(xxErl, x1.getName());
            assertNotNull(x2);
            assertEquals(xxErl, x2.getName());
            assertNotNull(x3);
            assertEquals(xxErl, x3.getName());
            assertEquals(aModule, y1);
            assertEquals(aModule, y2);
            assertEquals(aModule, y3);
            assertNull(y4);
            assertEquals(aModule, y5);
            assertNull(y6);
            assertNull(z1);
            assertEquals(referencedModule, z2);
            assertNull(z3);
            assertNull(z4);
            assertEquals(referencedModule, z5);
            assertEquals(referencedModule, z6);
        } finally {
            if (externalModuleFile != null && externalModuleFile.exists()) {
                externalModuleFile.delete();
            }
            if (externalsFile != null && externalsFile.exists()) {
                externalsFile.delete();
            }
            ((ErlProject) aProject).setExternalModulesFile(externalModulesString);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(referencedProjects);
            workspaceProject.setDescription(description, null);
        }
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule zz2 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule zz3 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(new IProject[] { project1
                    .getWorkspaceProject() });
            workspaceProject.setDescription(description, null);
            aProject.open(null);
            final IErlModule zz4 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule zz5 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule zz6 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            // then
            // the non-external should be preferred
            assertNotNull(zz1);
            assertEquals(zzErl, zz1.getName());
            assertNotSame(referencedModule, zz1);
            assertEquals(referencedModule, zz2);
            assertNotNull(zz3);
            assertEquals(zzErl, zz3.getName());
            assertNotSame(referencedModule, zz3);
            assertNotNull(zz4);
            assertNotSame(referencedModule, zz4);
            assertEquals(referencedModule, zz5);
            assertEquals(referencedModule, zz6);
        } finally {
            if (externalModuleFile != null && externalModuleFile.exists()) {
                externalModuleFile.delete();
            }
            if (externalsFile != null && externalsFile.exists()) {
                externalsFile.delete();
            }
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(referencedProjects);
            workspaceProject.setDescription(description, null);
            ((ErlProject) aProject).setExternalModulesFile(externalModulesString);
        }
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule z2 = model.findIncludeFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule z3 = model.findIncludeFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(new IProject[] { project1
                    .getWorkspaceProject() });
            workspaceProject.setDescription(description, null);
            aProject.open(null);
            final IErlModule z4 = model.findIncludeFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule z5 = model.findIncludeFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule z6 = model.findIncludeFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            // then
            // scope should be respected
            assertNotNull(x1);
            assertEquals(xxHrl, x1.getName());
            assertNotNull(x2);
            assertEquals(xxHrl, x2.getName());
            assertNotNull(x3);
            assertEquals(xxHrl, x3.getName());
            assertEquals(include, y1);
            assertEquals(include, y2);
            assertEquals(include, y3);
            assertNull(y4);
            assertEquals(include, y5);
            assertNull(y6);
            assertNull(z1);
            assertEquals(referencedInclude, z2);
            assertNull(z3);
            assertNull(z4);
            assertEquals(referencedInclude, z5);
            assertEquals(referencedInclude, z6);
        } finally {
            if (externalIncludeFile != null && externalIncludeFile.exists()) {
                externalIncludeFile.delete();
            }
            ((ErlProject) aProject).setIncludeDirs(includeDirs);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(referencedProjects);
            workspaceProject.setDescription(description, null);
        }
    }
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.