public static void removeNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); Set<String> set = new LinkedHashSet<String>(Arrays.asList(description.getNatureIds())); set.remove(natureId); description.setNatureIds(set.toArray(new String[0])); project.setDescription(description, monitor); }
public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); Set<String> set = new LinkedHashSet<String>(Arrays.asList(description.getNatureIds())); set.add(natureId); description.setNatureIds(set.toArray(new String[0])); project.setDescription(description, monitor); }
public void run(IProgressMonitor monitor) throws CoreException { IProjectDescription description = projectResource.getDescription(); description.setDynamicReferences(requiredProjectArray); projectResource.setDescription(description, IResource.AVOID_NATURE_CONFIG, null); } };
public void run(IProgressMonitor monitor) throws CoreException { IProjectDescription description = projectResource.getDescription(); description.setDynamicReferences(requiredProjectArray); projectResource.setDescription(description, IResource.AVOID_NATURE_CONFIG, null); } };
public void run(IProgressMonitor monitor) throws CoreException { IProjectDescription description = projectResource.getDescription(); description.setDynamicReferences(requiredProjectArray); projectResource.setDescription(description, IResource.AVOID_NATURE_CONFIG, null); } };
public void run(IProgressMonitor monitor) throws CoreException { IProjectDescription description = projectResource.getDescription(); description.setDynamicReferences(requiredProjectArray); projectResource.setDescription(description, IResource.AVOID_NATURE_CONFIG, null); } };
private void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException { IProjectDescription description = proj.getDescription(); String[] prevNatures = description.getNatureIds(); String[] newNatures = new String[prevNatures.length + 1]; System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); newNatures[prevNatures.length] = natureId; description.setNatureIds(newNatures); proj.setDescription(description, monitor); }
private void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException { IProjectDescription description = proj.getDescription(); String[] prevNatures = description.getNatureIds(); String[] newNatures = new String[prevNatures.length + 1]; System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); newNatures[prevNatures.length] = natureId; description.setNatureIds(newNatures); proj.setDescription(description, monitor); }
/** * Adds a nature to a project, LAST */ public static void addNatureToProjectLast(IProject proj, String natureId) throws CoreException { IProjectDescription description = proj.getDescription(); String[] prevNatures = description.getNatureIds(); String[] newNatures = new String[prevNatures.length + 1]; System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); newNatures[prevNatures.length] = natureId; description.setNatureIds(newNatures); proj.setDescription(description, null); }
public static void addNature(IProject project, String nature) throws CoreException { IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); // Add the nature String[] newNatures = new String[natures.length + 1]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = nature; description.setNatureIds(newNatures); project.setDescription(description, null); }
public static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException { IProjectDescription description = proj.getDescription(); String[] prevNatures = description.getNatureIds(); String[] newNatures = new String[prevNatures.length + 1]; System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); newNatures[prevNatures.length] = natureId; description.setNatureIds(newNatures); proj.setDescription(description, monitor); }
public static void removeBuilders(IProject project, String[] id, IProgressMonitor monitor) throws CoreException { IProjectDescription desc = project.getDescription(); List<ICommand> newCommands = getCommands(desc, id); setCommands(desc, newCommands); project.setDescription(desc, monitor); }
public static void addBuilders(IProject project, String[] id, IProgressMonitor monitor) throws CoreException { IProjectDescription desc = project.getDescription(); List<ICommand> newCommands = getCommands(desc, id); for (int i = 0; i < id.length; i++) { ICommand command = desc.newCommand(); command.setBuilderName(id[i]); newCommands.add(command); } setCommands(desc, newCommands); project.setDescription(desc, monitor); }
private void createProj(IProject newProj, boolean isJavaProject) throws CoreException { newProj.create(null); IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(newProj.getName()); // if (isJavaProject) // description.setNatureIds(new String[]{JavaCore.NATURE_ID}); description.setLocation(null); newProj.open(null); newProj.setDescription(description, null); }
public static void update(IProject project, List<EclipseProjectNature> projectNatures, PersistentModelBuilder persistentModel, IProgressMonitor monitor) throws CoreException { PersistentModel previousPersistentModel = persistentModel.getPrevious(); Set<String> managedNatures = previousPersistentModel.isPresent() ? Sets.newLinkedHashSet(previousPersistentModel.getManagedNatures()) : Sets.<String>newLinkedHashSet(); Set<String> modelNatures = toNatures(projectNatures); IProjectDescription description = project.getDescription(); Set<String> existingNatures = Sets.newLinkedHashSet(Arrays.asList(description.getNatureIds())); Result<String> result = ManagedModelMergingStrategy.calculate(existingNatures, modelNatures, managedNatures); description.setNatureIds(result.getNextElements().toArray(new String[0])); project.setDescription(description, monitor); persistentModel.managedNatures(result.getNextManaged()); }
public static void update(IProject project, List<EclipseBuildCommand> buildCommands, PersistentModelBuilder persistentModel, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); Set<ICommand> current = ImmutableSet.copyOf(description.getBuildSpec()); Set<ICommand> model = toCommands(buildCommands, description); PersistentModel previousModel = persistentModel.getPrevious(); Set<ICommand> managed = previousModel.isPresent() ? Sets.newLinkedHashSet(previousModel.getManagedBuilders()) : Sets.<ICommand>newLinkedHashSet(); Result<ICommand> result = ManagedModelMergingStrategy.calculate(current, model, managed); description.setBuildSpec(result.getNextElements().toArray(new ICommand[0])); project.setDescription(description, monitor); persistentModel.managedBuilders(result.getNextManaged()); }
public static void addBuilder(IProject project, String builderId) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] specs = description.getBuildSpec(); ICommand command = description.newCommand(); command.setBuilderName(builderId); // Add the nature ICommand[] specsModified = new ICommand[specs.length + 1]; System.arraycopy(specs, 0, specsModified, 0, specs.length); specsModified[specs.length] = command; description.setBuildSpec(specsModified); project.setDescription(description, monitor()); }
public static void addBuilder(IProject project, String builderId) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] specs = description.getBuildSpec(); ICommand command = description.newCommand(); command.setBuilderName(builderId); // Add the nature ICommand[] specsModified = new ICommand[specs.length + 1]; System.arraycopy(specs, 0, specsModified, 0, specs.length); specsModified[specs.length] = command; description.setBuildSpec(specsModified); project.setDescription(description, monitor()); }
/** * Remove the old AspectJ Builder from the given project */ public static void removeOldBuilder(IProject project) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] buildCommands = description.getBuildSpec(); if (contains(buildCommands, OLD_BUILDER)) { ICommand[] newBuildCommands = remove(buildCommands, OLD_BUILDER); description.setBuildSpec(newBuildCommands); project.setDescription(description, null); } }
private void setProjectNatures(IProject project, IFeatureModel model, SubMonitor subMonitor) throws CoreException { IProjectDescription desc = project.getDescription(); if (needsJavaNature(model)) { desc.setNatureIds(new String[] {JavaCore.NATURE_ID, PDE.FEATURE_NATURE}); } else { desc.setNatureIds(new String[] {PDE.FEATURE_NATURE}); } subMonitor.setWorkRemaining(1); project.setDescription(desc, subMonitor.split(1)); }