mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
bug 288005 - separate XLC compiler version number with its label for translation
This commit is contained in:
parent
47f2fb94b4
commit
2ca67d781f
8 changed files with 44 additions and 23 deletions
|
@ -8,11 +8,10 @@
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# IBM Corporation - initial API and implementation
|
# IBM Corporation - initial API and implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# START NON-TRANSLATABLE
|
|
||||||
XLCompiler_v8=v8.0
|
XLCompiler_v8=8.0
|
||||||
XLCompiler_v9=v9.0
|
XLCompiler_v9=9.0
|
||||||
XLCompiler_v10=v10.1
|
XLCompiler_v10=v10.1
|
||||||
# END NON-TRANSLATABLE
|
|
||||||
XLCompilerPreferencePage_0=XL C/C++ Compiler Preferences
|
XLCompilerPreferencePage_0=XL C/C++ Compiler Preferences
|
||||||
XLCompilerPreferencePage_1=Compiler Root Path:
|
XLCompilerPreferencePage_1=Compiler Root Path:
|
||||||
XLCompilerPreferencePage_2=Compiler Version:
|
XLCompilerPreferencePage_2=Compiler Version:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 IBM Corporation and others.
|
* Copyright (c) 2007, 2009 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* 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_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_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_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_9_NAME = Messages.XLCompiler_v9;
|
||||||
public static final String P_XL_COMPILER_VERSION_10_NAME = Messages.XLCompiler_v10;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 IBM Corporation and others.
|
* Copyright (c) 2007, 2009 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -29,7 +29,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
||||||
public void initializeDefaultPreferences() {
|
public void initializeDefaultPreferences() {
|
||||||
IPreferenceStore store = XLCUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore store = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
store.setDefault(PreferenceConstants.P_XL_COMPILER_ROOT, "/opt/ibmcmp"); //$NON-NLS-1$
|
store.setDefault(PreferenceConstants.P_XL_COMPILER_ROOT, "/opt/ibmcmp"); //$NON-NLS-1$
|
||||||
store.setDefault(PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME);
|
store.setDefault(PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.P_XL_COMPILER_VERSION_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 IBM Corporation and others.
|
* Copyright (c) 2007, 2009 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -79,9 +79,9 @@ public class XLCompilerPreferencePage
|
||||||
|
|
||||||
addField(pathEditor);
|
addField(pathEditor);
|
||||||
|
|
||||||
String[][] versionEntries = {{PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME, Messages.XLCompiler_v8},
|
String[][] versionEntries = {{PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_8},
|
||||||
{PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, Messages.XLCompiler_v9},
|
{PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_9},
|
||||||
{PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME, Messages.XLCompiler_v10}};
|
{PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_10}};
|
||||||
|
|
||||||
addField(new ComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION,
|
addField(new ComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION,
|
||||||
Messages.XLCompilerPreferencePage_2, versionEntries, getFieldEditorParent()));
|
Messages.XLCompilerPreferencePage_2, versionEntries, getFieldEditorParent()));
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.jface.dialogs.IMessageProvider;
|
||||||
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
||||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.ui.IWorkbenchPropertyPage;
|
import org.eclipse.ui.IWorkbenchPropertyPage;
|
||||||
|
@ -113,7 +112,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
}
|
}
|
||||||
|
|
||||||
Combo versionCombo = fVersionEditor.getComboControl(versionParent);
|
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();
|
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
|
||||||
String currentPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
String currentPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
|
||||||
String currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
String currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
|
String currentVersionLabel = PreferenceConstants.getVersionLabel(currentVersion);
|
||||||
|
|
||||||
fPathEditor.setStringValue(currentPath);
|
fPathEditor.setStringValue(currentPath);
|
||||||
|
|
||||||
fVersionEditor.getComboControl(getFieldEditorParent()).setText(currentVersion);
|
fVersionEditor.getComboControl(getFieldEditorParent()).setText(currentVersionLabel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,9 +158,9 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor
|
PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor
|
||||||
.getStringValue());
|
.getStringValue());
|
||||||
|
|
||||||
|
String version = PreferenceConstants.getVersion(fVersionEditor.getSelection());
|
||||||
project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
||||||
PreferenceConstants.P_XLC_COMPILER_VERSION), fVersionEditor
|
PreferenceConstants.P_XLC_COMPILER_VERSION), version);
|
||||||
.getSelection());
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability {
|
||||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME))
|
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class XLCv8ApplicabiltyCalculator implements IOptionApplicability {
|
||||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME))
|
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_8))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability {
|
||||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME))
|
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class XLCv9ApplicabilityCalculator implements IOptionApplicability {
|
||||||
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME))
|
if(currentVersion.equals(PreferenceConstants.P_XL_COMPILER_VERSION_9))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,16 +176,16 @@ public class XLCSettingsWizardPage extends MBSCustomPage {
|
||||||
|
|
||||||
// set the default based on the workbench preference
|
// set the default based on the workbench preference
|
||||||
String compilerVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
String compilerVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
|
||||||
fVersionCombo.setText(compilerVersion);
|
fVersionCombo.setText(PreferenceConstants.getVersionLabel(compilerVersion));
|
||||||
|
|
||||||
// update the page manager with the setting
|
// update the page manager with the setting
|
||||||
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, fVersionCombo.getText());
|
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText()));
|
||||||
|
|
||||||
fVersionCombo.addModifyListener(new ModifyListener() {
|
fVersionCombo.addModifyListener(new ModifyListener() {
|
||||||
|
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
// update the page manager with the setting
|
// update the page manager with the setting
|
||||||
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, fVersionCombo.getText());
|
MBSCustomPageManager.addPageProperty(pageID, PreferenceConstants.P_XLC_COMPILER_VERSION, PreferenceConstants.getVersion(fVersionCombo.getText()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue