mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 19:25:38 +02:00
bug 261211
This commit is contained in:
parent
19a25b2054
commit
9bc3398966
1 changed files with 19 additions and 11 deletions
|
@ -20,6 +20,7 @@ import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.resources.IProjectNature;
|
import org.eclipse.core.resources.IProjectNature;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class CProjectNature implements IProjectNature {
|
public class CProjectNature implements IProjectNature {
|
||||||
|
|
||||||
|
@ -55,6 +56,10 @@ public class CProjectNature implements IProjectNature {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
|
public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException {
|
||||||
|
try {
|
||||||
|
if (monitor == null) {
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
}
|
||||||
IProjectDescription description = project.getDescription();
|
IProjectDescription description = project.getDescription();
|
||||||
String[] prevNatures = description.getNatureIds();
|
String[] prevNatures = description.getNatureIds();
|
||||||
for (String prevNature : prevNatures) {
|
for (String prevNature : prevNatures) {
|
||||||
|
@ -66,6 +71,9 @@ public class CProjectNature implements IProjectNature {
|
||||||
newNatures[prevNatures.length] = natureId;
|
newNatures[prevNatures.length] = natureId;
|
||||||
description.setNatureIds(newNatures);
|
description.setNatureIds(newNatures);
|
||||||
project.setDescription(description, monitor);
|
project.setDescription(description, monitor);
|
||||||
|
} finally {
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue