Examples of IProjectDescription


Examples of org.eclipse.core.resources.IProjectDescription

   * @param project
   *            to have sample nature added or removed
   */
  private void addNature(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])) {
          return;
        }
      }

      // Add the nature
      String[] newNatures = new String[natures.length + 1];
      System.arraycopy(natures, 0, newNatures, 1, natures.length);
      newNatures[0] = PlayNature.NATURE_ID;
      description.setNatureIds(newNatures);
      project.setDescription(description, null);
    } catch (CoreException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

   * @param project
   *            to have sample nature added or removed
   */
  private void addNature(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])) {
          return;
        }
      }

      // Add the nature
      String[] newNatures = new String[natures.length + 1];
      System.arraycopy(natures, 0, newNatures, 1, natures.length);
      newNatures[0] = PlayNature.NATURE_ID;
      description.setNatureIds(newNatures);
      project.setDescription(description, null);
    } catch (CoreException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

   * @param project
   *            to have sample nature added or removed
   */
  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

Examples of org.eclipse.core.resources.IProjectDescription


  @Override
  public void configure() throws CoreException {
    System.out.println("configure Japid Nature ");
    IProjectDescription desc = project.getDescription();
    ICommand[] commands = desc.getBuildSpec();

    for (int i = 0; i < commands.length; ++i) {
      if (commands[i].getBuilderName().equals(PlayBuilder.BUILDER_ID)) {
        return;
      }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 1, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(PlayBuilder.BUILDER_ID);
    newCommands[0] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
  }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

   *
   * @see org.eclipse.core.resources.IProjectNature#deconfigure()
   */
  @Override
  public void deconfigure() throws CoreException {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    for (int i = 0; i < commands.length; ++i) {
      if (commands[i].getBuilderName().equals(PlayBuilder.BUILDER_ID)) {
        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);
        project.setDescription(description, null);
        return;
      }
    }
  }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

    javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);
  }

  private static IJavaProject createJavaProject(IProject project)
      throws CoreException {
    IProjectDescription description = project.getDescription();
    description.setNatureIds(new String[] { JavaCore.NATURE_ID });
    project.setDescription(description, null);

    IJavaProject javaProject = JavaCore.create(project);
    return javaProject;
  }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

        this.logger = logger;
    }

    public void enableValidationBuilderAndCommand(IProject project, IProgressMonitor monitor) throws CoreException {

        IProjectDescription description = project.getDescription();
        ICommand[] builders = description.getBuildSpec();
        for (ICommand builder : builders) {
            if (builder.getBuilderName().equals(VALIDATION_BUILDER_NAME)) {
                logger.trace("Validation builder already installed, skipping");
                return;
            }
        }

        logger.trace("Installing validation builder");

        ICommand[] newBuilders = new ICommand[builders.length + 1];
        System.arraycopy(builders, 0, newBuilders, 0, builders.length);
        ICommand validationCommand = description.newCommand();
        validationCommand.setBuilderName(VALIDATION_BUILDER_NAME);
        newBuilders[newBuilders.length - 1] = validationCommand;

        description.setBuildSpec(newBuilders);

        project.setDescription(description, monitor);

        logger.trace("Installed validation builder");
    }
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

   
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    project.create(null);
    project.open(null);
   
    IProjectDescription description = project.getDescription();
    description.setNatureIds(new String[] { JavaCore.NATURE_ID });
    project.setDescription(description, null);
   
    javaProject = JavaCore.create(project);
   
    javaProject.setOutputLocation(project.getFolder("bin").getFullPath(), null);
View Full Code Here

Examples of org.eclipse.core.resources.IProjectDescription

        IPath newPath = null;
        if (!mainPage.useDefaults())
            newPath = mainPage.getLocationPath();

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

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

Examples of org.eclipse.core.resources.IProjectDescription

        IPath path = folder.getFullPath();
        project.setOutputLocation(path, null);
    }

    private void addJavaBuilder(IJavaProject project, IProgressMonitor monitor) throws CoreException {
        IProjectDescription description = project.getProject().getDescription();
        ICommand[] commands = description.getBuildSpec();
        ICommand[] newCommands = new ICommand[commands.length + 2];
        System.arraycopy(commands, 0, newCommands, 0, commands.length);

        ICommand javaCommand = description.newCommand();
        javaCommand.setBuilderName("org.eclipse.jdt.core.javabuilder");
        newCommands[commands.length] = javaCommand;
       
        ICommand mavenCommand = description.newCommand();
        mavenCommand.setBuilderName("org.eclipse.m2e.core.maven2Builder");
        newCommands[commands.length + 1] = mavenCommand;
       
        description.setBuildSpec(newCommands);
        project.getProject().setDescription(description, monitor);
    }
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.