Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IProjectDescription


                // SubProgressMonitor(monitor,100));
                // }

                IProject project = javaPage.getNewJavaProject().getResource()
                    .getProject();
                IProjectDescription description = project.getDescription();
                String[] existingNatures = description.getNatureIds();
                String[] natures = new String[existingNatures.length + 1];
                for (int i = 0; i < existingNatures.length; i++) {
                  natures[i + 1] = existingNatures[i];
                }

                natures[0] = MapReduceNature.ID;
                description.setNatureIds(natures);

                project.setPersistentProperty(new QualifiedName(
                    Activator.PLUGIN_ID, "hadoop.runtime.path"),
                    firstPage.currentPath);
                project.setDescription(description, new NullProgressMonitor());
View Full Code Here


            /* Headless build files */
            HeadlessBuildManager headlessBuildManager = Plugin.getDefault().getHeadlessBuildManager();
            Set<String> enabledPlugins = new BndPreferences().getHeadlessBuildPluginsEnabled(headlessBuildManager, null);

            IProject iProject = project.getProject();
            IProjectDescription description = iProject.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);
                    iProject.setDescription(description, null);

                    /* Remove the headless build files */
                    headlessBuildManager.setup(enabledPlugins, false, iProject.getLocation().toFile(), false, enabledIgnorePlugins);

                    /* refresh the project; files were created outside of Eclipse API */
                    iProject.refreshLocal(IResource.DEPTH_INFINITE, null);

                    return;
                }
            }

            /* Add the headless build files */
            headlessBuildManager.setup(enabledPlugins, false, iProject.getLocation().toFile(), true, enabledIgnorePlugins);

            // Add the nature
            ensureBndBndExists(iProject);
            String[] newNatures = new String[natures.length + 1];
            System.arraycopy(natures, 0, newNatures, 0, natures.length);
            newNatures[natures.length] = BndtoolsConstants.NATURE_ID;
            description.setNatureIds(newNatures);
            iProject.setDescription(description, null);

            /* refresh the project; files were created outside of Eclipse API */
            iProject.refreshLocal(IResource.DEPTH_INFINITE, null);

View Full Code Here

        return status;
    }

    @Override
    public final Change perform(IProgressMonitor pm) throws CoreException {
        final IProjectDescription desc = project.getDescription();
        Set<String> natures = new HashSet<String>(Arrays.asList(desc.getNatureIds()));
        boolean changed = modifyNatures(natures);
        if (changed) {
            desc.setNatureIds(natures.toArray(new String[natures.size()]));
            project.setDescription(desc, pm);
        }

        return createInverse();
    }
View Full Code Here

    protected void importCnf(IProgressMonitor monitor) throws CoreException {
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IPath location = operation.getLocation();
        IContainer container = workspace.getRoot().getContainerForLocation(location);
        if (container == null) {
            IProjectDescription projDesc = workspace.loadProjectDescription(location.append(IProjectDescription.DESCRIPTION_FILE_NAME));
            IProject project = workspace.getRoot().getProject(Workspace.CNFDIR);
            project.create(projDesc, monitor);
            project.open(monitor);
        } else if (container.getType() == IResource.PROJECT) {
            IProject project = (IProject) container;
View Full Code Here

  /**
   * Adds a builder to the build spec for the given project.
   */
  protected void addToBuildSpec(String builderID) throws CoreException {

    IProjectDescription description = this.project.getDescription();
    int javaCommandIndex = getJavaCommandIndex(description.getBuildSpec());

    if (javaCommandIndex == -1) {

      // Add a Java command to the build spec
      ICommand command = description.newCommand();
      command.setBuilderName(builderID);
      setJavaCommand(description, command);
    }
  }
View Full Code Here

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

    IProjectDescription description = this.project.getDescription();
    ICommand[] commands = description.getBuildSpec();
    for (int i = 0; i < commands.length; ++i) {
      if (commands[i].getBuilderName().equals(builderID)) {
        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);
        this.project.setDescription(description, null);
        return;
      }
    }
  }
View Full Code Here

    }
  }


  private void createExternalFoldersProject(IProject project, IProgressMonitor monitor) throws CoreException {
    IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName());
    IPath stateLocation = JavaCore.getPlugin().getStateLocation();
    desc.setLocation(stateLocation.append(EXTERNAL_PROJECT_NAME));
    project.create(desc, IResource.HIDDEN, monitor);
  }
View Full Code Here

        return new ITemplateSection[]{template};
    }

    public boolean performFinish() {
        final IProject project = template.getProjectHandle();
        final IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName());
       
        WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
            protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
                monitor.beginTask("", 2500);
                project.create(description, monitor);
View Full Code Here

        return new ITemplateSection[]{template};
    }

    public boolean performFinish() {
        final IProject project = template.getProjectHandle();
        final IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName());
       
        WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
            protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
                monitor.beginTask("", 2500);
                project.create(description, monitor);
View Full Code Here

       * performFinish, which executes each of the templates we provided in
       * the "createTemplateSections()" method above.
       */
     
        final IProject project = template.getProjectHandle();
        final IProjectDescription description =
          ResourcesPlugin.getWorkspace().newProjectDescription(
            project.getName());
       
        WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
            protected void execute(IProgressMonitor monitor)
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.