diff options
author | Michael Valenta | 2004-03-29 17:15:50 +0000 |
---|---|---|
committer | Michael Valenta | 2004-03-29 17:15:50 +0000 |
commit | bd71f6cba7c0a2e96dadaa46e667404436d4b7ae (patch) | |
tree | a6f2d16781ecacbcdb208d034958a03149d58291 | |
parent | 23af2dcb4fa41b9eef992f68b88eb3c6e1d7b604 (diff) | |
download | eclipse.platform.team-branch_20040329_CVSEncodingTranslation.tar.gz eclipse.platform.team-branch_20040329_CVSEncodingTranslation.tar.xz eclipse.platform.team-branch_20040329_CVSEncodingTranslation.zip |
32539: [CVS Core] Charset for CVS log is invalidbranch_20040329_CVSEncodingTranslation
3 files changed, 54 insertions, 2 deletions
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 d0f05d362..d5e31fe04 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 @@ CVSLocalCompareEditorInput.title=CVS Compare [{0}] 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.password=&Password: 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 951dee4dc..1e4f345cf 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 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { ICVSRepositoryLocation location; // Widgets + Text encodingText; Text userText; Text passwordText; Combo methodType; @@ -103,7 +105,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { 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 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { 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 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { 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 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { 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 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { private void performNonConnectionInfoChanges() { recordNewLabel((CVSRepositoryLocation)location); recordReadWriteLocations((CVSRepositoryLocation)location); + location.setEncoding(encodingText.getText()); } /* * @see PreferencesPage#performOk @@ -506,6 +520,19 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { 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 @@ public class CVSRepositoryPropertiesPage extends PropertyPage { 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 81a6ba287..c38a395ea 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 @@ public class ConfigurationWizardMainPage extends CVSWizardPage { private Text passwordText; // Port private Text portText; + // Encoding + private Text encodingText; private Button useDefaultPort; private Button useCustomPort; // Host @@ -193,6 +196,12 @@ public class ConfigurationWizardMainPage extends CVSWizardPage { 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 @@ public class ConfigurationWizardMainPage extends CVSWizardPage { 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 @@ public class ConfigurationWizardMainPage extends CVSWizardPage { 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); } |