mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-17 05:05:43 +02:00
Bug 300917 - need a new version of XL C/C++ Compiler properties page for John Liu
This commit is contained in:
parent
6764511b39
commit
6621f5653e
1 changed files with 85 additions and 70 deletions
|
@ -29,35 +29,44 @@ import org.eclipse.ui.IWorkbenchPropertyPage;
|
||||||
|
|
||||||
public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
|
public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
|
||||||
|
|
||||||
private String originalMessage;
|
protected String originalMessage;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||||
*/
|
*/
|
||||||
protected void createFieldEditors() {
|
protected void createFieldEditors() {
|
||||||
|
createPathEditor();
|
||||||
|
createVersionEditor();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
|
||||||
|
* ()
|
||||||
|
*/
|
||||||
|
protected void createPathEditor() {
|
||||||
|
|
||||||
Composite parent = getFieldEditorParent();
|
Composite parent = getFieldEditorParent();
|
||||||
|
|
||||||
fPathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT, Messages.XLCompilerPropertyPage_0, parent)
|
fPathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT,
|
||||||
{
|
Messages.XLCompilerPropertyPage_0, parent) {
|
||||||
protected boolean doCheckState()
|
protected boolean doCheckState() {
|
||||||
{
|
// always return true, as we don't want to fail cases when
|
||||||
// always return true, as we don't want to fail cases when compiler is installed remotely
|
// compiler is installed remotely
|
||||||
// just warn user
|
// just warn user
|
||||||
if (!super.doCheckState())
|
if (!super.doCheckState()) {
|
||||||
{
|
|
||||||
setMessage(Messages.XLCompilerPropertyPage_2, IMessageProvider.WARNING);
|
setMessage(Messages.XLCompilerPropertyPage_2, IMessageProvider.WARNING);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
setMessage(originalMessage);
|
setMessage(originalMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkState()
|
protected boolean checkState() {
|
||||||
{
|
|
||||||
return doCheckState();
|
return doCheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,9 +94,13 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
|
|
||||||
fPathEditor.setStringValue(currentPath);
|
fPathEditor.setStringValue(currentPath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createVersionEditor() {
|
||||||
|
|
||||||
|
IProject project = ((IResource) (getElement().getAdapter(IResource.class))).getProject();
|
||||||
String[] versionEntries = { PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME,
|
String[] versionEntries = { PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME,
|
||||||
PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME,
|
PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME };
|
||||||
PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME};
|
|
||||||
|
|
||||||
Composite versionParent = getFieldEditorParent();
|
Composite versionParent = getFieldEditorParent();
|
||||||
|
|
||||||
|
@ -116,13 +129,12 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private DirectoryFieldEditor fPathEditor;
|
protected DirectoryFieldEditor fPathEditor;
|
||||||
|
|
||||||
private BuildOptionComboFieldEditor fVersionEditor;
|
protected BuildOptionComboFieldEditor fVersionEditor;
|
||||||
|
|
||||||
// private Composite parent;
|
// private Composite parent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SamplePropertyPage.
|
* Constructor for SamplePropertyPage.
|
||||||
*/
|
*/
|
||||||
|
@ -132,21 +144,23 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
originalMessage = getMessage();
|
originalMessage = getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
// default to whatever is set on the workbench preference
|
// default to whatever is set on the workbench preference
|
||||||
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);
|
String currentVersionLabel = PreferenceConstants.getVersionLabel(currentVersion);
|
||||||
|
if (fPathEditor != null) {
|
||||||
fPathEditor.setStringValue(currentPath);
|
fPathEditor.setStringValue(currentPath);
|
||||||
|
}
|
||||||
|
|
||||||
fVersionEditor.getComboControl(getFieldEditorParent()).setText(currentVersionLabel);
|
fVersionEditor.getComboControl(getFieldEditorParent()).setText(currentVersionLabel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
|
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
|
||||||
*/
|
*/
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
|
@ -154,10 +168,10 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
try {
|
try {
|
||||||
IProject project = ((IResource) (getElement().getAdapter(IResource.class))).getProject();
|
IProject project = ((IResource) (getElement().getAdapter(IResource.class))).getProject();
|
||||||
|
|
||||||
|
if (fPathEditor != null) {
|
||||||
project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
||||||
PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor
|
PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor.getStringValue());
|
||||||
.getStringValue());
|
}
|
||||||
|
|
||||||
String version = null;
|
String version = null;
|
||||||
if (fVersionEditor.getSelection() != null) {
|
if (fVersionEditor.getSelection() != null) {
|
||||||
version = PreferenceConstants.getVersion(fVersionEditor.getSelection());
|
version = PreferenceConstants.getVersion(fVersionEditor.getSelection());
|
||||||
|
@ -178,6 +192,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
||||||
*/
|
*/
|
||||||
public IAdaptable getElement() {
|
public IAdaptable getElement() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue