Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames2002-04-19 18:47:55 +0000
committerjames2002-04-19 18:47:55 +0000
commit9590f0ef14f75aef6a360b115c944fe1722e79e1 (patch)
tree75405fcd42bd4e93a01e79ad10314258affd3851
parentcc5396e4ef4c61f975f180dda857818aa61b6a2c (diff)
downloadeclipse.platform.team-9590f0ef14f75aef6a360b115c944fe1722e79e1.tar.gz
eclipse.platform.team-9590f0ef14f75aef6a360b115c944fe1722e79e1.tar.xz
eclipse.platform.team-9590f0ef14f75aef6a360b115c944fe1722e79e1.zip
14329: Need "edit location" on CVS Repository Exploring perspective
12077: Handling of "Properties" of Repo Location 8891: Can't change properties of a CVS connection in repo view
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java352
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java (renamed from bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java)162
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java16
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java9
7 files changed, 469 insertions, 89 deletions
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 17523f25a..0a10e7420 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
@@ -867,7 +867,7 @@ public class CVSTeamProvider extends RepositoryProvider {
/*
* This method expects to be passed an InfiniteSubProgressMonitor
*/
- private void setRemoteRoot(ICVSRepositoryLocation location, IProgressMonitor monitor) throws TeamException {
+ public void setRemoteRoot(ICVSRepositoryLocation location, IProgressMonitor monitor) throws TeamException {
// Check if there is a differnece between the new and old roots
final String root = location.getLocation();
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 2d86c9ce0..e39555784 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -70,13 +70,19 @@
objectClass="org.eclipse.core.resources.IProject"
adaptable="true"
name="%CVS"
- class="org.eclipse.team.internal.ccvs.ui.CVSPropertiesPage"
- id="org.eclipse.team.ccvs.ui.propertyPages.CVSPropertiesPage">
+ class="org.eclipse.team.internal.ccvs.ui.CVSProjectPropertiesPage"
+ id="org.eclipse.team.ccvs.ui.propertyPages.CVSProjectPropertiesPage">
<filter
name="projectNature"
value="org.eclipse.team.cvs.core.cvsnature">
</filter>
</page>
+ <page
+ objectClass="org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation"
+ name="%CVS"
+ class="org.eclipse.team.internal.ccvs.ui.CVSRepositoryPropertiesPage"
+ id="org.eclipse.team.ccvs.ui.propertyPages.CVSRepositoryPropertiesPage">
+ </page>
</extension>
<!-- ******************* Menus ******************** -->
<extension
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
new file mode 100644
index 000000000..c1daed6dc
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
@@ -0,0 +1,352 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.internal.ccvs.core.ICVSFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.IUserInfo;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+public class CVSProjectPropertiesPage extends PropertyPage {
+ IProject project;
+ ICVSRepositoryLocation oldLocation;
+ ICVSRepositoryLocation newLocation = null;
+
+ // Widgets
+ Label methodLabel;
+ Label userLabel;
+ Label hostLabel;
+ Label pathLabel;
+ Label moduleLabel;
+ Label portLabel;
+ Label tagLabel;
+
+ IUserInfo info;
+ CVSTeamProvider provider;
+
+ private class RepositorySelectionDialog extends Dialog {
+ ICVSRepositoryLocation[] locations;
+ ICVSRepositoryLocation location;
+
+ TableViewer viewer;
+ Button okButton;
+ public RepositorySelectionDialog(Shell shell) {
+ super(shell);
+ }
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Cancel buttons by default
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ okButton.setEnabled(false);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+ protected Control createDialogArea(Composite parent) {
+ parent.getShell().setText(Policy.bind("CVSProjectPropertiesPage.Select_a_Repository_1")); //$NON-NLS-1$
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createLabel(composite, Policy.bind("CVSProjectPropertiesPage.Select_a_CVS_repository_location_to_share_the_project_with__2"), 1); //$NON-NLS-1$
+ viewer = new TableViewer(composite, SWT.SINGLE);
+ viewer.setLabelProvider(new WorkbenchLabelProvider());
+ viewer.setContentProvider(new WorkbenchContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return locations;
+ }
+ });
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ if (selection.isEmpty()) {
+ location = null;
+ okButton.setEnabled(false);
+ } else {
+ location = (ICVSRepositoryLocation)selection.getFirstElement();
+ okButton.setEnabled(true);
+ }
+ }
+ });
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ okPressed();
+ }
+ });
+ viewer.setInput(locations);
+ return composite;
+ }
+ protected void cancelPressed() {
+ location = null;
+ super.cancelPressed();
+ }
+ public void setLocations(ICVSRepositoryLocation[] locations) {
+ this.locations = locations;
+ }
+ public ICVSRepositoryLocation getLocation() {
+ return location;
+ }
+ };
+
+ /*
+ * @see PreferencesPage#createContents
+ */
+ protected Control createContents(Composite parent) {
+ initialize();
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+
+ Label label = createLabel(composite, Policy.bind("CVSPropertiesPage.connectionType"), 1); //$NON-NLS-1$
+ methodLabel = createLabel(composite, "", 1); //$NON-NLS-1$
+
+ label = createLabel(composite, Policy.bind("CVSPropertiesPage.user"), 1); //$NON-NLS-1$
+ userLabel = createLabel(composite, "", 1); //$NON-NLS-1$
+
+ label = createLabel(composite, Policy.bind("CVSPropertiesPage.host"), 1); //$NON-NLS-1$
+ hostLabel = createLabel(composite, "", 1); //$NON-NLS-1$
+
+ label = createLabel(composite, Policy.bind("CVSPropertiesPage.port"), 1); //$NON-NLS-1$
+ portLabel = createLabel(composite, "", 1); //$NON-NLS-1$
+
+ label = createLabel(composite, Policy.bind("CVSPropertiesPage.path"), 1); //$NON-NLS-1$
+ pathLabel = createLabel(composite, "", 1); //$NON-NLS-1$
+
+ label = createLabel(composite, Policy.bind("CVSPropertiesPage.module"), 1); //$NON-NLS-1$
+ moduleLabel = createLabel(composite, "", 1); //$NON-NLS-1$
+
+ label = createLabel(composite, Policy.bind("CVSPropertiesPage.tag"), 1); //$NON-NLS-1$
+ tagLabel = createLabel(composite, "", 1); //$NON-NLS-1$
+
+ createLabel(composite, "", 1); //$NON-NLS-1$
+ createLabel(composite, "", 1); //$NON-NLS-1$
+ createLabel(composite, "", 1); //$NON-NLS-1$
+ createLabel(composite, "", 1); //$NON-NLS-1$
+ Button changeButton = new Button(composite, SWT.PUSH);
+ changeButton.setText(Policy.bind("CVSProjectPropertiesPage.Change_Sharing_5")); //$NON-NLS-1$
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ data.widthHint = Math.max(widthHint, changeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ changeButton.setLayoutData(data);
+ changeButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event e) {
+ // Find out which repo locations are appropriate
+ ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRoots();
+ List compatibleLocations = new ArrayList();
+ for (int i = 0; i < locations.length; i++) {
+ ICVSRepositoryLocation location = locations[i];
+ // Only locations with the same host and root are eligible
+ if (!location.getHost().equals(hostLabel.getText())) continue;
+ if (!location.getRootDirectory().equals(pathLabel.getText())) continue;
+ if (location.equals(oldLocation)) continue;
+ compatibleLocations.add(location);
+ }
+ RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell());
+ dialog.setLocations((ICVSRepositoryLocation[])compatibleLocations.toArray(new ICVSRepositoryLocation[compatibleLocations.size()]));
+ dialog.open();
+ ICVSRepositoryLocation location = dialog.getLocation();
+ if (location == null) return;
+ newLocation = location;
+ initializeValues(newLocation);
+ }
+ });
+
+ initializeValues(oldLocation);
+ return composite;
+ }
+ /**
+ * Utility method that creates a label instance
+ * and sets the default layout data.
+ *
+ * @param parent the parent for the new label
+ * @param text the text for the new label
+ * @return the new label
+ */
+ 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;
+ }
+ /**
+ * Initializes the page
+ */
+ private void initialize() {
+ // Get the project that is the source of this property page
+ project = null;
+ IAdaptable element = getElement();
+ if (element instanceof IProject) {
+ project = (IProject)element;
+ } else {
+ Object adapter = element.getAdapter(IProject.class);
+ if (adapter instanceof IProject) {
+ project = (IProject)adapter;
+ }
+ }
+ // Do some pre-checks to ensure we're in a good state
+ provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
+ if (provider == null) return;
+ CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
+ try {
+ oldLocation = cvsRoot.getRemoteLocation();
+ } catch (TeamException e) {
+ handle(e);
+ }
+ }
+ /**
+ * Set the initial values of the widgets
+ */
+ private void initializeValues(ICVSRepositoryLocation location) {
+ if (provider == null) return;
+ CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
+ ICVSFolder folder = cvsRoot.getLocalRoot();
+ if (!folder.isCVSFolder()) return;
+
+ try {
+ methodLabel.setText(location.getMethod().getName());
+ info = location.getUserInfo(true);
+ userLabel.setText(info.getUsername());
+ hostLabel.setText(location.getHost());
+ int port = location.getPort();
+ if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
+ portLabel.setText(Policy.bind("CVSPropertiesPage.defaultPort")); //$NON-NLS-1$
+ } else {
+ portLabel.setText("" + port); //$NON-NLS-1$
+ }
+ pathLabel.setText(location.getRootDirectory());
+ FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
+ if (syncInfo == null) return;
+ moduleLabel.setText(syncInfo.getRepository());
+ } catch (TeamException e) {
+ handle(e);
+ }
+
+ initializeTag();
+ }
+
+ private void initializeTag() {
+ provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
+ if (provider == null) return;
+ CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
+ try {
+ ICVSFolder local = cvsRoot.getCVSFolderFor(project);
+ CVSTag tag = local.getFolderSyncInfo().getTag();
+ String tagName;
+ if (tag == null) {
+ tagName = CVSTag.DEFAULT.getName();
+ } else {
+ tagName = tag.getName();
+ }
+ tagLabel.setText(tagName);
+ } catch (TeamException e) {
+ handle(e);
+ }
+ }
+ /*
+ * @see PreferencesPage#performOk
+ */
+ public boolean performOk() {
+ if (newLocation == null) {
+ return true;
+ }
+ try {
+ new ProgressMonitorDialog(getShell()).run(true, false, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ provider.setRemoteRoot(newLocation, monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ if (t instanceof TeamException) {
+ handle((TeamException)t);
+ } else if (t instanceof CoreException) {
+ handle(((CoreException)t).getStatus());
+ } else {
+ IStatus status = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, Policy.bind("internal"), t); //$NON-NLS-1$
+ handle(status);
+ CVSUIPlugin.log(status);
+ }
+ } catch (InterruptedException e) {
+ return false;
+ }
+
+ return true;
+ }
+ /**
+ * Shows the given errors to the user.
+ */
+ protected void handle(TeamException e) {
+ handle(e.getStatus());
+ }
+
+ protected void handle(IStatus status) {
+ if (!status.isOK()) {
+ IStatus toShow = status;
+ if (status.isMultiStatus()) {
+ IStatus[] children = status.getChildren();
+ if (children.length == 1) {
+ toShow = children[0];
+ }
+ }
+ ErrorDialog.openError(getShell(), status.getMessage(), null, toShow);
+ }
+ }
+}
+
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java
index 7d7ebdb5c..5493a75a8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
+ * Copyright (c) 2002 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -11,8 +11,12 @@
package org.eclipse.team.internal.ccvs.ui;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -20,13 +24,12 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
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;
@@ -37,19 +40,14 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.IUserInfo;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.wizards.UpdateWizard;
+import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.ui.dialogs.PropertyPage;
-public class CVSPropertiesPage extends PropertyPage {
- IProject project;
+public class CVSRepositoryPropertiesPage extends PropertyPage {
+ ICVSRepositoryLocation location;
// Widgets
Text userText;
@@ -57,15 +55,12 @@ public class CVSPropertiesPage extends PropertyPage {
Combo methodType;
Label hostLabel;
Label pathLabel;
- Label moduleLabel;
Label portLabel;
- Label tagLabel;
boolean passwordChanged;
boolean connectionInfoChanged;
IUserInfo info;
- CVSTeamProvider provider;
/*
* @see PreferencesPage#createContents
@@ -98,19 +93,10 @@ public class CVSPropertiesPage extends PropertyPage {
label = createLabel(composite, Policy.bind("CVSPropertiesPage.path"), 1); //$NON-NLS-1$
pathLabel = createLabel(composite, "", 2); //$NON-NLS-1$
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.module"), 1); //$NON-NLS-1$
- moduleLabel = createLabel(composite, "", 2); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.tag"), 1); //$NON-NLS-1$
- tagLabel = createLabel(composite, "", 1); //$NON-NLS-1$
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- tagLabel.setLayoutData(data);
-
initializeValues();
passwordText.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event event) {
passwordChanged = true;
- connectionInfoChanged = true;
}
});
userText.addListener(SWT.Modify, new Listener() {
@@ -176,15 +162,14 @@ public class CVSPropertiesPage extends PropertyPage {
* Initializes the page
*/
private void initialize() {
- // Get the project that is the source of this property page
- project = null;
+ location = null;
IAdaptable element = getElement();
- if (element instanceof IProject) {
- project = (IProject)element;
+ if (element instanceof ICVSRepositoryLocation) {
+ location = (ICVSRepositoryLocation)element;
} else {
- Object adapter = element.getAdapter(IProject.class);
- if (adapter instanceof IProject) {
- project = (IProject)adapter;
+ Object adapter = element.getAdapter(ICVSRepositoryLocation.class);
+ if (adapter instanceof ICVSRepositoryLocation) {
+ location = (ICVSRepositoryLocation)adapter;
}
}
}
@@ -194,66 +179,30 @@ public class CVSPropertiesPage extends PropertyPage {
private void initializeValues() {
passwordChanged = false;
- // Do some pre-checks to ensure we're in a good state
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) return;
- CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
- ICVSFolder folder = cvsRoot.getLocalRoot();
- if (!folder.isCVSFolder()) return;
-
String[] methods = CVSProviderPlugin.getProvider().getSupportedConnectionMethods();
for (int i = 0; i < methods.length; i++) {
methodType.add(methods[i]);
}
- try {
- ICVSRepositoryLocation location = cvsRoot.getRemoteLocation();
-
- String method = location.getMethod().getName();
- methodType.select(methodType.indexOf(method));
- info = location.getUserInfo(true);
- userText.setText(info.getUsername());
- passwordText.setText("*********"); //$NON-NLS-1$
- hostLabel.setText(location.getHost());
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- portLabel.setText(Policy.bind("CVSPropertiesPage.defaultPort")); //$NON-NLS-1$
- } else {
- portLabel.setText("" + port); //$NON-NLS-1$
- }
- pathLabel.setText(location.getRootDirectory());
- FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
- if (syncInfo == null) return;
- moduleLabel.setText(syncInfo.getRepository());
- } catch (TeamException e) {
- handle(e);
+ String method = location.getMethod().getName();
+ methodType.select(methodType.indexOf(method));
+ info = location.getUserInfo(true);
+ userText.setText(info.getUsername());
+ passwordText.setText("*********"); //$NON-NLS-1$
+ hostLabel.setText(location.getHost());
+ int port = location.getPort();
+ if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
+ portLabel.setText(Policy.bind("CVSPropertiesPage.defaultPort")); //$NON-NLS-1$
+ } else {
+ portLabel.setText("" + port); //$NON-NLS-1$
}
-
- initializeTag();
+ pathLabel.setText(location.getRootDirectory());
}
- private void initializeTag() {
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) return;
- CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
- try {
- ICVSFolder local = cvsRoot.getCVSFolderFor(project);
- CVSTag tag = local.getFolderSyncInfo().getTag();
- String tagName;
- if (tag == null) {
- tagName = CVSTag.DEFAULT.getName();
- } else {
- tagName = tag.getName();
- }
- tagLabel.setText(tagName);
- } catch (TeamException e) {
- handle(e);
- }
- }
/*
* @see PreferencesPage#performOk
*/
public boolean performOk() {
- if ( ! connectionInfoChanged) {
+ if (!connectionInfoChanged && !passwordChanged) {
return true;
}
info.setUsername(userText.getText());
@@ -261,14 +210,65 @@ public class CVSPropertiesPage extends PropertyPage {
info.setPassword(passwordText.getText());
}
final String type = methodType.getText();
+ final boolean[] result = new boolean[] { false };
try {
new ProgressMonitorDialog(getShell()).run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
- provider.setConnectionInfo(project, type, info, monitor);
+ // Check if the password was the only thing to change.
+ if (passwordChanged && !connectionInfoChanged) {
+ CVSRepositoryLocation oldLocation = (CVSRepositoryLocation)location;
+ oldLocation.setPassword(passwordText.getText());
+ oldLocation.updateCache();
+ result[0] = true;
+ return;
+ }
+
+ // Create a new repository location with the new information
+ CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromString(location.getLocation());
+ newLocation.setMethod(type);
+ newLocation.setUserInfo(info);
+
+ // For each project shared with the old location, set connection info to the new one
+ List projects = new ArrayList();
+ IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (int i = 0; i < allProjects.length; i++) {
+ RepositoryProvider teamProvider = RepositoryProvider.getProvider(allProjects[i], CVSProviderPlugin.getTypeId());
+ if (teamProvider != null) {
+ CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
+ if (cvsProvider.getCVSWorkspaceRoot().getRemoteLocation().equals(location)) {
+ projects.add(allProjects[i]);
+ break;
+ }
+ }
+ }
+ if (projects.size() > 0) {
+ // To do: warn the user
+ boolean r = MessageDialog.openConfirm(getShell(), Policy.bind("CVSRepositoryPropertiesPage.Confirm_Project_Sharing_Changes_1"), Policy.bind("CVSRepositoryPropertiesPage.There_are_projects_in_the_workspace_shared_with_this_repository._The_projects_will_be_updated_with_the_new_information_that_you_have_entered_2")); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!r) {
+ result[0] = false;
+ return;
+ }
+ monitor.beginTask(null, 1000 * projects.size());
+ try {
+ Iterator it = projects.iterator();
+ while (it.hasNext()) {
+ IProject project = (IProject)it.next();
+ RepositoryProvider teamProvider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
+ CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
+ cvsProvider.setRemoteRoot(newLocation, Policy.subMonitorFor(monitor, 1000));
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+
+ // Dispose the old repository location
+ CVSProviderPlugin.getProvider().disposeRepository(location);
} catch (TeamException e) {
throw new InvocationTargetException(e);
}
+ result[0] = true;
}
});
} catch (InvocationTargetException e) {
@@ -285,7 +285,7 @@ public class CVSPropertiesPage extends PropertyPage {
} catch (InterruptedException e) {
}
- return true;
+ return result[0];
}
/**
* Shows the given errors to the user.
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 ec458c48a..4de75483a 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
@@ -24,6 +24,7 @@ import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
@@ -35,6 +36,7 @@ import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.part.DrillDownAdapter;
import org.eclipse.ui.part.ViewPart;
@@ -61,6 +63,7 @@ public class RepositoriesView extends ViewPart {
private Action showModulesAction;
private OpenRemoteFileAction openAction;
private Action refreshAction;
+ private PropertyDialogAction propertiesAction;
IRepositoryListener listener = new IRepositoryListener() {
public void repositoryAdded(final ICVSRepositoryLocation root) {
@@ -100,6 +103,7 @@ public class RepositoriesView extends ViewPart {
* Contribute actions to the view
*/
private void contributeActions() {
+ final Shell shell = viewer.getTree().getShell();
// Create actions
// Refresh (toolbar)
@@ -114,11 +118,14 @@ public class RepositoriesView extends ViewPart {
final Action newAction = new Action(Policy.bind("RepositoriesView.new"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION)) { //$NON-NLS-1$
public void run() {
NewLocationWizard wizard = new NewLocationWizard();
- WizardDialog dialog = new WizardDialog(viewer.getTree().getShell(), wizard);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
}
};
+ // Properties (popup)
+ propertiesAction = new PropertyDialogAction(shell, viewer);
+
// Create the popup menu
MenuManager menuMgr = new MenuManager();
Tree tree = viewer.getTree();
@@ -133,10 +140,15 @@ public class RepositoriesView extends ViewPart {
sub.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(sub);
- // Misc additions go last
+ // Misc additions
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(refreshAction);
+
+ IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+ if (selection.size() == 1 && selection.getFirstElement() instanceof ICVSRepositoryLocation) {
+ manager.add(propertiesAction);
+ }
sub.add(newAction);
}
});
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 56056e7e0..49877be30 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
@@ -392,7 +392,7 @@ RepositoriesView.refresh=&Refresh View
RepositoriesView.new=&CVS Repository Location...
RepositoriesView.newSubmenu=&New
RepositoriesView.Show_Folders_6=Show Folders
-RepositoriewView.Show_Modules_7=Show Modules
+RepositoriesView.Show_Modules_7=Show Modules
ResourcePropertiesPage.status=Status
ResourcePropertiesPage.notManaged=Not managed by CVS
@@ -666,3 +666,8 @@ BranchCategory.Branches_1=Branches
GroupedByVersionCategory.Versions_1=Versions
VersionCategory.Versions_1=Versions
HistoryView.[...]_4=[...]
+CVSProjectPropertiesPage.Select_a_Repository_1=Select a Repository
+CVSProjectPropertiesPage.Select_a_CVS_repository_location_to_share_the_project_with__2=Select a CVS repository location to share the project with:
+CVSProjectPropertiesPage.Change_Sharing_5=Change Sharing
+CVSRepositoryPropertiesPage.Confirm_Project_Sharing_Changes_1=Confirm Project Sharing Changes
+CVSRepositoryPropertiesPage.There_are_projects_in_the_workspace_shared_with_this_repository._The_projects_will_be_updated_with_the_new_information_that_you_have_entered_2=There are projects in the workspace shared with this repository. The projects will be updated with the new information that you have entered
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 6321da055..605ee9f45 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
@@ -17,6 +17,7 @@ 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.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
@@ -163,11 +164,15 @@ public class ConfigurationWizardMainPage extends CVSWizardPage {
repositoryPathCombo.addListener(SWT.Selection, listener);
repositoryPathCombo.addListener(SWT.Modify, listener);
+ // create a composite to ensure the validate button is in its own tab group
if (showValidate) {
- validateButton = new Button(composite, SWT.CHECK);
+ Composite validateButtonTabGroup = new Composite(composite, SWT.NONE);
GridData data = new GridData();
data.horizontalSpan = 2;
- validateButton.setLayoutData(data);
+ validateButtonTabGroup.setLayoutData(data);
+ validateButtonTabGroup.setLayout(new FillLayout());
+
+ validateButton = new Button(validateButtonTabGroup, SWT.CHECK);
validateButton.setText(Policy.bind("ConfigurationWizardAutoconnectPage.validate")); //$NON-NLS-1$
validateButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {

Back to the top