1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

RESOLVED - bug 237176: XL C/C++ Compiler Preferences page is annoying

https://bugs.eclipse.org/bugs/show_bug.cgi?id=237176
This commit is contained in:
Chris Recoskie 2008-11-07 14:25:20 +00:00
parent e7d2658df6
commit 42cf48b2e8
3 changed files with 38 additions and 3 deletions

View file

@ -20,6 +20,7 @@ public class Messages extends NLS {
public static String XLCompilerPreferencePage_0;
public static String XLCompilerPreferencePage_1;
public static String XLCompilerPreferencePage_2;
public static String XLCompilerPreferencePage_3;
public static String XLCompilerPropertyPage_0;
public static String XLCompilerPropertyPage_1;
public static String XLCompilerPropertyPage_2;

View file

@ -14,6 +14,7 @@ XLCompiler_v9=v9.0
XLCompilerPreferencePage_0=XL C/C++ Compiler Preferences
XLCompilerPreferencePage_1=Compiler Root Path:
XLCompilerPreferencePage_2=Compiler Version:
XLCompilerPreferencePage_3=Compiler path does not exist on the local machine.
XLCompilerPropertyPage_0=Compiler Root Path:
XLCompilerPropertyPage_1=Compiler Version:
XLCompilerPropertyPage_2=Compiler path does not exist on the local machine.

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.managedbuilder.xlc.ui.preferences;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.preference.*;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbench;
@ -35,6 +36,8 @@ public class XLCompilerPreferencePage
extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {
private String originalMessage;
public XLCompilerPreferencePage() {
super(FLAT);
setPreferenceStore(XLCUIPlugin.getDefault().getPreferenceStore());
@ -48,8 +51,36 @@ public class XLCompilerPreferencePage
* restore itself.
*/
public void createFieldEditors() {
addField(new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT,
Messages.XLCompilerPreferencePage_1, getFieldEditorParent()));
DirectoryFieldEditor pathEditor = new DirectoryFieldEditor(PreferenceConstants.P_XL_COMPILER_ROOT, Messages.XLCompilerPreferencePage_1, getFieldEditorParent())
{
protected boolean doCheckState()
{
// always return true, as we don't want to fail cases when compiler is installed remotely
// just warn user
if (getPage() != null)
{
if (!super.doCheckState())
{
getPage().setMessage(Messages.XLCompilerPreferencePage_3, IMessageProvider.WARNING);
}
else
{
getPage().setMessage(originalMessage, 0);
}
}
return true;
}
protected boolean checkState()
{
return doCheckState();
}
};
addField(pathEditor);
String[][] versionEntries = {{PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME, Messages.XLCompiler_v8},
{PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME, Messages.XLCompiler_v9}};
@ -62,7 +93,9 @@ public class XLCompilerPreferencePage
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
public void init(IWorkbench workbench) {
public void init(IWorkbench workbench)
{
originalMessage = getMessage();
}
}