Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Macguire2002-06-06 21:08:15 +0000
committerKevin Macguire2002-06-06 21:08:15 +0000
commit77c716785043120ceef7453e75c6fe0cca11138b (patch)
tree7ac953c11a59591c8ed872def48ace1d2688b76d
parent81fb39e2b5c0d2a224af3bada4dac16c96ba2d2d (diff)
downloadeclipse.platform.team-77c716785043120ceef7453e75c6fe0cca11138b.tar.gz
eclipse.platform.team-77c716785043120ceef7453e75c6fe0cca11138b.tar.xz
eclipse.platform.team-77c716785043120ceef7453e75c6fe0cca11138b.zip
add/remove natures are now unchanged
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java40
1 files changed, 28 insertions, 12 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 232c61752..b0ae40ba7 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,16 +225,14 @@ public final class Team {
}
/**
- * @deprecated Use RepositoryProvider.unmap(IProject)
+ * 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.
*/
- public static void removeNatureFromProject(IProject proj, String natureID, IProgressMonitor monitor) throws TeamException {
- if(!RepositoryProvider.getProvider(proj).getID().equals(natureID))
- throw new TeamException(Policy.bind("manager.errorRemovingNature", proj.getName(), natureID)); //$NON-NLS-1$
-
- RepositoryProvider.unmap(proj);
- }
-
- public static void reallyRemoveNatureFromProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
+ public static void removeNatureFromProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
try {
IProjectDescription description = proj.getDescription();
String[] prevNatures= description.getNatureIds();
@@ -245,12 +243,30 @@ public final class Team {
} catch(CoreException e) {
throw wrapException(Policy.bind("manager.errorRemovingNature", proj.getName(), natureId), e); //$NON-NLS-1$
}
- }
+ }
+
/**
- * @deprecated Use RepositoryProvider.map(IProject, String)
+ * 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
*/
public static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
- RepositoryProvider.map(proj, natureId);
+ try {
+ 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);
+ } catch(CoreException e) {
+ throw wrapException(Policy.bind("manager.errorSettingNature", proj.getName(), natureId), e); //$NON-NLS-1$
+ }
}
/*

Back to the top