Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IProjectDescription


                if (defaultPath.equals(newPath)) {
                    newPath = null;
                }

                IWorkspace workspace = ResourcesPlugin.getWorkspace();
                final IProjectDescription description =
                        workspace.newProjectDescription(newProjectHandle.
                        getName());
                description.setLocation(newPath);

                // create the new project operation
                WorkspaceModifyOperation op =
                        new WorkspaceModifyOperation() {
                            protected void execute(IProgressMonitor monitor)
View Full Code Here


     */
    public void addMCSNature(IProject project)
            throws CoreException {

        try {
            IProjectDescription description = project.getDescription();
            String[] natures = description.getNatureIds();
            String[] newNatures = new String[natures.length + 1];
            System.arraycopy(natures, 0, newNatures, 0, natures.length);
            newNatures[natures.length] = BuilderPlugin.NATURE_ID;
            description.setNatureIds(newNatures);
            project.setDescription(description, null);
        } catch (CoreException e) {
            EclipseCommonPlugin.handleError(BuilderPlugin.getDefault(), e);
        }
    }
View Full Code Here

           MCSProjectNature nature = new MCSProjectNature();
           nature.setProject(project);
           nature.configure();

           // Add the nature to the project.
           IProjectDescription projectDescription = project.getDescription();
           String natureIds [] = projectDescription.getNatureIds();
           // Create an ArrayList out of the asList() method because the
           // asList() method provides an immutable list.
           List natureIdList = new ArrayList(Arrays.asList(natureIds));
           natureIdList.add(MCSProjectNature.NATURE_ID);
           String newNatureIds [] = new String[natureIdList.size()];
           natureIdList.toArray(newNatureIds);
           projectDescription.setNatureIds(newNatureIds);
           project.setDescription(projectDescription, null);
       }
View Full Code Here

           MCSProjectNature nature = new MCSProjectNature();
           nature.setProject(project);
           nature.configure();

           // Add the nature to the project.
           IProjectDescription projectDescription = project.getDescription();
           String natureIds [] = projectDescription.getNatureIds();
           // Create an ArrayList out of the asList() method because the
           // asList() method provides an immutable list.
           List natureIdList = new ArrayList(Arrays.asList(natureIds));
           natureIdList.remove(MCSProjectNature.NATURE_ID);
           String newNatureIds [] = new String[natureIdList.size()];
           natureIdList.toArray(newNatureIds);
           projectDescription.setNatureIds(newNatureIds);
           project.setDescription(projectDescription, null);
       }
View Full Code Here

                // refresh.
                mcsProject.refreshLocal(IResource.DEPTH_INFINITE,
                        null);
            }

            IProjectDescription description = mcsProject.getDescription();
            String[] natures = description.getNatureIds();
            String[] newNatures = new String[natures.length + 1];
            System.arraycopy(natures, 0, newNatures, 0, natures.length);
            newNatures[natures.length] = BuilderPlugin.NATURE_ID;
            description.setNatureIds(newNatures);
            mcsProject.setDescription(description, null);
        } catch (CoreException e) {
            success = false;
        }
        return success;
View Full Code Here

     * builder with this MCSProjectNature.
     *
     * @throws org.eclipse.core.runtime.CoreException  Never thrown at present
     */
    public void configure() throws CoreException {
        IProjectDescription desc = getProject().getDescription();
        ICommand[] commands = desc.getBuildSpec();
        boolean found = false;
        for (int i = 0; !found && (i < commands.length); i++) {
            if (commands[i].getBuilderName().equals(BUILDER_ID)) {
                found = true;
            }
        }
        if (!found) {
            ICommand command = desc.newCommand();
            command.setBuilderName(BUILDER_ID);
            ICommand[] newCommands = new ICommand[commands.length + 1];

            // Add it before other builders.
            System.arraycopy(commands, 0, newCommands, 1, commands.length);
            newCommands[0] = command;
            desc.setBuildSpec(newCommands);
            getProject().setDescription(desc, null);
        }
    }
View Full Code Here

            }
            f = new File(locationAsFile, ".classpath");
            if (f.exists()) {
                f.delete();
            }
            IProjectDescription pid = workspace
                .newProjectDescription(_projectName);
            String natures[] = { "org.eclipse.jdt.core.javanature" };
            pid.setNatureIds(natures);
            pid.setLocation(null);

            proj.create(pid, monitor);
            final IJavaProject javaProj = JavaCore.create(proj);
            if (!proj.isOpen()) {
                proj.open(monitor);
View Full Code Here

      }
    }

    private void configureBuilder(final IProject project) {
        try {
            final IProjectDescription desc = project.getDescription();
            final ICommand[] commands = desc.getBuildSpec();

            for (ICommand element : commands) {
                if (element.getBuilderName().equals("ltp_builder")) {
            return;
          }
View Full Code Here

      }
      monitor.beginTask("Updating UIMA Ruta project...", projects.size());
      for (IProject each : projects) {
        // update old projects
        try {
          IProjectDescription description = each.getDescription();
          String[] natureIds = description.getNatureIds();
          int counter = 0;
          boolean oldProject = false;
          for (String id : Arrays.asList(natureIds)) {
            if (id.equals("org.apache.uima.textmarker.ide.nature")) {
              natureIds[counter] = RutaNature.NATURE_ID;
              oldProject = true;
            }
            counter++;
          }
          if (oldProject) {
            description.setNatureIds(natureIds);
            each.setDescription(description, monitor);
            List<File> files = getFiles(new File(each.getLocation().toPortableString()));
            for (File file : files) {
              String absolutePath = file.getAbsolutePath();
              if (file.getName().endsWith(".tm")) {
View Full Code Here

        this.addPage(mainPage);
    }

    private IProject createNewProject() throws Exception {
        final IProject newProject = mainPage.getProjectHandle();
        final IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(newProject.getName());
        if (!mainPage.useDefaults()) {
            description.setLocation(mainPage.getLocationPath());
        }
        description.setNatureIds(new String[]{ JavaCore.NATURE_ID });

        WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
            @Override
            protected void execute(IProgressMonitor monitor) throws CoreException {
                try {
View Full Code Here

TOP

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

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.