Examples of IProjectDescription


Examples of org.eclipse.core.resources.IProjectDescription

    public void setProject(IProject project) {
        this.project = project;
    }

    public void configure() throws CoreException {
        final IProjectDescription desc = project.getDescription();
        addBuilder(desc);
        updateProject(desc, true);
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

        addBuilder(desc);
        updateProject(desc, true);
    }

    public void deconfigure() throws CoreException {
        IProjectDescription desc = project.getDescription();
        removeBuilder(desc);
        updateProject(desc, false);
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

     * @param project
     *            to have sample nature added or removed
     */
    private static void toggleNature(IProject project) {
        try {
            IProjectDescription description = project.getDescription();
            String[] natures = description.getNatureIds();

            for (int i = 0; i < natures.length; ++i) {
                if (BndtoolsConstants.NATURE_ID.equals(natures[i])) {
                    // Remove the nature
                    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
            ensureBndBndExists(project);
            String[] newNatures = new String[natures.length + 1];
            System.arraycopy(natures, 0, newNatures, 0, natures.length);
            newNatures[natures.length] = BndtoolsConstants.NATURE_ID;
            description.setNatureIds(newNatures);
            project.setDescription(description, null);
        } catch (CoreException e) {}
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

    @Override
    public void configureJavaProject(IProgressMonitor monitor) throws CoreException, InterruptedException {
        super.configureJavaProject(monitor);

        IProject project = getJavaProject().getProject();
        IProjectDescription desc = project.getDescription();
        String[] natures = desc.getNatureIds();
        for (String nature : natures) {
            if (BndtoolsConstants.NATURE_ID.equals(nature))
                return;
        }
        String[] newNatures = new String[natures.length + 1];
        System.arraycopy(natures, 0, newNatures, 0, natures.length);
        newNatures[natures.length] = BndtoolsConstants.NATURE_ID;
        desc.setNatureIds(newNatures);
        project.setDescription(desc, null);
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

        if (project == null) {
            throw new IllegalStateException(
                    "Project must be created before giving it a Java nature");
        }

        final IProjectDescription description = project.getDescription();
        final String[] natures = description.getNatureIds();
        final String[] newNatures = Arrays.copyOf(natures, natures.length + 1);
        newNatures[natures.length] = JavaCore.NATURE_ID;
        description.setNatureIds(newNatures);
        project.setDescription(description, null);
        final IJavaProject javaProject = JavaCore.create(project);
        @SuppressWarnings("rawtypes")
        final
        Map options = javaProject.getOptions(true);
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

        IFile classpathDestination = project.getFile(".classpath");
        if (classpathDestination.exists()) {
            classpathDestination.delete(true, monitor);
        }
        classpath.copy(classpathDestination.getFullPath(), true, monitor);
        final IProjectDescription description = project.getDescription();
        final String[] natures = description.getNatureIds();
        final String[] newNatures = Arrays.copyOf(natures, natures.length + 1);
        newNatures[natures.length] = JavaCore.NATURE_ID;
        description.setNatureIds(newNatures);
        project.setDescription(description, null);
        final IJavaProject javaProject = JavaCore.create(project);
        @SuppressWarnings("rawtypes")
        final Map options = javaProject.getOptions(true);
        // Compliance level need to be 1.6
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

    //    IProjectDescription description = getProject().getDescription();
    //    ICommand command = description.newCommand();
    //    command.setBuilderName(PLUGIN_ID + ".perlbuilder");
    //    System.out.println("Builder name: " + PLUGIN_ID+ ".perlbuilder");
    String BUILDER_ID = PLUGIN_ID + ".perlbuilder";
    IProjectDescription desc = project.getDescription();
    ICommand[] commands = desc.getBuildSpec();
    boolean found = false;

    for (int i = 0; i < commands.length; ++i) {
      if (commands[i].getBuilderName().equals(BUILDER_ID)) {
        found = true;
        break;
      }
    }
    if (!found) {
      // TODO remove debug output
      System.out.println("Builder added: " + PLUGIN_ID+ ".perlbuilder");
      //add builder to project
      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);
      project.setDescription(desc, null);
    }
  }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

    }

    public static void makeSigilProject(IProject project, IProgressMonitor monitor)
        throws CoreException
    {
        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] = SigilCore.NATURE_ID;
        description.setNatureIds(newNatures);

        ICommand sigilBuild = description.newCommand();
        sigilBuild.setBuilderName(SigilCore.BUILDER_ID);

        ICommand javaBuild = description.newCommand();
        javaBuild.setBuilderName(JavaCore.BUILDER_ID);

        description.setBuildSpec(new ICommand[] { javaBuild, sigilBuild });

        project.setDescription(description, new SubProgressMonitor(monitor, 2));

        IJavaProject java = JavaCore.create(project);
        if (java.exists())
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

        this.project = project;
    }

    public void addNatures(String... naturesToAdd) throws CoreException {

        IProjectDescription desc = project.getDescription();
        String[] natures = desc.getNatureIds();
        String[] newNatures = new String[natures.length + naturesToAdd.length];
        System.arraycopy(natures, 0, newNatures, 0, natures.length);
        for (int i = 0; i < naturesToAdd.length; i++) {
            newNatures[natures.length + i] = naturesToAdd[i];
        }
        desc.setNatureIds(newNatures);

        project.setDescription(desc, new NullProgressMonitor());

    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

public class RemoveNatureHandler extends AbstractHandler {

  private void removeNature(IProject project) {
    try {
      IProjectDescription description = project.getDescription();
      String[] natures = description.getNatureIds();

      for (int i = 0; i < natures.length; ++i) {
        if (PlayNature.NATURE_ID.equals(natures[i])) {
          // Remove the nature
          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;
        }
      }
    } catch (CoreException e) {
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.