[yocto] [PATCH 1/8] plugins/sdk.ide: Allow using a YoctoUIElement to set the input of a yocto settings widget

mail at timomueller.eu mail at timomueller.eu
Tue Dec 4 01:22:16 PST 2012


From: Atanas Gegov <atanas.gegov at bmw-carit.de>

Currently a YoctoUIElement is used to create a YoctoUISetting
widget. It is also possible to retrieve a YoctoUIElement containing
the current input of the widget. This patch adds the capability to
also set the input of the widget using a YoctoUIElement. Instead of
using the fControl array clients can now use this method to set the
input of the widget.
---
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |   40 ++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
index b4625f6..53af8f0 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
@@ -307,6 +307,46 @@ public class YoctoUISetting {
 		return elem;
 	}
 
+	public void setCurrentInput(YoctoUIElement elem){
+		btnSDKRoot.setSelection(false);
+		btnPokyRoot.setSelection(false);
+		if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_SDK_MODE)){
+			btnSDKRoot.setSelection(true);
+		}
+		else if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_TREE_MODE)){
+			btnPokyRoot.setSelection(true);
+		}
+
+		btnQemu.setSelection(false);
+		btnDevice.setSelection(false);
+		if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.QEMU_MODE)){
+			btnQemu.setSelection(true);
+		}
+		else if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.DEVICE_MODE)){
+			btnDevice.setSelection(true);
+		}
+
+		textRootLoc.setText(elem.getStrToolChainRoot());
+		targetArchCombo.select(elem.getIntTargetIndex());
+		if(elem.getStrTargetsArray() == null){
+			targetArchCombo.setItems(new String[]{});
+		}
+		else {
+			targetArchCombo.setItems(elem.getStrTargetsArray());
+		}
+		targetArchCombo.setText(elem.getStrTarget());
+		textKernelLoc.setText(elem.getStrQemuKernelLoc());
+		textQemuOption.setText(elem.getStrQemuOption());
+		textSysrootLoc.setText(elem.getStrSysrootLoc());
+
+		try {
+			validateInput(SDKCheckRequestFrom.Preferences, false);
+		} catch (YoctoGeneralException e) {
+			System.out.println("Have you ever set Yocto Project Reference before?");
+			System.out.println(e.getMessage());
+		}
+	}
+
 	public boolean validateInput(SDKCheckRequestFrom from, boolean bPrompt) throws YoctoGeneralException {
 		YoctoUIElement elem = getCurrentInput();
 		boolean pass = true;
-- 
1.7.7.6




More information about the yocto mailing list