32539: [CVS Core] Charset for CVS log is invalid
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 d0f05d3..d5e31fe 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
@@ -173,6 +173,7 @@ CVSOperationCancelledException.operationCancelled=Operation Cancelled CVSPropertiesPage.connectionType=&Connection type: +CVSPropertiesPage.encoding=Encoding: CVSPropertiesPage.user=&User: CVSPropertiesPage.password=&Password: CVSPropertiesPage.host=Host: @@ -309,10 +310,12 @@ ConfigurationWizardMainPage.host=&Host: ConfigurationWizardMainPage.useDefaultPort=Use &Default Port ConfigurationWizardMainPage.usePort=Use Por&t: +ConfigurationWizardMainPage.encoding=Encoding: ConfigurationWizardMainPage.repositoryPath=&Repository path: ConfigurationWizardMainPage.invalidUserName=Invalid User Name ConfigurationWizardMainPage.invalidHostName=Invalid Host Name ConfigurationWizardMainPage.invalidPort=Invalid Port +ConfigurationWizardMainPage.invalidEncoding=Invalid Encoding ConfigurationWizardMainPage.invalidPathWithSpaces=The repository path cannot have segments with leading or trailing spaces ConfigurationWizardMainPage.invalidPathWithSlashes=The repository path cannot contain a double slash (//) ConfigurationWizardMainPage.useNTFormat=Use NT path names for specifying CVSNT repository paths (e.g. C:\\cvs\\root)
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 951dee4..1e4f345 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
@@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui.repo; +import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.util.*; import java.util.List; @@ -42,6 +43,7 @@ ICVSRepositoryLocation location; // Widgets + Text encodingText; Text userText; Text passwordText; Combo methodType; @@ -103,7 +105,7 @@ createLabel(composite, Policy.bind("CVSPropertiesPage.connectionType"), 1); //$NON-NLS-1$ methodType = createCombo(composite); - + createLabel(composite, Policy.bind("CVSPropertiesPage.user"), 1); //$NON-NLS-1$ userText = createTextField(composite); @@ -118,6 +120,9 @@ createLabel(composite, Policy.bind("CVSPropertiesPage.path"), 1); //$NON-NLS-1$ pathLabel = createLabel(composite, "", 2); //$NON-NLS-1$ + + createLabel(composite, Policy.bind("CVSPropertiesPage.encoding"), 1); //$NON-NLS-1$ + encodingText = createTextField(composite); // Add some extra space createLabel(composite, "", 3); //$NON-NLS-1$ @@ -129,6 +134,13 @@ initializeValues(); updateWidgetEnablements(); + + encodingText.addListener(SWT.Modify, new Listener() { + public void handleEvent(Event event) { + connectionInfoChanged = true; + updateWidgetEnablements(); + } + }); passwordText.addListener(SWT.Modify, new Listener() { public void handleEvent(Event event) { passwordChanged = true; @@ -301,6 +313,7 @@ String method = location.getMethod().getName(); methodType.select(methodType.indexOf(method)); info = location.getUserInfo(true); + encodingText.setText(location.getEncoding()); userText.setText(info.getUsername()); passwordText.setText("*********"); //$NON-NLS-1$ hostLabel.setText(location.getHost()); @@ -456,6 +469,7 @@ private void performNonConnectionInfoChanges() { recordNewLabel((CVSRepositoryLocation)location); recordReadWriteLocations((CVSRepositoryLocation)location); + location.setEncoding(encodingText.getText()); } /* * @see PreferencesPage#performOk @@ -506,6 +520,19 @@ setValid(false); return; } + + try { + String enc = encodingText.getText(); + if(enc!=null){ + "".getBytes(enc); //$NON-NLS-1$ + } + } catch (UnsupportedEncodingException ex) { + setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidEncoding")); //$NON-NLS-1$ + setValid(false); + return; + } + + setErrorMessage(null); setValid(true); } @@ -545,7 +572,6 @@ 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 } }
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 81a6ba2..c38a395 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,6 +11,7 @@ package org.eclipse.team.internal.ccvs.ui.wizards; +import java.io.UnsupportedEncodingException; import java.util.*; import java.util.List; @@ -45,6 +46,8 @@ private Text passwordText; // Port private Text portText; + // Encoding + private Text encodingText; private Button useDefaultPort; private Button useCustomPort; // Host @@ -193,6 +196,12 @@ portText = createTextField(portGroup); portText.addListener(SWT.Modify, listener); + // encoding + createLabel(composite, Policy.bind("ConfigurationWizardMainPage.encoding")); //$NON-NLS-1$ + encodingText = createTextField(composite); + encodingText.addListener(SWT.Modify, listener); + encodingText.setText(System.getProperty("file.encoding", "UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$ + // create a composite to ensure the validate button is in its own tab group if (showValidate) { Composite validateButtonTabGroup = new Composite(composite, SWT.NONE); @@ -254,6 +263,7 @@ result.setProperty("user", userCombo.getText()); //$NON-NLS-1$ result.setProperty("password", passwordText.getText()); //$NON-NLS-1$ result.setProperty("host", hostCombo.getText()); //$NON-NLS-1$ + result.setProperty("encoding", encodingText.getText()); //$NON-NLS-1$ if (useCustomPort.getSelection()) { result.setProperty("port", portText.getText()); //$NON-NLS-1$ } @@ -478,6 +488,19 @@ return; } } + + try { + String enc = encodingText.getText(); + if(enc!=null){ + "".getBytes(enc); //$NON-NLS-1$ + } + } catch (UnsupportedEncodingException ex) { + setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidEncoding")); //$NON-NLS-1$ + setPageComplete(false); + return; + } + + setErrorMessage(null); setPageComplete(true); }