*** empty log message ***
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 38b49ff..7eb334c 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
@@ -77,42 +77,6 @@ } /* - * Build the repository instance from the given properties. - * The supported properties are: - * - * connection The connection method to be used - * user The username for the connection - * password The password used for the connection (optional) - * host The host where the repository resides - * port The port to connect to (optional) - * root The server directory where the repository is located - * - * Note: If there is a cahced entry for the location, it is returned. - */ - private CVSRepositoryLocation buildRepository(Properties configuration, boolean cachePassword) throws CVSException { - - // Create a new repository location - CVSRepositoryLocation location = CVSRepositoryLocation.fromProperties(configuration); - - // Check the cache for an equivalent instance and if there is one, use it instead of the new one - CVSRepositoryLocation existingLocation = (CVSRepositoryLocation)repositories.get(location.getLocation()); - if (existingLocation != null) { - location = existingLocation; - } - - // Set or cahce the password - String password = configuration.getProperty("password"); //$NON-NLS-1$ - if (password != null) { - if (cachePassword) - location.storePassword(password); - else - location.setPassword(password); - } - - return location; - } - - /* * Add the repository location to the cahced locations */ private void addToCache(ICVSRepositoryLocation repository) { @@ -254,12 +218,25 @@ * @see ICVSProvider#createRepository(Properties) */ public ICVSRepositoryLocation createRepository(Properties configuration) throws CVSException { - ICVSRepositoryLocation repository = buildRepository(configuration, true); - if (! isCached(repository)) { - addToCache(repository); - repositoryAdded(repository); + // Create a new repository location + CVSRepositoryLocation location = CVSRepositoryLocation.fromProperties(configuration); + + // Check the cache for an equivalent instance and if there is one, throw an exception + CVSRepositoryLocation existingLocation = (CVSRepositoryLocation)repositories.get(location.getLocation()); + if (existingLocation != null) { + throw new CVSException(new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSProvider.alreadyExists"))); } - return repository; + + // Set or cache the password + String password = configuration.getProperty("password"); //$NON-NLS-1$ + if (password != null) { + location.storePassword(password); + } + + addToCache(location); + repositoryAdded(location); + + return location; } /** @@ -330,20 +307,6 @@ else return printStream; } - - private String getRepositoryLocationString(Properties configuration) throws CVSException { - // Create a new repository location so we can get the location string for the properties - CVSRepositoryLocation location = CVSRepositoryLocation.fromProperties(configuration); - return location.getLocation(); - } - - /** - * @see ICVSProvider#getRepository(Properties) - */ - public ICVSRepositoryLocation getRepository(Properties configuration) throws CVSException { - // Return the cached repository for the properties, or null if there isn't one. - return (CVSRepositoryLocation)repositories.get(getRepositoryLocationString(configuration)); - } /** * @see ICVSProvider#getRepository(String) @@ -469,23 +432,22 @@ printStream = out; } - public void setSharing(IProject project, ICVSRepositoryLocation location, String remotePath, CVSTag tag, IProgressMonitor monitor) throws TeamException { + public void setSharing(IProject project, FolderSyncInfo info, IProgressMonitor monitor) throws TeamException { + + // Ensure provided info matches that of the project + ICVSFolder folder = (ICVSFolder)Session.getManagedResource(project); + FolderSyncInfo folderInfo = folder.getFolderSyncInfo(); + if ( ! info.equals(folderInfo)) { + throw new CVSException(new CVSStatus(CVSStatus.ERROR, "Provided CVS information does not match that on disk")); + } // Ensure that the provided location is managed + ICVSRepositoryLocation location = getRepository(info.getRoot()); if (! isCached(location)) { addToCache(location); repositoryAdded(location); } - // Set folder sync info - ICVSFolder folder = (ICVSFolder)Session.getManagedResource(project); - FolderSyncInfo info = folder.getFolderSyncInfo(); - if (info == null) { - // Only set the info if there is none. - info = new FolderSyncInfo(remotePath, location.getLocation(), tag, false); - folder.setFolderSyncInfo(info); - } - // Register the project with Team // (unless the project already has the proper nature from the project meta-information) try {
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 cfe3262..62a257d 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
@@ -160,58 +160,6 @@ public void configureProvider(Properties configuration) throws TeamException { // Do nothing } - - /* - * Build the repository instance from the given properties. - * The supported properties are: - * - * connection The connection method to be used - * user The username for the connection - * password The password used for the connection (optional) - * host The host where the repository resides - * port The port to connect to (optional) - * root The server directory where the repository is located - */ - private static CVSRepositoryLocation buildRepository(Properties configuration) throws TeamException { - StringBuffer repository = new StringBuffer(":"); - String connection = configuration.getProperty("connection"); - if (connection == null) - repository.append("pserver"); - else - repository.append(connection); - repository.append(":"); - String user = configuration.getProperty("user"); - if (user == null) - throw new TeamException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, Policy.bind("CVSTeamProvider.noUser"), null)); - else - repository.append(user); - repository.append("@"); - String host = configuration.getProperty("host"); - if (host == null) - throw new TeamException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, Policy.bind("CVSTeamProvider.noHost"), null)); - else - repository.append(host); - String port = configuration.getProperty("port"); - if (port != null) { - repository.append("#"); - repository.append(port); - } - repository.append(":"); - String root = configuration.getProperty("root"); - if (root == null) - throw new TeamException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, Policy.bind("CVSTeamProvider.noRoot"), null)); - else - repository.append(root); - - CVSRepositoryLocation location = CVSRepositoryLocation.fromString(repository.toString()); - - String password = configuration.getProperty("password"); - if (password != null) { - location.setPassword(password); - } - - return location; - } /** * Add the given resources to the project.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSProvider.java index 1d0ee54..657f937 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSProvider.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSProvider.java
@@ -12,6 +12,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.team.core.TeamException; import org.eclipse.team.internal.ccvs.core.CVSException; +import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; /** * The ICVSProvider interface provides access to CVS operations that create repository locations, @@ -72,6 +73,9 @@ * The created instance will be cached with the provider as a result of the * invokation of this method. When the client is done with the instance, disposeRepository * should be called. + * + * This method will throw a CVSException if the location for the given configuration already + * exists. */ public ICVSRepositoryLocation createRepository(Properties configuration) throws CVSException; @@ -88,21 +92,6 @@ public ICVSRepositoryLocation[] getKnownRepositories(); /** - * Get the repository location that matches the given properties. - * The supported properties are: - * - * connection The connection method to be used - * user The username for the connection - * password The password used for the connection (optional) - * host The host where the repository resides - * port The port to connect to (optional) - * root The server directory where the repository is located - * - * If no known repositories mathc the given properties, null is returned. - */ - public ICVSRepositoryLocation getRepository(Properties configuration) throws CVSException; - - /** * Get the repository instance which matches the given String. The format of the String is * the same as that returned by ICVSRepositoryLocation#getLocation(). * The format is: @@ -132,7 +121,7 @@ * This method only sets the folder sync info for the project folder and the info * is only set to the provided parameters if there is no sync info already. */ - public void setSharing(IProject project, ICVSRepositoryLocation location, String remotePath, CVSTag tag, IProgressMonitor monitor) throws TeamException; + public void setSharing(IProject project, FolderSyncInfo info, IProgressMonitor monitor) throws TeamException; /** * Get the names of the registered connection methods.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties index 4870083..5858996 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
@@ -36,6 +36,7 @@ CVSProvider.exception=Internal error occured. CVSProvider.invalidResource=Resource {0} is not a CVS resource CVSProvider.initialImport=Initial import +CVSProvider.alreadyExists=The specified repository location already exists. CVSTeamProvider.deconfigureProblem=Error while deconfiguring CVS project {0} CVSTeamProvider.initializationFailed=Initialization of CVS for project {0} failed
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java index 16f0ef3..2bb74c4 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
@@ -78,17 +78,6 @@ } /** - * Answer the root corresponding with the given properties. - * If the root is in the list of known roots, it is returned. - * If it is not in the list of known roots, it is created and - * added. - */ - public ICVSRepositoryLocation getRoot(Properties properties) throws TeamException { - // We use createRepository instead of getRepository since create will return - // an existing location or create it if it doesn't exist - return getCVSProvider().createRepository(properties); - } - /** * Get the list of known branch tags for a given remote root. */ public BranchTag[] getKnownBranchTags(ICVSRepositoryLocation root) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties index d216765..ab44770 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -218,8 +218,7 @@ NewLocationWizard.description=Add a new CVS Repository to the Repositories View NewLocationWizard.validationFailedText={0}. Keep location anyway? NewLocationWizard.validationFailedTitle=Unable to Validate -NewLocationWizard.alreadyExistsTitle=Repository already exists -NewLocationWizard.alreadyExists=The specified repository location already exists. +NewLocationWizard.exception=Unable to create repository location OpenLogEntryAction.open=Open
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java index e34149a..b488f9f 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java
@@ -5,8 +5,6 @@ * All Rights Reserved. */ -import java.util.Properties; - import org.eclipse.core.resources.IProject; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.resource.ImageDescriptor; @@ -20,10 +18,10 @@ import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.team.ccvs.core.CVSProviderPlugin; +import org.eclipse.team.ccvs.core.CVSTag; import org.eclipse.team.ccvs.core.ICVSRepositoryLocation; import org.eclipse.team.core.TeamException; import org.eclipse.team.internal.ccvs.core.client.Session; -import org.eclipse.team.internal.ccvs.core.resources.CVSEntryLineTag; import org.eclipse.team.internal.ccvs.core.resources.ICVSFolder; import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; import org.eclipse.team.internal.ccvs.ui.Policy; @@ -36,8 +34,9 @@ */ public class ConfigurationWizardAutoconnectPage extends CVSWizardPage { private boolean validate = true; - private Properties properties; - + private FolderSyncInfo info; + ICVSRepositoryLocation location; + public ConfigurationWizardAutoconnectPage(String pageName, String title, ImageDescriptor titleImage) { super(pageName, title, titleImage); } @@ -56,30 +55,36 @@ description.setLayoutData(data); description.setText(Policy.bind("ConfigurationWizardAutoconnectPage.description")); - if (properties == null) return; - + if (location == null) return; + // Spacer createLabel(composite, ""); createLabel(composite, ""); createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.user")); - createLabel(composite, properties.getProperty("user")); + createLabel(composite, location.getUsername()); createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.host")); - createLabel(composite, properties.getProperty("host")); + createLabel(composite, location.getHost()); createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.port")); - String port = properties.getProperty("port"); - if (port == null) { + int port = location.getPort(); + if (port == location.USE_DEFAULT_PORT) { createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.default")); } else { - createLabel(composite, port); + createLabel(composite, "" + port); } createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.connectionType")); - createLabel(composite, properties.getProperty("connection")); + createLabel(composite, location.getMethod().getName()); createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.repositoryPath")); - createLabel(composite, properties.getProperty("root")); + createLabel(composite, location.getRootDirectory()); createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.module")); - createLabel(composite, properties.getProperty("module")); + createLabel(composite, info.getRepository()); + CVSTag tag = info.getTag(); + if (tag != null) { + // XXX Should we show a tag + //properties.setProperty("tag", tag.getName()); + } + // Spacer createLabel(composite, ""); createLabel(composite, ""); @@ -96,8 +101,8 @@ check.setSelection(true); } - public Properties getProperties() { - return properties; + public FolderSyncInfo getFolderSyncInfo() { + return info; } public boolean getValidate() { return validate; @@ -105,30 +110,13 @@ public void setProject(IProject project) { try { ICVSFolder folder = (ICVSFolder)Session.getManagedResource(project); - FolderSyncInfo info = folder.getFolderSyncInfo(); + info = folder.getFolderSyncInfo(); if (info == null) { // This should never happen ErrorDialog.openError(getContainer().getShell(), Policy.bind("ConfigurationWizardAutoconnectPage.noSyncInfo"), Policy.bind("ConfigurationWizardAutoconnectPage.noCVSDirectory"), null); return; } - ICVSRepositoryLocation location = CVSProviderPlugin.getProvider().getRepository(info.getRoot()); - properties = new Properties(); - properties.setProperty("connection", location.getMethod().getName()); - properties.setProperty("host", location.getHost()); - int port = location.getPort(); - if (port != location.USE_DEFAULT_PORT) { - properties.setProperty("port", "" + port); - } - properties.setProperty("user", location.getUsername()); - properties.setProperty("root", location.getRootDirectory()); - - String repository = info.getRepository(); - properties.setProperty("module", repository); - - CVSEntryLineTag tag = info.getTag(); - if (tag != null) { - properties.setProperty("tag", tag.getName()); - } + location = CVSProviderPlugin.getProvider().getRepository(info.getRoot()); } catch (TeamException e) { Shell shell = new Shell(Display.getDefault()); ErrorDialog.openError(shell, null, null, e.getStatus());
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java index 6140270..c15db74 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java
@@ -57,12 +57,6 @@ ICVSRepositoryLocation root = null; ICVSProvider provider = CVSProviderPlugin.getProvider(); try { - // See if it already exists - root = provider.getRepository(properties); - if (root != null) { - MessageDialog.openInformation(getContainer().getShell(), Policy.bind("NewLocationWizard.alreadyExistsTitle"), Policy.bind("NewLocationWizard.alreadyExists")); - return false; - } root = provider.createRepository(properties); if (mainPage.getValidate()) { root.validateConnection(new NullProgressMonitor()); @@ -71,7 +65,7 @@ IStatus error = e.getStatus(); if (root == null) { // Exception creating the root, we cannot continue - ErrorDialog.openError(getContainer().getShell(), Policy.bind("exception"), null, error); + ErrorDialog.openError(getContainer().getShell(), Policy.bind("NewLocationWizard.exception"), null, error); return false; } else { // Exception validating. We can continue if the user wishes.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java index 974a1e9..e769bc6 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
@@ -138,23 +138,14 @@ if (autoconnectPage != null) { // Autoconnect to the repository using CVS/ directories - // Create the repository location - Properties properties = autoconnectPage.getProperties(); - ICVSRepositoryLocation location = CVSProviderPlugin.getProvider().getRepository(properties); - boolean created = false; - if (location == null) { - location = CVSProviderPlugin.getProvider().createRepository(properties); - created = true; - } - - // Associate project with provider - ICVSFolder folder = (ICVSFolder)Session.getManagedResource(project); - FolderSyncInfo info = folder.getFolderSyncInfo(); + FolderSyncInfo info = autoconnectPage.getFolderSyncInfo(); if (info == null) { // Error! return; } - CVSTag tag = info.getTag(); + + // Get the repository location + ICVSRepositoryLocation location = CVSProviderPlugin.getProvider().getRepository(info.getRoot()); // Validate the connection if the user wants to boolean validate = autoconnectPage.getValidate(); @@ -182,7 +173,7 @@ } // Set the sharing - CVSProvider.getInstance().setSharing(project, location, properties.getProperty("module"), tag, new SubProgressMonitor(monitor, 50)); + CVSProvider.getInstance().setSharing(project, info, new SubProgressMonitor(monitor, 50)); } else { // Import doSync[0] = true; @@ -254,31 +245,7 @@ return result[0]; } - /** - * Return a Properties with connection info populated. - */ - private Properties getProperties() { - // If the import page has a location, use it. - if (locationPage != null) { - ICVSRepositoryLocation location = locationPage.getLocation(); - if (location != null) { - Properties result = new Properties(); - result.setProperty("host", location.getHost()); - result.setProperty("connection", location.getMethod().getName()); - result.setProperty("user", location.getUsername()); - int port = location.getPort(); - if (port != ICVSRepositoryLocation.USE_DEFAULT_PORT) { - result.setProperty("port", "" + port); - } - result.setProperty("root", location.getRootDirectory()); - result.setProperty("module", getModuleName()); - return result; - } - } - Properties properties = createLocationPage.getProperties(); - properties.setProperty("module", getModuleName()); - return properties; - } + /** * Return an ICVSRepositoryLocation */