mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 12:45:41 +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 {
|
||||
|
||||
private String originalMessage;
|
||||
protected String originalMessage;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||
*/
|
||||
protected void createFieldEditors() {
|
||||
createPathEditor();
|
||||
createVersionEditor();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
|
||||
* ()
|
||||
*/
|
||||
protected void createPathEditor() {
|
||||
|
||||
Composite parent = getFieldEditorParent();
|
||||
|
||||
fPathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT, Messages.XLCompilerPropertyPage_0, parent)
|
||||
{
|
||||
protected boolean doCheckState()
|
||||
{
|
||||
// always return true, as we don't want to fail cases when compiler is installed remotely
|
||||
fPathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT,
|
||||
Messages.XLCompilerPropertyPage_0, parent) {
|
||||
protected boolean doCheckState() {
|
||||
// always return true, as we don't want to fail cases when
|
||||
// compiler is installed remotely
|
||||
// just warn user
|
||||
if (!super.doCheckState())
|
||||
{
|
||||
if (!super.doCheckState()) {
|
||||
setMessage(Messages.XLCompilerPropertyPage_2, IMessageProvider.WARNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setMessage(originalMessage);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean checkState()
|
||||
{
|
||||
protected boolean checkState() {
|
||||
return doCheckState();
|
||||
}
|
||||
|
||||
|
@ -85,9 +94,13 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
|||
|
||||
fPathEditor.setStringValue(currentPath);
|
||||
|
||||
}
|
||||
|
||||
protected void createVersionEditor() {
|
||||
|
||||
IProject project = ((IResource) (getElement().getAdapter(IResource.class))).getProject();
|
||||
String[] versionEntries = { PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME,
|
||||
PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME,
|
||||
PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME};
|
||||
PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME };
|
||||
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for SamplePropertyPage.
|
||||
*/
|
||||
|
@ -132,21 +144,23 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
|||
originalMessage = getMessage();
|
||||
}
|
||||
|
||||
|
||||
protected void performDefaults() {
|
||||
// default to whatever is set on the workbench preference
|
||||
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);
|
||||
|
||||
if (fPathEditor != null) {
|
||||
fPathEditor.setStringValue(currentPath);
|
||||
}
|
||||
|
||||
fVersionEditor.getComboControl(getFieldEditorParent()).setText(currentVersionLabel);
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
|
||||
*/
|
||||
public boolean performOk() {
|
||||
|
@ -154,10 +168,10 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
|||
try {
|
||||
IProject project = ((IResource) (getElement().getAdapter(IResource.class))).getProject();
|
||||
|
||||
if (fPathEditor != null) {
|
||||
project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
|
||||
PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor
|
||||
.getStringValue());
|
||||
|
||||
PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor.getStringValue());
|
||||
}
|
||||
String version = null;
|
||||
if (fVersionEditor.getSelection() != null) {
|
||||
version = PreferenceConstants.getVersion(fVersionEditor.getSelection());
|
||||
|
@ -178,6 +192,7 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
||||
*/
|
||||
public IAdaptable getElement() {
|
||||
|
|
Loading…
Add table
Reference in a new issue