public static String[] getNatures(IProject[] projects) throws CoreException { Set<String> result= new HashSet<>(); for (int i= 0; i < projects.length; i++) { String[] pns= projects[i].getDescription().getNatureIds(); for (int p = 0; p < pns.length; p++) { result.add(pns[p]); } } return result.toArray(new String[result.size()]); } }
public static void addMavenNature(IProjectDescription projectDescription) { List<String> list = new ArrayList<String>(); list.addAll(Arrays.asList(projectDescription.getNatureIds())); list.add("org.eclipse.m2e.core.maven2Nature"); projectDescription.setNatureIds((String[]) list.toArray(new String[list.size()])); }
public static String[] getNatures(IProject[] projects) throws CoreException { Set<String> result= new HashSet<>(); for (int i= 0; i < projects.length; i++) { String[] pns= projects[i].getDescription().getNatureIds(); for (int p = 0; p < pns.length; p++) { result.add(pns[p]); } } return result.toArray(new String[result.size()]); } }
public static String[] getNatures(IProject[] projects) throws CoreException { Set result= new HashSet(); for (int i= 0; i < projects.length; i++) { String[] pns= projects[i].getDescription().getNatureIds(); for (int p = 0; p < pns.length; p++) { result.add(pns[p]); } } return (String[])result.toArray(new String[result.size()]); } }
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 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); }
protected String[] getNatureIds(IProject aProject) { try { if (aProject.isAccessible()) return aProject.getDescription().getNatureIds(); } catch (CoreException e) { } return null; }
/** * 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 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); }
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); }
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 nauture to a project, FIRST */ public static void addNatureToProject(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, 1, prevNatures.length); newNatures[0] = 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 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 String[] computeAffectedNatures(IJavaElement element) throws CoreException { if (element instanceof IMember) { IMember member= (IMember)element; if (JdtFlags.isPrivate(member)) { return element.getJavaProject().getProject().getDescription().getNatureIds(); } } IJavaProject project= element.getJavaProject(); return ResourceProcessors.computeAffectedNatures(project.getProject()); }
public static String[] computeAffectedNatures(IJavaElement element) throws CoreException { if (element instanceof IMember) { IMember member= (IMember)element; if (JdtFlags.isPrivate(member)) { return element.getJavaProject().getProject().getDescription().getNatureIds(); } } IJavaProject project= element.getJavaProject(); return ResourceProcessors.computeAffectedNatures(project.getProject()); }
public static String[] computeAffectedNatures(IJavaElement element) throws CoreException { if (element instanceof IMember) { IMember member= (IMember)element; if (JdtFlags.isPrivate(member)) { return element.getJavaProject().getProject().getDescription().getNatureIds(); } } IJavaProject project= element.getJavaProject(); return ResourceProcessors.computeAffectedNatures(project.getProject()); }
public static String[] computeAffectedNatures(IJavaElement element) throws CoreException { if (element instanceof IMember) { IMember member= (IMember)element; if (JdtFlags.isPrivate(member)) { return element.getJavaProject().getProject().getDescription().getNatureIds(); } } IJavaProject project= element.getJavaProject(); return ResourceProcessors.computeAffectedNatures(project.getProject()); }