Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivian Kong2010-01-19 18:03:36 +0000
committerVivian Kong2010-01-19 18:03:36 +0000
commit47db128e5241fb5e92d04b29cbb5aaf7a84afaf6 (patch)
tree606a353f73b34be248733f3648fdc8cb8afde848
parent46fb9bb077e39d534f5cfef93460b933392e39b2 (diff)
downloadorg.eclipse.cdt-47db128e5241fb5e92d04b29cbb5aaf7a84afaf6.tar.gz
org.eclipse.cdt-47db128e5241fb5e92d04b29cbb5aaf7a84afaf6.tar.xz
org.eclipse.cdt-47db128e5241fb5e92d04b29cbb5aaf7a84afaf6.zip
Bug 300085 - [Backport] Separate the persisted version information from the version labels for translation in XLC UI
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java24
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java8
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java20
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java23
4 files changed, 51 insertions, 24 deletions
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java
index a73dd79cb46..30581e15d23 100644
--- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/PreferenceConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,9 +21,31 @@ public class PreferenceConstants {
public static final String P_XL_COMPILER_ROOT = "XL_compilerRoot"; //$NON-NLS-1$
public static final String P_XLC_COMPILER_VERSION = "XLC_compilerVersion"; //$NON-NLS-1$
+
+ public static final String P_XL_COMPILER_VERSION_8 = "v8.0"; //$NON-NLS-1$
+ public static final String P_XL_COMPILER_VERSION_9 = "v9.0"; //$NON-NLS-1$
+ public static final String P_XL_COMPILER_VERSION_10 = "v10.1"; //$NON-NLS-1$
public static final String P_XL_COMPILER_VERSION_8_NAME = Messages.XLCompiler_v8;
public static final String P_XL_COMPILER_VERSION_9_NAME = Messages.XLCompiler_v9;
public static final String P_XL_COMPILER_VERSION_10_NAME = Messages.XLCompiler_v10;
+
+ public static String getVersion (String label) {
+ if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_10_NAME))
+ return P_XL_COMPILER_VERSION_10;
+ else if (label.equalsIgnoreCase(P_XL_COMPILER_VERSION_9_NAME))
+ return P_XL_COMPILER_VERSION_9;
+ else
+ return P_XL_COMPILER_VERSION_8;
+ }
+
+ public static String getVersionLabel (String version) {
+ if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_10))
+ return P_XL_COMPILER_VERSION_10_NAME;
+ else if (version.equalsIgnoreCase(P_XL_COMPILER_VERSION_9))
+ return P_XL_COMPILER_VERSION_9_NAME;
+ else
+ return P_XL_COMPILER_VERSION_8_NAME;
+ }
}
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java
index 240b8a833f7..02eb82dcf1a 100644
--- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/preferences/XLCompilerPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -79,9 +79,9 @@ public class XLCompilerPreferencePage
addField(pathEditor);
- String[][] versionEntries = {{PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME, Messages.XLCompiler_v8},
- {PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, Messages.XLCompiler_v9},
- {PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME, Messages.XLCompiler_v10}};
+ String[][] versionEntries = {{PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_8},
+ {PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_9},
+ {PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_10}};
addField(new ComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION,
Messages.XLCompilerPreferencePage_2, versionEntries, getFieldEditorParent()));
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java
index 86d6b8e2b67..717af4cc2a4 100644
--- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,6 @@ import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPropertyPage;
@@ -113,7 +112,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
}
Combo versionCombo = fVersionEditor.getComboControl(versionParent);
- versionCombo.setText(currentVersion);
+ versionCombo.setText(PreferenceConstants.getVersionLabel(currentVersion));
}
@@ -139,10 +138,11 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
String currentPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
String currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
+ String currentVersionLabel = PreferenceConstants.getVersionLabel(currentVersion);
fPathEditor.setStringValue(currentPath);
- fVersionEditor.getComboControl(getFieldEditorParent()).setText(currentVersion);
+ fVersionEditor.getComboControl(getFieldEditorParent()).setText(currentVersionLabel);
}
@@ -157,10 +157,14 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor
.getStringValue());
-
- project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
- PreferenceConstants.P_XLC_COMPILER_VERSION), fVersionEditor
- .getSelection());
+
+ String version = null;
+ if (fVersionEditor.getSelection() != null) {
+ version = PreferenceConstants.getVersion(fVersionEditor.getSelection());
+
+ project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
+ PreferenceConstants.P_XLC_COMPILER_VERSION), version);
+ }
} catch (CoreException e) {
return false;
}
diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java
index 3177ee34713..26d361c7384 100644
--- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java
+++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/wizards/XLCSettingsWizardPage.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.xlc.ui.wizards;
@@ -144,7 +144,7 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
});
// create the browse button
- String selectedPath = null;
+// String selectedPath = null;
GridData buttonData = new GridData();
buttonData.horizontalAlignment = SWT.RIGHT;
Button browseButton = new Button(fComposite, SWT.PUSH);
@@ -172,19 +172,20 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
// populate the combo
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME);
fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME);
+ fVersionCombo.add(PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME);
// set the default based on the workbench preference
String compilerVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
- fVersionCombo.setText(compilerVersion);
+ fVersionCombo.setText(PreferenceConstants.getVersionLabel(compilerVersion));
// update the page manager with the setting
- MBSCustomPageManager.addPageProperty(PAGE_ID, PreferenceConstants.P_XLC_COMPILER_VERSION, fVersionCombo.getText());
+ MBSCustomPageManager.addPageProperty(PAGE_ID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText()));
fVersionCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// update the page manager with the setting
- MBSCustomPageManager.addPageProperty(PAGE_ID, PreferenceConstants.P_XLC_COMPILER_VERSION, fVersionCombo.getText());
+ MBSCustomPageManager.addPageProperty(PAGE_ID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText()));
}

Back to the top