From 1e80da09a2c92194fe75481745339106e6f246d7 Mon Sep 17 00:00:00 2001
From: Michael Valenta
Date: Tue, 11 Jun 2002 21:24:39 +0000
Subject: Conversion from nature to persistant property
---
bundles/org.eclipse.team.cvs.core/plugin.xml | 11 +++++++++-
.../team/internal/ccvs/core/CVSProvider.java | 24 ++++------------------
.../team/internal/ccvs/core/CVSTeamProvider.java | 2 +-
.../ccvs/core/resources/CVSWorkspaceRoot.java | 11 ++++------
.../ccvs/core/util/AddDeleteMoveListener.java | 2 +-
.../ccvs/core/util/ProjectDescriptionManager.java | 24 +++++-----------------
bundles/org.eclipse.team.cvs.ui/plugin.properties | 3 +++
.../internal/ccvs/ui/actions/UnmanageAction.java | 2 +-
8 files changed, 29 insertions(+), 50 deletions(-)
(limited to 'bundles')
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml
index 28dd981f1..5a4aaf4c0 100644
--- a/bundles/org.eclipse.team.cvs.core/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.core/plugin.xml
@@ -22,7 +22,7 @@
-
+
@@ -39,6 +39,15 @@
+
+
+
+
+
+
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
index 749ec671a..546a10cc4 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
@@ -178,10 +178,7 @@ public class CVSProvider implements ICVSProvider {
for (int i = 0; i < projects.length; i++) {
IProject project = projects[i];
// Register the project with Team
- // (unless the project already has the proper nature from the project meta-information)
- if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId())) {
- Team.addNatureToProject(project, CVSProviderPlugin.getTypeId(), Policy.subMonitorFor(monitor, 100));
- }
+ RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
}
} finally {
@@ -481,15 +478,8 @@ public class CVSProvider implements ICVSProvider {
folder.setFolderSyncInfo(new FolderSyncInfo(moduleName, location.getLocation(), null, false));
- // Register the project with Team
- // (unless the project already has the proper nature from the project meta-information)
- try {
- if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId())) {
- Team.addNatureToProject(project, CVSProviderPlugin.getTypeId(), Policy.subMonitorFor(monitor, 1));
- }
- } catch (CoreException e) {
- throw wrapException(e);
- }
+ //Register it with Team. If it already is, no harm done.
+ RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
} catch (TeamException e) {
// The checkout may have triggered password caching
// Therefore, if this is a newly created location, we want to clear its cache
@@ -547,13 +537,7 @@ public class CVSProvider implements ICVSProvider {
}
// Register the project with Team
- // (unless the project already has the proper nature from the project meta-information)
- try {
- if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId()))
- Team.addNatureToProject(project, CVSProviderPlugin.getTypeId(), monitor);
- } catch (CoreException e) {
- throw wrapException(e);
- }
+ RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
}
private CVSException wrapException(CoreException e) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 31f9b8002..7a1607b25 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -497,7 +497,7 @@ public class CVSTeamProvider extends RepositoryProvider {
} catch (CVSException e) {
// If we can't get the remote location, we should disconnect since nothing can be done with the provider
try {
- Team.removeNatureFromProject(project, CVSProviderPlugin.getTypeId(), Policy.monitorFor(null));
+ RepositoryProvider.unmap(project);
} catch (TeamException ex) {
CVSProviderPlugin.log(ex);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
index 2ae43b476..5425b54fe 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
@@ -14,6 +14,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteSyncElement;
@@ -148,13 +149,9 @@ public class CVSWorkspaceRoot {
RemoteFolderTree remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)folder.getRepository(), folder, folder.getTag(), Policy.subMonitorFor(progress, 80));
CVSRemoteSyncElement tree = new CVSRemoteSyncElement(true /*three way*/, project, null, remote);
tree.makeFoldersInSync(Policy.subMonitorFor(progress, 10));
- try {
- if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId())) {
- Team.addNatureToProject(project, CVSProviderPlugin.getTypeId(), Policy.subMonitorFor(progress, 10));
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
+
+ RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
+
progress.done();
return tree;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AddDeleteMoveListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AddDeleteMoveListener.java
index 595bf2d22..bbb5bfa01 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AddDeleteMoveListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AddDeleteMoveListener.java
@@ -212,7 +212,7 @@ public class AddDeleteMoveListener implements IResourceDeltaVisitor, IResourceCh
ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(resource.getProject());
try {
if (! folder.isCVSFolder()) {
- Team.removeNatureFromProject(resource.getProject(), CVSProviderPlugin.getTypeId(), null);
+ RepositoryProvider.unmap(resource.getProject());
}
} catch (TeamException e) {
CVSProviderPlugin.log(e.getStatus());
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java
index 032a96096..c9b134a8c 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java
@@ -168,25 +168,11 @@ public class ProjectDescriptionManager implements IResourceChangeListener {
// Other natures are still set
Util.logError(Policy.bind("ProjectDescriptionManager.unableToSetDescription"), ex); //$NON-NLS-1$
}
- // Make sure we have the cvs nature (the above read may have removed it)
- if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId())) {
- try {
- // TeamPlugin.addNatureToProject(project, CVSProviderPlugin.getTypeId(), progress);
-
- // Set the nature manually in order to override any .project file
- IProjectDescription description = project.getDescription();
- String[] prevNatures= description.getNatureIds();
- String[] newNatures= new String[prevNatures.length + 1];
- System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length]= CVSProviderPlugin.getTypeId();
- description.setNatureIds(newNatures);
- project.setDescription(description, IResource.FORCE | IResource.KEEP_HISTORY, progress);
- } catch (CoreException ex) {
- // Failing to set the provider is probably due to a missing nature.
- // Other natures are still set
- Util.logError(Policy.bind("ProjectDescriptionManager.unableToSetDescription"), ex); //$NON-NLS-1$
- }
- }
+
+ // Make sure we are still marked as a CVS project
+ if(RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()) == null)
+ RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
+
// Mark the .vcm_meta file with a problem marker
if (project.getFile(CORE_PROJECT_DESCRIPTION_PATH).exists()) {
createVCMMetaMarker(descResource);
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
index 905c5589d..5f1f449dc 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties
@@ -41,6 +41,9 @@ CompareWithTagAction.tooltip=Compare with a Branch or a Version on the CVS Serve
ContentAction.label=Compare File Contents
ContentAction.tooltip=Use File Contents Instead of Timestamps When Comparing
+ConvertNature.label=Convert Provider from Nature
+ConvertNature.tooltip=Converts a CVS project from using natures to using properties
+
CopyRepositoryNameAction.label=&Copy to Clipboard
CopyRepositoryNameAction.tooltip=Copy Repository Names to Clipboard
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
index c834e6792..32e8addad 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
@@ -162,7 +162,7 @@ public class UnmanageAction extends TeamAction {
}
} finally {
// We want to remove the nature even if the unmanage operation fails
- Team.removeNatureFromProject((IProject)resource, CVSProviderPlugin.getTypeId(), Policy.subMonitorFor(subMonitor, 10));
+ RepositoryProvider.unmap((IProject)resource);
}
}
}
--
cgit v1.2.3