[yocto] [PATCH 3/8] plugins/sdk.ide: Use new setCurrentInput method to set defaults
mail at timomueller.eu
mail at timomueller.eu
Tue Dec 4 01:22:18 PST 2012
From: Atanas Gegov <atanas.gegov at bmw-carit.de>
Removes the error prone method of using the fControls array and uses
the new YoctoUIElement interface.
Improved method of setting default preferences (globally)
---
.../ide/preferences/YoctoSDKPreferencePage.java | 51 +------------------
1 files changed, 3 insertions(+), 48 deletions(-)
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
index b75bdc1..d1c1a72 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
@@ -89,58 +89,13 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
return false;
}
}
-
+
/*
* @see PreferencePage#performDefaults()
*/
protected void performDefaults() {
- IPreferenceStore store= getPreferenceStore();
- ArrayList<Control> arrControls = this.yoctoUISetting.getfControls();
-
- for (int i = 0; i < arrControls.size(); i++)
- {
- Control control = arrControls.get(i);
- String[] controlData = (String[])control.getData();
- String sKey = controlData[0];
- if (control instanceof Button)
- {
- sKey = sKey.substring(0, sKey.lastIndexOf("_"));
- }
- String sValue = store.getDefaultString(sKey);
- if (control instanceof Button)
- {
- if (sValue.equalsIgnoreCase("true"))
- {
- if (controlData[0].endsWith("_1")) //the 1st radio button of the group
- ((Button)control).setSelection(true);
- else
- ((Button)control).setSelection(false);//the 2nd radio button of the group
- }
- else
- {
- if (controlData[0].endsWith("_1")) //the 1st radio button of the group
- ((Button)control).setSelection(false);
- else
- ((Button)control).setSelection(true);//the 2nd radio button of the group
- }
- }
- else if (control instanceof Text)
- {
- ((Text)control).setText(sValue);
- }
- else if (control instanceof Combo)
- {
- if (!sValue.isEmpty())
- ((Combo)control).select(Integer.valueOf(sValue).intValue());
- }
- }
-
- try {
- yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
- } catch (YoctoGeneralException e) {
- System.out.println("Have you ever set Yocto Project Reference before?");
- System.out.println(e.getMessage());
- }
+ YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromStore();
+ yoctoUISetting.setCurrentInput(defaultElement);
super.performDefaults();
}
--
1.7.7.6
More information about the yocto
mailing list