From: Timo Mueller <timo.muel...@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.muel...@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 7476bd3..b35a167 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);
+
                createSaveAsProfileButton(storeYoctoConfigurationsGroup);
                createRenameButton(storeYoctoConfigurationsGroup);
                createRemoveButton(storeYoctoConfigurationsGroup);
-- 
1.7.11.7

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to