Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames2002-01-31 17:30:37 +0000
committerjames2002-01-31 17:30:37 +0000
commit2351f4cf554e3130230aa1afd54321d9ef18cc77 (patch)
treedb7581ee30e438255c86c890f4a6f2e5517a00e6
parent51898a2c1aa56de888337d78898cc6c60b82bc32 (diff)
downloadeclipse.platform.team-2351f4cf554e3130230aa1afd54321d9ef18cc77.tar.gz
eclipse.platform.team-2351f4cf554e3130230aa1afd54321d9ef18cc77.tar.xz
eclipse.platform.team-2351f4cf554e3130230aa1afd54321d9ef18cc77.zip
8715: Location not validated when creation from repo view
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java38
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java29
3 files changed, 61 insertions, 38 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java
index fb5dd71ca..a28352a38 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java
@@ -1,21 +1,16 @@
package org.eclipse.team.internal.ccvs.ui;
/*
- * (c) Copyright IBM Corp. 2000, 2001.
+ * (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
@@ -30,12 +25,10 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.ui.actions.OpenRemoteFileAction;
import org.eclipse.team.internal.ccvs.ui.model.AllRootsElement;
import org.eclipse.team.internal.ccvs.ui.model.BranchTag;
import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.team.internal.ccvs.ui.wizards.ConfigurationWizardMainPage;
import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.model.WorkbenchLabelProvider;
@@ -91,13 +84,6 @@ public class RepositoriesView extends ViewPart {
};
/**
- * Add a new repository based on the given properties to the viewer.
- */
- private void addRepository(Properties properties) throws TeamException {
- ICVSRepositoryLocation root = CVSUIPlugin.getPlugin().getRepositoryManager().getRoot(properties);
- viewer.refresh();
- }
- /**
* Contribute actions to the view
*/
private void contributeActions() {
@@ -116,21 +102,7 @@ public class RepositoriesView extends ViewPart {
public void run() {
NewLocationWizard wizard = new NewLocationWizard();
WizardDialog dialog = new WizardDialog(viewer.getTree().getShell(), wizard);
- int result = dialog.open();
- if (result == WizardDialog.OK) {
- ConfigurationWizardMainPage page = (ConfigurationWizardMainPage)dialog.getCurrentPage();
- Properties properties = page.getProperties();
- try {
- addRepository(properties);
- } catch (TeamException e) {
- IStatus error = e.getStatus();
- if (error.getSeverity() == IStatus.INFO) {
- MessageDialog.openInformation(getViewSite().getShell(), Policy.bind("information"), error.getMessage());
- } else {
- ErrorDialog.openError(getViewSite().getShell(), Policy.bind("exception"), null, error);
- }
- }
- }
+ dialog.open();
}
};
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 6045d9aaa..c9daa4e12 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
@@ -29,6 +29,9 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
* Wizard page for entering information about a CVS repository location.
*/
public class ConfigurationWizardMainPage extends CVSWizardPage {
+ private boolean showValidate;
+ private boolean validate;
+
// Widgets
// Connection Method
@@ -45,7 +48,9 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
private Combo hostCombo;
// Repository Path
private Combo repositoryPathCombo;
-
+ // Validation
+ private Button validateButton;
+
private static final int COMBO_HISTORY_LENGTH = 5;
private Properties properties = new Properties();
@@ -57,6 +62,8 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
"ConfigurationWizardMainPage.STORE_HOSTNAME_ID";//$NON-NLS-1$
private static final String STORE_PATH_ID =
"ConfigurationWizardMainPage.STORE_PATH_ID";//$NON-NLS-1$
+ private static final String STORE_VALIDATE_ID =
+ "ConfigurationWizardMainPage.STORE_VALIDATE_ID";//$NON-NLS-1$
// In case the page was launched from a different wizard
private IDialogSettings settings;
@@ -154,6 +161,19 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
repositoryPathCombo.addListener(SWT.Selection, listener);
repositoryPathCombo.addListener(SWT.Modify, listener);
+ if (showValidate) {
+ validateButton = new Button(composite, SWT.CHECK);
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ validateButton.setLayoutData(data);
+ validateButton.setText("Validate repository location on finish");
+ validateButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event e) {
+ validate = validateButton.getSelection();
+ }
+ });
+ }
+
initializeValues();
updateWidgetEnablements();
if (userCombo != null) {
@@ -228,6 +248,10 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
userCombo.add(userNames[i]);
}
}
+ if (showValidate) {
+ validate = settings.getBoolean(STORE_VALIDATE_ID);
+ validateButton.setSelection(validate);
+ }
}
// Initialize other values and widget states
@@ -292,8 +316,16 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
paths = addToHistory(paths, repositoryPathCombo.getText());
settings.put(STORE_PATH_ID, paths);
+ if (showValidate) {
+ settings.put(STORE_VALIDATE_ID, validate);
+ }
}
}
+
+ public void setShowValidate(boolean showValidate) {
+ this.showValidate = showValidate;
+ }
+
/**
* Sets the properties for the repository connection
*
@@ -366,4 +398,8 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
setErrorMessage(null);
setPageComplete(true);
}
+
+ public boolean getValidate() {
+ return validate;
+ }
}
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 a6baa3827..8a72a8e40 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
@@ -1,15 +1,20 @@
package org.eclipse.team.internal.ccvs.ui.wizards;
/*
- * (c) Copyright IBM Corp. 2000, 2001.
+ * (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
import java.util.Properties;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -35,6 +40,7 @@ public class NewLocationWizard extends Wizard {
if (properties != null) {
mainPage.setProperties(properties);
}
+ mainPage.setShowValidate(true);
mainPage.setDescription(Policy.bind("NewLocationWizard.description"));
mainPage.setDialogSettings(getDialogSettings());
addPage(mainPage);
@@ -44,12 +50,21 @@ public class NewLocationWizard extends Wizard {
*/
public boolean performFinish() {
mainPage.finish(new NullProgressMonitor());
+ Properties properties = mainPage.getProperties();
+ try {
+ ICVSRepositoryLocation root = CVSUIPlugin.getPlugin().getRepositoryManager().getRoot(properties);
+ if (mainPage.getValidate()) {
+ root.validateConnection(new NullProgressMonitor());
+ }
+ } catch (TeamException e) {
+ IStatus error = e.getStatus();
+ if (error.getSeverity() == IStatus.INFO) {
+ MessageDialog.openInformation(getContainer().getShell(), Policy.bind("information"), error.getMessage());
+ } else {
+ ErrorDialog.openError(getContainer().getShell(), Policy.bind("exception"), null, error);
+ }
+ return false;
+ }
return true;
}
- public Properties getProperties() {
- return mainPage.getProperties();
- }
- public void setProperties(Properties properties) {
- this.properties = properties;
- }
}

Back to the top