[yocto] [RFC 08/17] plugins/sdk.ide: Set profile on selection change
Timo Mueller
mail at timomueller.eu
Thu Jan 24 07:12:32 PST 2013
From: Timo Mueller <timo.mueller at bmw-carit.de>
When a profile is selected through the combo box the value of the
profileElement changed to contain the selected profile.
Signed-off-by: Timo Mueller <timo.mueller at bmw-carit.de>
---
.../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java
index eecb4ef..f9cd7ce 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java
@@ -16,7 +16,9 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
public class YoctoProfileSetting {
private static final String PROFILES_TITLE = "Preferences.Profiles.Title";
@@ -54,6 +56,27 @@ public class YoctoProfileSetting {
sdkConfigsCombo.setLayout(new GridLayout(2, false));
sdkConfigsCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
+ Listener selectionListener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ Object source = event.widget;
+ if (!(source instanceof Combo)) {
+ return;
+ }
+
+ Combo sdkCombo = (Combo) source;
+ if (sdkCombo.getSelectionIndex() < 0) {
+ return;
+ }
+
+ String selectedItem = sdkCombo.getItem(sdkCombo.getSelectionIndex());
+ profileElement.setSelectedProfile(selectedItem);
+ }
+ };
+
+ sdkConfigsCombo.addListener(SWT.Selection, selectionListener);
+ sdkConfigsCombo.addListener(SWT.Modify, selectionListener);
+
createNewProfileButton(storeYoctoConfigurationsGroup);
createRenameButton(storeYoctoConfigurationsGroup);
createRemoveButton(storeYoctoConfigurationsGroup);
--
1.7.11.7
More information about the yocto
mailing list