Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java15
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java90
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java137
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java275
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java23
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java165
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java7
9 files changed, 422 insertions, 294 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
index 48223a63a..838453b45 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
@@ -191,21 +191,6 @@ public class Session {
* Return the location to be used for this connection
*/
private CVSRepositoryLocation getLocationForConnection(boolean writeAccess) {
- try {
- if (writeAccess) {
- String writeLocation = location.getWriteLocation();
- if (writeLocation != null) {
- return (CVSRepositoryLocation)KnownRepositories.getInstance().getRepository(writeLocation);
- }
- } else {
- String readLocation = location.getReadLocation();
- if (readLocation != null) {
- return (CVSRepositoryLocation)KnownRepositories.getInstance().getRepository(readLocation);
- }
- }
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- }
return location;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index 3ec780fc7..3c4af806e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -59,8 +59,6 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
// Preference keys used to persist the state of the location
public static final String PREF_LOCATION = "location"; //$NON-NLS-1$
- public static final String PREF_WRITE_LOCATION = "write"; //$NON-NLS-1$
- public static final String PREF_READ_LOCATION = "read"; //$NON-NLS-1$
public static final String PREF_SERVER_ENCODING = "encoding"; //$NON-NLS-1$
// server platform constants
@@ -108,7 +106,9 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
public static final String USER_VARIABLE = "{user}"; //$NON-NLS-1$
public static final String PASSWORD_VARIABLE = "{password}"; //$NON-NLS-1$
public static final String HOST_VARIABLE = "{host}"; //$NON-NLS-1$
- public static final String PORT_VARIABLE = "{port}"; //$NON-NLS-1$
+ public static final String PORT_VARIABLE = "{port}";
+
+ private static String extProxy; //$NON-NLS-1$
static {
URL temp = null;
@@ -144,6 +144,17 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
}
/**
+ * Set the proxy connection method that is to be used when a
+ * repository location has the ext connection method. This is
+ * usefull with the extssh connection method as it can be used to
+ * kepp the sandbox compatible with the command line client.
+ * @param string
+ */
+ public static void setExtConnectionMethodProxy(String string) {
+ extProxy = string;
+ }
+
+ /**
* Validate whether the given string is a valid registered connection method
* name.
* @param methodName the method name
@@ -512,7 +523,11 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
* be handled by the caller.
*/
private Connection createConnection(String password, IProgressMonitor monitor) throws CVSException {
- Connection connection = new Connection(this, method.createConnection(this, password));
+ IConnectionMethod methodToUse = method;
+ if (method.getName().equals("ext") && extProxy != null && !extProxy.equals(method.getName())) { //$NON-NLS-1$
+ methodToUse = getPluggedInConnectionMethod(extProxy);
+ }
+ Connection connection = new Connection(this, methodToUse.createConnection(this, password));
connection.open(monitor);
return connection;
}
@@ -1084,73 +1099,6 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
// This is not a server message with the desired prefix
return null;
}
-
- /**
- * The read location is a string that contains the connection details
- * to be used when performing an operation that only requires read-access
- * to the repository.
- *
- * @return Returns the readLocation.
- */
- public String getReadLocation() {
- if (hasPreferences()) {
- return internalGetPreferences().get(PREF_READ_LOCATION, null);
- } else {
- return null;
- }
- }
-
- /**
- * Set the location used to perform operations that only require
- * read-access to the repository. Passing a value of <code>null</code>
- * will cause the receiver's information to be used when connecting
- * for read access.
- * @param readLocation The readLocation to set.
- */
- public void setReadLocation(String readLocation) {
- if (readLocation == null || readLocation.equals(getLocation())) {
- if (hasPreferences()) {
- internalGetPreferences().remove(PREF_READ_LOCATION);
- }
- } else {
- ensurePreferencesStored();
- internalGetPreferences().put(PREF_READ_LOCATION, readLocation);
- flushPreferences();
- }
- }
-
- /**
- * The write location is a string that contains the connection details
- * to be used when performing an operation that only requires read-access
- * to the repository.
- * @return Returns the writeLocation.
- */
- public String getWriteLocation() {
- if (hasPreferences()) {
- return internalGetPreferences().get(PREF_WRITE_LOCATION, null);
- } else {
- return null;
- }
- }
-
- /**
- * Set the location used to perform operations that require
- * write-access to the repository. Passing a value of <code>null</code>
- * will cause the receiver's information to be used when connecting
- * for write access.
- * @param writeLocation The writeLocation to set.
- */
- public void setWriteLocation(String writeLocation) {
- if (writeLocation == null || writeLocation.equals(getLocation())) {
- if (hasPreferences()) {
- internalGetPreferences().remove(PREF_WRITE_LOCATION);
- }
- } else {
- ensurePreferencesStored();
- internalGetPreferences().put(PREF_WRITE_LOCATION, writeLocation);
- flushPreferences();
- }
- }
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation#getUserAuthenticator()
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 3d982044e..f94824931 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
+import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole;
import org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
@@ -593,6 +594,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
store.setDefault(ICVSUIConstants.PREF_CVS_RSH, CVSProviderPlugin.DEFAULT_CVS_RSH);
store.setDefault(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS, CVSProviderPlugin.DEFAULT_CVS_RSH_PARAMETERS);
store.setDefault(ICVSUIConstants.PREF_CVS_SERVER, CVSProviderPlugin.DEFAULT_CVS_SERVER);
+ store.setDefault(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY, "ext"); //$NON-NLS-1$
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_CHANGE_GRANULARITY, true);
store.setDefault(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION, true);
store.setDefault(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, CVSProviderPlugin.DEFAULT_CONFIRM_MOVE_TAG);
@@ -634,6 +636,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
CVSProviderPlugin.getPlugin().setCvsRshCommand(store.getString(ICVSUIConstants.PREF_CVS_RSH));
CVSProviderPlugin.getPlugin().setCvsRshParameters(store.getString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS));
CVSProviderPlugin.getPlugin().setCvsServer(store.getString(ICVSUIConstants.PREF_CVS_SERVER));
+ CVSRepositoryLocation.setExtConnectionMethodProxy(store.getString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY));
CVSProviderPlugin.getPlugin().setQuietness(CVSPreferencesPage.getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
CVSProviderPlugin.getPlugin().setCompressionLevel(store.getInt(ICVSUIConstants.PREF_COMPRESSION_LEVEL));
CVSProviderPlugin.getPlugin().setReplaceUnmanaged(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
index 6aa2ab602..9eede4d06 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
@@ -16,9 +16,12 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
@@ -27,6 +30,8 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ccvs.core.IConnectionMethod;
+import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.help.WorkbenchHelp;
@@ -36,6 +41,10 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
Text cvsRsh;
Text cvsServer;
Text cvsRshParameters;
+ private Button useExternal;
+ private Button useInternal;
+ private Combo methodType;
+ private Control internal, external;
/*
* @see PreferencePage#createContents(Composite)
@@ -45,6 +54,65 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData());
+
+ SelectionAdapter selectionListener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateEnablements();
+ }
+ };
+
+ useExternal = createRadioButton(composite, "Use an external program to connect", 1);
+ useExternal.addSelectionListener(selectionListener);
+ external = createExternalArea(composite);
+
+ useInternal = createRadioButton(composite, "Use another connection method type to connect", 1);
+ useInternal.addSelectionListener(selectionListener);
+ internal = createInternalArea(composite);
+
+ initializeDefaults();
+ WorkbenchHelp.setHelp(composite, IHelpContextIds.EXT_PREFERENCE_PAGE);
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ private void updateEnablements() {
+ external.setEnabled(useExternal.getSelection());
+ cvsRsh.setEnabled(useExternal.getSelection());
+ cvsRshParameters.setEnabled(useExternal.getSelection());
+ cvsServer.setEnabled(useExternal.getSelection());
+ internal.setEnabled(!useExternal.getSelection());
+ methodType.setEnabled(!useExternal.getSelection());
+ }
+
+ private Control createInternalArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 5;
+ layout.marginHeight = 5;
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData());
+
+ Label intro = new Label(composite, SWT.LEFT | SWT.WRAP);
+ intro.setText("Choosing to use another connection method allows the meta information in CVS projects to be compatible with external CVS tools while using a custom connection method."); //$NON-NLS-1$
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = 300;
+ intro.setLayoutData(data);
+
+ createLabel(composite, Policy.bind("CVSPropertiesPage.connectionType"), 1); //$NON-NLS-1$
+ methodType = createCombo(composite);
+ return composite;
+ }
+ protected Control createExternalArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 5;
+ layout.marginHeight = 5;
layout.numColumns = 3;
composite.setLayout(layout);
composite.setLayoutData(new GridData());
@@ -94,20 +162,34 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
data.horizontalAlignment = GridData.FILL;
cvsServer.setLayoutData(data);
- initializeDefaults();
- WorkbenchHelp.setHelp(composite, IHelpContextIds.EXT_PREFERENCE_PAGE);
WorkbenchHelp.setHelp(cvsRsh, IHelpContextIds.EXT_PREFERENCE_RSH);
WorkbenchHelp.setHelp(cvsRshParameters, IHelpContextIds.EXT_PREFERENCE_PARAM);
WorkbenchHelp.setHelp(cvsServer, IHelpContextIds.EXT_PREFERENCE_SERVER);
- Dialog.applyDialogFont(parent);
return composite;
}
- protected void initializeDefaults() {
+ private void initializeDefaults() {
IPreferenceStore store = getPreferenceStore();
cvsRsh.setText(store.getString(ICVSUIConstants.PREF_CVS_RSH));
cvsRshParameters.setText(store.getString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS));
cvsServer.setText(store.getString(ICVSUIConstants.PREF_CVS_SERVER));
+
+ IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
+ for (int i = 0; i < methods.length; i++) {
+ String name = methods[i].getName();
+ if (!name.equals("ext")) { //$NON-NLS-1$
+ methodType.add(name);
+ }
+ }
+ String method = store.getString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY);
+ if (method.equals("ext")) {
+ methodType.select(0);
+ } else {
+ methodType.select(methodType.indexOf(method));
+ }
+ useExternal.setSelection(method.equals("ext")); //$NON-NLS-1$
+ useInternal.setSelection(!method.equals("ext")); //$NON-NLS-1$
+ updateEnablements();
}
/*
@@ -128,12 +210,20 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
*/
public boolean performOk() {
IPreferenceStore store = getPreferenceStore();
- store.setValue(ICVSUIConstants.PREF_CVS_RSH, cvsRsh.getText());
- store.setValue(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS, cvsRshParameters.getText());
- store.setValue(ICVSUIConstants.PREF_CVS_SERVER, cvsServer.getText());
- CVSProviderPlugin.getPlugin().setCvsRshCommand(cvsRsh.getText());
- CVSProviderPlugin.getPlugin().setCvsRshParameters(cvsRshParameters.getText());
- CVSProviderPlugin.getPlugin().setCvsServer(cvsServer.getText());
+ String method;
+ if (useExternal.getSelection()) {
+ method = "ext"; //$NON-NLS-1$
+ store.setValue(ICVSUIConstants.PREF_CVS_RSH, cvsRsh.getText());
+ store.setValue(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS, cvsRshParameters.getText());
+ store.setValue(ICVSUIConstants.PREF_CVS_SERVER, cvsServer.getText());
+ CVSProviderPlugin.getPlugin().setCvsRshCommand(cvsRsh.getText());
+ CVSProviderPlugin.getPlugin().setCvsRshParameters(cvsRshParameters.getText());
+ CVSProviderPlugin.getPlugin().setCvsServer(cvsServer.getText());
+ } else {
+ method = methodType.getText();
+ }
+ store.setValue(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY, method);
+ CVSRepositoryLocation.setExtConnectionMethodProxy(method);
CVSUIPlugin.getPlugin().savePluginPreferences();
return super.performOk();
}
@@ -143,4 +233,31 @@ public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenc
protected IPreferenceStore doGetPreferenceStore() {
return CVSUIPlugin.getPlugin().getPreferenceStore();
}
+
+ protected Button createRadioButton(Composite parent, String label, int span) {
+ Button button = new Button(parent, SWT.RADIO);
+ button.setText(label);
+ GridData data = new GridData();
+ data.horizontalSpan = span;
+ button.setLayoutData(data);
+ return button;
+ }
+
+ protected Label createLabel(Composite parent, String text, int span) {
+ Label label = new Label(parent, SWT.LEFT);
+ label.setText(text);
+ GridData data = new GridData();
+ data.horizontalSpan = span;
+ data.horizontalAlignment = GridData.FILL;
+ label.setLayoutData(data);
+ return label;
+ }
+ protected Combo createCombo(Composite parent) {
+ Combo combo = new Combo(parent, SWT.READ_ONLY);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ data.horizontalSpan = 1;
+ combo.setLayoutData(data);
+ return combo;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index 986b3b1f1..920559706 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -84,6 +84,7 @@ public interface ICVSUIConstants {
public final String PREF_DEBUG_PROTOCOL = "pref_debug_protocol"; //$NON-NLS-1$
public final String PREF_WARN_REMEMBERING_MERGES = "pref_remember_merges"; //$NON-NLS-1$
public final String PREF_FIRST_STARTUP = "pref_first_startup"; //$NON-NLS-1$
+ public final String PREF_EXT_CONNECTION_METHOD_PROXY = "pref_ext_connection_method_proxy"; //$NON-NLS-1$
// console preferences
public final String PREF_CONSOLE_COMMAND_COLOR = "pref_console_command_color"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
index 951dee4dc..f4e1f8329 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
@@ -18,6 +18,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
@@ -33,6 +34,7 @@ import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.wizards.ConfigurationWizardMainPage;
import org.eclipse.team.internal.ui.dialogs.DetailsDialogWithProjects;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.PropertyPage;
@@ -45,9 +47,16 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
Text userText;
Text passwordText;
Combo methodType;
- Label hostLabel;
- Label pathLabel;
- Label portLabel;
+ Text hostText;
+ Text pathText;
+ // Port
+ private Text portText;
+ private Button useDefaultPort;
+ private Button useCustomPort;
+
+ // Caching password
+ private Button allowCachingButton;
+ private boolean allowCaching = false;
boolean passwordChanged;
boolean connectionInfoChanged;
@@ -58,11 +67,6 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
private Button useLocationAsLabel;
private Button useCustomLabel;
private Text labelText;
- // Read/write access
- private Button useDefaultReadWriteLocations;
- private Button useCustomReadWriteLocations;
- private Combo readLocation;
- private Combo writeLocation;
/*
* @see PreferencesPage#createContents
@@ -111,84 +115,85 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
passwordText = createPasswordField(composite);
createLabel(composite, Policy.bind("CVSPropertiesPage.host"), 1); //$NON-NLS-1$
- hostLabel = createLabel(composite, "", 2); //$NON-NLS-1$
-
- createLabel(composite, Policy.bind("CVSPropertiesPage.port"), 1); //$NON-NLS-1$
- portLabel = createLabel(composite, "", 2); //$NON-NLS-1$
+ hostText = createTextField(composite);
createLabel(composite, Policy.bind("CVSPropertiesPage.path"), 1); //$NON-NLS-1$
- pathLabel = createLabel(composite, "", 2); //$NON-NLS-1$
+ pathText = createTextField(composite);
+
+ // Port number
+ // create a composite to ensure the radio buttons come in the correct order
+ Composite portGroup = new Composite(composite, SWT.NONE);
+ data = new GridData();
+ data.horizontalSpan = 3;
+ portGroup.setLayoutData(data);
+ layout = new GridLayout();
+ layout.numColumns = 3;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ portGroup.setLayout(layout);
+ useDefaultPort = createRadioButton(portGroup, Policy.bind("ConfigurationWizardMainPage.useDefaultPort"), 3); //$NON-NLS-1$
+ useCustomPort = createRadioButton(portGroup, Policy.bind("ConfigurationWizardMainPage.usePort"), 1); //$NON-NLS-1$
+ portText = createTextField(portGroup);
// Add some extra space
createLabel(composite, "", 3); //$NON-NLS-1$
+ allowCachingButton = new Button(composite, SWT.CHECK);
+ allowCachingButton.setText(Policy.bind("UserValidationDialog.6")); //$NON-NLS-1$
+ data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ data.horizontalSpan = 3;
+ allowCachingButton.setLayoutData(data);
+ allowCachingButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ allowCaching = allowCachingButton.getSelection();
+ }
+ });
+
+ Composite warningComposite = new Composite(composite, SWT.NONE);
+ layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginHeight = 0;
+ warningComposite.setLayout(layout);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 3;
+ warningComposite.setLayoutData(data);
+ Label warningLabel = new Label(warningComposite, SWT.NONE);
+ warningLabel.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
+ warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
+ Label warningText = new Label(warningComposite, SWT.WRAP);
+ warningText.setText(Policy.bind("UserValidationDialog.7")); //$NON-NLS-1$
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 300;
+ warningText.setLayoutData(data);
+
// Add some extra space
createLabel(composite, "", 3); //$NON-NLS-1$
- createReadWriteAccessComposite(composite);
-
initializeValues();
updateWidgetEnablements();
- passwordText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- passwordChanged = true;
- }
- });
- userText.addListener(SWT.Modify, new Listener() {
+ Listener connectionInfoChangedListener = new Listener() {
public void handleEvent(Event event) {
connectionInfoChanged = true;
updateWidgetEnablements();
}
- });
- methodType.addListener(SWT.Modify, new Listener() {
+ };
+ passwordText.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event event) {
- connectionInfoChanged = true;
- }
- });
- useDefaultReadWriteLocations.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateWidgetEnablements();
-
- }
- });
- useCustomReadWriteLocations.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateWidgetEnablements();
-
+ passwordChanged = true;
}
});
+ userText.addListener(SWT.Modify, connectionInfoChangedListener);
+ methodType.addListener(SWT.Modify, connectionInfoChangedListener);
+ hostText.addListener(SWT.Modify, connectionInfoChangedListener);
+ portText.addListener(SWT.Modify, connectionInfoChangedListener);
+ useCustomPort.addListener(SWT.Selection, connectionInfoChangedListener);
+ pathText.addListener(SWT.Modify, connectionInfoChangedListener);
WorkbenchHelp.setHelp(getControl(), IHelpContextIds.REPOSITORY_LOCATION_PROPERTY_PAGE);
Dialog.applyDialogFont(parent);
return composite;
}
- /**
- * @param composite
- */
- private void createReadWriteAccessComposite(Composite composite) {
- Composite radioGroup = createRadioGroupComposite(composite);
- useDefaultReadWriteLocations = createRadioButton(radioGroup, Policy.bind("CVSRepositoryPropertiesPage.21"), 3); //$NON-NLS-1$
- useCustomReadWriteLocations = createRadioButton(radioGroup, Policy.bind("CVSRepositoryPropertiesPage.22"), 3); //$NON-NLS-1$
- createLabel(composite, Policy.bind("CVSRepositoryPropertiesPage.23"), 1); //$NON-NLS-1$
- readLocation = createCombo(composite);
- createLabel(composite, Policy.bind("CVSRepositoryPropertiesPage.24"), 1); //$NON-NLS-1$
- writeLocation = createCombo(composite);
- }
- /**
- * @param composite
- */
- private Composite createRadioGroupComposite(Composite composite) {
- Composite radioGroup = new Composite(composite, SWT.NONE);
- GridData data = new GridData();
- data.horizontalSpan = 3;
- radioGroup.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- radioGroup.setLayout(layout);
- return radioGroup;
- }
/**
* Utility method that creates a combo box
@@ -293,6 +298,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
*/
private void initializeValues() {
passwordChanged = false;
+ connectionInfoChanged = false;
IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
for (int i = 0; i < methods.length; i++) {
@@ -303,14 +309,19 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
info = location.getUserInfo(true);
userText.setText(info.getUsername());
passwordText.setText("*********"); //$NON-NLS-1$
- hostLabel.setText(location.getHost());
+ hostText.setText(location.getHost());
int port = location.getPort();
if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- portLabel.setText(Policy.bind("CVSPropertiesPage.defaultPort")); //$NON-NLS-1$
+ useDefaultPort.setSelection(true);
+ useCustomPort.setSelection(false);
+ portText.setEnabled(false);
} else {
- portLabel.setText("" + port); //$NON-NLS-1$
+ useDefaultPort.setSelection(false);
+ useCustomPort.setSelection(true);
+ portText.setText("" + port); //$NON-NLS-1$
}
- pathLabel.setText(location.getRootDirectory());
+ pathText.setText(location.getRootDirectory());
+ allowCachingButton.setSelection(location.getUserInfoCached());
// get the repository label
String label = null;
@@ -322,41 +333,17 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
label = location.getLocation();
}
labelText.setText(label);
-
- // Fill in read/write repo locations
- String currentReadLocation = ((CVSRepositoryLocation)root.getRoot()).getReadLocation();
- String currentWriteLocation = ((CVSRepositoryLocation)root.getRoot()).getWriteLocation();
- try {
- // Ensure the read and write locations are listed
- if (currentReadLocation != null) {
- KnownRepositories.getInstance().getRepository(currentReadLocation);
- }
- if (currentWriteLocation != null) {
- KnownRepositories.getInstance().getRepository(currentWriteLocation);
- }
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- }
-
- ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation location = locations[i];
- readLocation.add(location.getLocation());
- writeLocation.add(location.getLocation());
- }
- readLocation.setText(currentReadLocation == null ? root.getRoot().getLocation() : currentReadLocation);
- writeLocation.setText(currentWriteLocation == null ? root.getRoot().getLocation() : currentWriteLocation);
- if (currentReadLocation == null && currentWriteLocation == null) {
- useDefaultReadWriteLocations.setSelection(true);
- useCustomReadWriteLocations.setSelection(false);
- } else {
- useDefaultReadWriteLocations.setSelection(false);
- useCustomReadWriteLocations.setSelection(true);
- }
}
private boolean performConnectionInfoChanges() {
- // Don't do anything if there wasn't a password or connection change
+ // Set the caching mode of the location
+ if (!connectionInfoChanged) {
+ location.setAllowCaching(allowCaching);
+ if (!passwordChanged) {
+ ((CVSRepositoryLocation)location).updateCache();
+ }
+ }
+ // Don't do anything else if there wasn't a password or connection change
if (!passwordChanged && !connectionInfoChanged) return true;
try {
@@ -364,7 +351,9 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
if (passwordChanged && !connectionInfoChanged) {
CVSRepositoryLocation oldLocation = (CVSRepositoryLocation)location;
oldLocation.setPassword(getNewPassword());
- oldLocation.updateCache();
+ if (allowCaching) {
+ oldLocation.updateCache();
+ }
passwordChanged = false;
return true;
}
@@ -372,19 +361,21 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
// Otherwise change the connection info and the password
// This operation is done inside a workspace operation in case the sharing
// info for existing projects is changed
+ if (!(location.getHost().equals(hostText.getText()) && location.getRootDirectory().equals(pathText.getText()))) {
+ // The host or path has changed
+ if (!MessageDialog.openConfirm(getShell(),
+ "Confirm Host or Path Change",
+ "You have chosen to change the host name or repository root path for this location. You should only continue of you are sure you know what you are doing.")) {
+ return false;
+ }
+ }
final boolean[] result = new boolean[] { false };
new ProgressMonitorDialog(getShell()).run(false, false, new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
// Create a new repository location with the new information
- CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromString(location.getLocation());
- newLocation.setMethod(methodType.getText());
- info.setUsername(userText.getText());
- if (passwordChanged) {
- info.setPassword(getNewPassword());
- }
- newLocation.setUserInfo(info);
-
+ CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromProperties(createProperties());
+ location.setAllowCaching(allowCaching);
try {
// For each project shared with the old location, set connection info to the new one
List projects = new ArrayList();
@@ -455,7 +446,6 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
private void performNonConnectionInfoChanges() {
recordNewLabel((CVSRepositoryLocation)location);
- recordReadWriteLocations((CVSRepositoryLocation)location);
}
/*
* @see PreferencesPage#performOk
@@ -467,6 +457,15 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
}
return false;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ super.performDefaults();
+ initializeValues();
+ }
+
/**
* Shows the given errors to the user.
*/
@@ -483,12 +482,10 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
} else {
labelText.setEnabled(true);
}
- if (useDefaultReadWriteLocations.getSelection()) {
- readLocation.setEnabled(false);
- writeLocation.setEnabled(false);
+ if (useDefaultPort.getSelection()) {
+ portText.setEnabled(false);
} else {
- readLocation.setEnabled(true);
- writeLocation.setEnabled(true);
+ portText.setEnabled(true);
}
validateFields();
}
@@ -501,15 +498,43 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
}
}
String user = userText.getText();
- if ((user.indexOf('@') != -1) || (user.indexOf(':') != -1)) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidUserName")); //$NON-NLS-1$
- setValid(false);
+ IStatus status = ConfigurationWizardMainPage.validateUserName(user);
+ if (!isStatusOK(status)) {
return;
}
+
+ String host = hostText.getText();
+ status = ConfigurationWizardMainPage.validateHost(host);
+ if (!isStatusOK(status)) {
+ return;
+ }
+
+ if (portText.isEnabled()) {
+ String port = portText.getText();
+ status = ConfigurationWizardMainPage.validatePort(port);
+ if (!isStatusOK(status)) {
+ return;
+ }
+ }
+
+ String pathString = pathText.getText();
+ if (!isStatusOK(status)) {
+ return;
+ }
+
setErrorMessage(null);
setValid(true);
}
+ private boolean isStatusOK(IStatus status) {
+ if (!status.isOK()) {
+ setErrorMessage(status.getMessage());
+ setValid(false);
+ return false;
+ }
+ return true;
+ }
+
private void recordNewLabel(CVSRepositoryLocation location) {
String newLabel = getNewLabel(location);
if (newLabel == null) {
@@ -542,10 +567,18 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
/* internal use only */ String getNewPassword() {
return passwordText.getText();
}
- private void recordReadWriteLocations(CVSRepositoryLocation location) {
- location.setReadLocation(useDefaultReadWriteLocations.getSelection() ? null : readLocation.getText());
- location.setWriteLocation(useDefaultReadWriteLocations.getSelection() ? null : writeLocation.getText());
- // TODO: These will be lost if a crash occurres before shutdown
+
+ private Properties createProperties() {
+ Properties result = new Properties();
+ result.setProperty("connection", methodType.getText()); //$NON-NLS-1$
+ result.setProperty("user", userText.getText()); //$NON-NLS-1$
+ result.setProperty("password", passwordText.getText()); //$NON-NLS-1$
+ result.setProperty("host", hostText.getText()); //$NON-NLS-1$
+ if (useCustomPort.getSelection()) {
+ result.setProperty("port", portText.getText()); //$NON-NLS-1$
+ }
+ result.setProperty("root", pathText.getText()); //$NON-NLS-1$
+ return result;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
index 5177da27b..5208278b1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
@@ -10,14 +10,19 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.repo;
-import java.util.*;
-
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
import org.eclipse.core.runtime.Path;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.xml.sax.*;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class RepositoriesViewContentHandler extends DefaultHandler {
@@ -141,14 +146,6 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
if (name != null) {
currentRepositoryRoot.setName(name);
}
- String readLocation = atts.getValue(READ_ID_ATTRIBUTE);
- if (readLocation != null) {
- ((CVSRepositoryLocation)root).setReadLocation(readLocation);
- }
- String writeLocation = atts.getValue(WRITE_ID_ATTRIBUTE);
- if (writeLocation != null) {
- ((CVSRepositoryLocation)root).setWriteLocation(writeLocation);
- }
} else if(elementName.equals(DATE_TAGS_TAG)){
//prepare to collect date tag
dateTags = new ArrayList();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
index ed8ea5951..42ffd5661 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
@@ -11,20 +11,37 @@
package org.eclipse.team.internal.ccvs.ui.wizards;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import java.util.Properties;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.*;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.IConnectionMethod;
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.ui.help.WorkbenchHelp;
@@ -446,76 +463,50 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
*/
private void validateFields() {
String user = userCombo.getText();
- if (user.length() == 0) {
- setErrorMessage(null);
- setPageComplete(false);
- return;
- }
- if ((user.indexOf('@') != -1) || (user.indexOf(':') != -1)) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidUserName")); //$NON-NLS-1$
- setPageComplete(false);
+ IStatus status = validateUserName(user);
+ if (!isStatusOK(status)) {
return;
}
String host = hostCombo.getText();
- if (host.length() == 0) {
- setErrorMessage(null);
- setPageComplete(false);
- return;
- }
- if (host.indexOf(':') != -1) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidHostName")); //$NON-NLS-1$
- setPageComplete(false);
+ status = validateHost(host);
+ if (!isStatusOK(status)) {
return;
}
if (portText.isEnabled()) {
- if (portText.getText().length() == 0) {
- setErrorMessage(null);
- setPageComplete(false);
- return;
- }
- try {
- Integer.parseInt(portText.getText());
- } catch (NumberFormatException e) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidPort")); //$NON-NLS-1$
- setPageComplete(false);
+ String port = portText.getText();
+ status = validatePort(port);
+ if (!isStatusOK(status)) {
return;
}
}
- if (repositoryPathCombo.getText().length() == 0) {
- setErrorMessage(null);
- setPageComplete(false);
+ String pathString = repositoryPathCombo.getText();
+ status = validatePath(pathString);
+ if (!isStatusOK(status)) {
return;
- } else {
- String pathString = repositoryPathCombo.getText();
- IPath path = new Path(pathString);
- String[] segments = path.segments();
- for (int i = 0; i < segments.length; i++) {
- String string = segments[i];
- if (string.charAt(0) == ' ' || string.charAt(string.length() -1) == ' ') {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidPathWithSpaces")); //$NON-NLS-1$
- setPageComplete(false);
- return;
- }
- }
- // look for // and inform the user that we support use of C:\cvs\root instead of /c//cvs/root
- if (pathString.indexOf("//") != -1) { //$NON-NLS-1$
- if (pathString.indexOf("//") == 2) { //$NON-NLS-1$
- // The user is probably trying to specify a CVSNT path
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.useNTFormat")); //$NON-NLS-1$
- } else {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidPathWithSlashes")); //$NON-NLS-1$
- }
- setPageComplete(false);
- return;
- }
}
+
+ // Everything passed so we're good to go
setErrorMessage(null);
setPageComplete(true);
}
+ private boolean isStatusOK(IStatus status) {
+ if (!status.isOK()) {
+ if (status.getCode() == REQUIRED_FIELD) {
+ // Don't set the message for an empty field
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(status.getMessage());
+ }
+ setPageComplete(false);
+ return false;
+ }
+ return true;
+ }
+
public boolean getValidate() {
return validate;
}
@@ -526,4 +517,64 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
}
}
+ public static final int REQUIRED_FIELD = 1;
+ public static final int INVALID_FIELD_CONTENTS = 1;
+ public static final IStatus validateUserName(String user) {
+ if (user.length() == 0) {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, "User Name Required", null);
+ }
+ if ((user.indexOf('@') != -1) || (user.indexOf(':') != -1)) {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
+ Policy.bind("ConfigurationWizardMainPage.invalidUserName"), null); //$NON-NLS-1$
+ }
+ return Status.OK_STATUS;
+ }
+ public static final IStatus validateHost(String host) {
+ if (host.length() == 0) {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, "Host Required", null);
+ }
+ if (host.indexOf(':') != -1) {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
+ Policy.bind("ConfigurationWizardMainPage.invalidHostName"), null); //$NON-NLS-1$
+ }
+ return Status.OK_STATUS;
+ }
+ public static final IStatus validatePort(String port) {
+ if (port.length() == 0) {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, "Port Required", null);
+ }
+ try {
+ Integer.parseInt(port);
+ } catch (NumberFormatException e) {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
+ Policy.bind("ConfigurationWizardMainPage.invalidPort"), null); //$NON-NLS-1$
+ }
+ return Status.OK_STATUS;
+ }
+ public static final IStatus validatePath(String pathString) {
+ if (pathString.length() == 0) {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, "Repository Path Required", null);
+ }
+ IPath path = new Path(pathString);
+ String[] segments = path.segments();
+ for (int i = 0; i < segments.length; i++) {
+ String string = segments[i];
+ if (string.charAt(0) == ' ' || string.charAt(string.length() -1) == ' ') {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
+ Policy.bind("ConfigurationWizardMainPage.invalidPathWithSpaces"), null); //$NON-NLS-1$
+ }
+ }
+ // look for // and inform the user that we support use of C:\cvs\root instead of /c//cvs/root
+ if (pathString.indexOf("//") != -1) { //$NON-NLS-1$
+ if (pathString.indexOf("//") == 2) { //$NON-NLS-1$
+ // The user is probably trying to specify a CVSNT path
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
+ Policy.bind("ConfigurationWizardMainPage.useNTFormat"), null); //$NON-NLS-1$
+ } else {
+ return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
+ Policy.bind("ConfigurationWizardMainPage.invalidPathWithSlashes"), null); //$NON-NLS-1$
+ }
+ }
+ return Status.OK_STATUS;
+ }
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java
index 0d989f709..cf6279aeb 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java
@@ -30,9 +30,6 @@ public class CVSTestSetup extends TestSetup {
public static final int COMPRESSION_LEVEL;
public static final boolean FAIL_IF_EXCEPTION_LOGGED;
- public static final String READ_REPOSITORY_LOCATION;
- public static final String WRITE_REPOSITORY_LOCATION;
-
public static CVSRepositoryLocation repository;
public static CVSTestLogListener logListener;
@@ -40,8 +37,6 @@ public class CVSTestSetup extends TestSetup {
static {
loadProperties();
REPOSITORY_LOCATION = System.getProperty("eclipse.cvs.repository");
- READ_REPOSITORY_LOCATION = System.getProperty("eclipse.cvs.repository.read");
- WRITE_REPOSITORY_LOCATION = System.getProperty("eclipse.cvs.repository.write");
INITIALIZE_REPO = Boolean.valueOf(System.getProperty("eclipse.cvs.initrepo", "false")).booleanValue();
DEBUG = Boolean.valueOf(System.getProperty("eclipse.cvs.debug", "false")).booleanValue();
RSH = System.getProperty("eclipse.cvs.rsh", "rsh");
@@ -183,8 +178,6 @@ public class CVSTestSetup extends TestSetup {
CVSRepositoryLocation repository = (CVSRepositoryLocation)KnownRepositories.getInstance().getRepository(location);
KnownRepositories.getInstance().addRepository(repository, false);
repository.setUserAuthenticator(new TestsUserAuthenticator());
- repository.setReadLocation(READ_REPOSITORY_LOCATION);
- repository.setWriteLocation(WRITE_REPOSITORY_LOCATION);
// Give some info about which repository the tests are running with
System.out.println("Connecting to: " + repository.getHost() + ":" + repository.getMethod().getName());

Back to the top