Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java30
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java9
2 files changed, 21 insertions, 18 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
index 36b6642f0..232c61752 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
@@ -225,12 +225,7 @@ public final class Team {
}
/**
- * Utility method for removing a project nature from a project.
- *
- * @param proj the project to remove the nature from
- * @param natureId the nature id to remove
- * @param monitor a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
+ * @deprecated Use RepositoryProvider.unmap(IProject)
*/
public static void removeNatureFromProject(IProject proj, String natureID, IProgressMonitor monitor) throws TeamException {
if(!RepositoryProvider.getProvider(proj).getID().equals(natureID))
@@ -238,16 +233,21 @@ public final class Team {
RepositoryProvider.unmap(proj);
}
-
+
+ public static void reallyRemoveNatureFromProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
+ try {
+ IProjectDescription description = proj.getDescription();
+ String[] prevNatures= description.getNatureIds();
+ List newNatures = new ArrayList(Arrays.asList(prevNatures));
+ newNatures.remove(natureId);
+ description.setNatureIds((String[])newNatures.toArray(new String[newNatures.size()]));
+ proj.setDescription(description, monitor);
+ } catch(CoreException e) {
+ throw wrapException(Policy.bind("manager.errorRemovingNature", proj.getName(), natureId), e); //$NON-NLS-1$
+ }
+ }
/**
- * Utility method for adding a nature to a project.
- *
- * @param proj the project to add the nature
- * @param natureId the id of the nature to assign to the project
- * @param monitor a progress monitor to indicate the duration of the operation, or
- * <code>null</code> if progress reporting is not required.
- *
- * @exception TeamException if a problem occured setting the nature
+ * @deprecated Use RepositoryProvider.map(IProject, String)
*/
public static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
RepositoryProvider.map(proj, natureId);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
index 4f220972c..0f2e37f1b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
@@ -115,9 +115,12 @@ final public class TeamPlugin extends Plugin {
return new TeamException(new Status(status.getSeverity(), ID, status.getCode(), status.getMessage(), e));
}
- public static void convertNatureToProperty(IProject project, String id) throws TeamException {
- Team.removeNatureFromProject(project, id, new NullProgressMonitor());
- RepositoryProvider.map(project, id);
+ public static void convertNatureToProperty(IProject project) throws TeamException {
+ RepositoryProvider provider = RepositoryProvider.getProvider(project);
+ String providerId = provider.getID();
+
+ RepositoryProvider.map(project, providerId);
+ Team.reallyRemoveNatureFromProject(project, providerId, new NullProgressMonitor());
}
} \ No newline at end of file

Back to the top