Skip to main content
summaryrefslogtreecommitdiffstats
path: root/xlc
diff options
context:
space:
mode:
authorVivian Kong2010-01-27 14:45:01 -0500
committerVivian Kong2010-01-27 14:45:01 -0500
commit6621f5653e7cf0cbec0e6002aa885040d6c9508f (patch)
tree1ff817845a697defd78bfad4f590f13cf5fb54a3 /xlc
parent6764511b39d631ac4b487645993b3a443af72992 (diff)
downloadorg.eclipse.cdt-6621f5653e7cf0cbec0e6002aa885040d6c9508f.tar.gz
org.eclipse.cdt-6621f5653e7cf0cbec0e6002aa885040d6c9508f.tar.xz
org.eclipse.cdt-6621f5653e7cf0cbec0e6002aa885040d6c9508f.zip
Bug 300917 - need a new version of XL C/C++ Compiler properties page for John Liu
Diffstat (limited to 'xlc')
-rw-r--r--xlc/org.eclipse.cdt.managedbuilder.xlc.ui/src/org/eclipse/cdt/managedbuilder/xlc/ui/properties/XLCompilerPropertyPage.java159
1 files changed, 87 insertions, 72 deletions
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 717af4cc2a..d9e20810b0 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
@@ -29,46 +29,55 @@ 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();
}
-
+
};
addField(fPathEditor);
-
+
IProject project = ((IResource) (getElement().getAdapter(IResource.class))).getProject();
-
+
String currentPath = null;
-
+
try {
currentPath = project.getPersistentProperty(new QualifiedName("", //$NON-NLS-1$
PreferenceConstants.P_XL_COMPILER_ROOT));
@@ -76,26 +85,30 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
// TODO Auto-generated catch block
e.printStackTrace();
}
-
- if(currentPath == null) {
+
+ if (currentPath == null) {
// if the property isn't set, then use the workbench preference
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
currentPath = prefStore.getString(PreferenceConstants.P_XL_COMPILER_ROOT);
}
-
+
fPathEditor.setStringValue(currentPath);
-
- String[] versionEntries = {PreferenceConstants.P_XL_COMPILER_VERSION_8_NAME,
- PreferenceConstants.P_XL_COMPILER_VERSION_9_NAME,
- PreferenceConstants.P_XL_COMPILER_VERSION_10_NAME};
-
+
+ }
+
+ 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 };
+
Composite versionParent = getFieldEditorParent();
-
+
fVersionEditor = new BuildOptionComboFieldEditor(PreferenceConstants.P_XLC_COMPILER_VERSION,
Messages.XLCompilerPropertyPage_1, versionEntries, null, versionParent);
-
+
addField(fVersionEditor);
-
+
String currentVersion = null;
try {
currentVersion = project.getPersistentProperty(new QualifiedName("", //$NON-NLS-1$
@@ -104,49 +117,50 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
// TODO Auto-generated catch block
e.printStackTrace();
}
-
- if(currentVersion == null) {
+
+ if (currentVersion == null) {
// if the property isn't set, then use the workbench preference
IPreferenceStore prefStore = XLCUIPlugin.getDefault().getPreferenceStore();
currentVersion = prefStore.getString(PreferenceConstants.P_XLC_COMPILER_VERSION);
}
-
+
Combo versionCombo = fVersionEditor.getComboControl(versionParent);
versionCombo.setText(PreferenceConstants.getVersionLabel(currentVersion));
}
- private DirectoryFieldEditor fPathEditor;
-
- private BuildOptionComboFieldEditor fVersionEditor;
+ protected DirectoryFieldEditor fPathEditor;
- //private Composite parent;
+ protected BuildOptionComboFieldEditor fVersionEditor;
+ // private Composite parent;
/**
* Constructor for SamplePropertyPage.
*/
public XLCompilerPropertyPage() {
super(FieldEditorPreferencePage.FLAT);
-
+
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);
-
- fPathEditor.setStringValue(currentPath);
+ 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,14 +168,14 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
try {
IProject project = ((IResource) (getElement().getAdapter(IResource.class))).getProject();
- project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
- PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor
- .getStringValue());
-
+ if (fPathEditor != null) {
+ project.setPersistentProperty(new QualifiedName("", //$NON-NLS-1$
+ PreferenceConstants.P_XL_COMPILER_ROOT), fPathEditor.getStringValue());
+ }
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);
}
@@ -170,28 +184,29 @@ public class XLCompilerPropertyPage extends FieldEditorPreferencePage implements
}
return true;
}
-
- /**
- * The element.
- */
- private IAdaptable element;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
- */
- public IAdaptable getElement() {
- return element;
- }
-
- /**
- * Sets the element that owns properties shown on this page.
- *
- * @param element
- * the element
- */
- public void setElement(IAdaptable element) {
- this.element = element;
- }
+
+ /**
+ * The element.
+ */
+ private IAdaptable element;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
+ */
+ public IAdaptable getElement() {
+ return element;
+ }
+
+ /**
+ * Sets the element that owns properties shown on this page.
+ *
+ * @param element
+ * the element
+ */
+ public void setElement(IAdaptable element) {
+ this.element = element;
+ }
} \ No newline at end of file

Back to the top