diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:36:50 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 15:25:03 +0100 |
commit | 41ac47d732eed8392d60d0f6773e5a279d49b999 (patch) | |
tree | cf19d099db9cfdb8d73aa21c31e7aa1cc86ff860 /plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java | |
download | eclipse-poky-juno-41ac47d732eed8392d60d0f6773e5a279d49b999.tar.gz |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java')
-rw-r--r-- | plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java new file mode 100644 index 0000000..2a55a64 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java | |||
@@ -0,0 +1,88 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | import org.eclipse.jface.preference.PreferencePage; | ||
14 | import org.eclipse.swt.SWT; | ||
15 | import org.eclipse.swt.events.SelectionEvent; | ||
16 | import org.eclipse.swt.events.SelectionListener; | ||
17 | import org.eclipse.swt.layout.GridData; | ||
18 | import org.eclipse.swt.layout.GridLayout; | ||
19 | import org.eclipse.swt.widgets.Button; | ||
20 | import org.eclipse.swt.widgets.Composite; | ||
21 | import org.eclipse.swt.widgets.Group; | ||
22 | import org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage; | ||
23 | |||
24 | public class YoctoProjectSpecificSetting { | ||
25 | private static final String PROJECT_SPECIFIC_TITLE = "Preferences.Profile.ProjectSpecific.Title"; | ||
26 | private static final String PROJECT_SPECIFIC_GROUP_TITLE = "Preferences.Profile.ProjectSpecific.Group.Title"; | ||
27 | |||
28 | private YoctoProfileSetting yoctoConfigurationsSetting; | ||
29 | private YoctoUISetting yoctoUISetting; | ||
30 | |||
31 | private Button btnUseProjectSpecificSettingsCheckbox; | ||
32 | private PreferencePage preferencePage; | ||
33 | |||
34 | public YoctoProjectSpecificSetting(YoctoProfileSetting yoctoConfigurationsSetting, | ||
35 | YoctoUISetting yoctoUISetting, PreferencePage preferencePage) { | ||
36 | this.yoctoConfigurationsSetting = yoctoConfigurationsSetting; | ||
37 | this.yoctoUISetting = yoctoUISetting; | ||
38 | this.preferencePage = preferencePage; | ||
39 | } | ||
40 | |||
41 | public void createComposite(Composite composite) { | ||
42 | GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
43 | GridLayout layout = new GridLayout(2, false); | ||
44 | |||
45 | Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE); | ||
46 | layout = new GridLayout(2, false); | ||
47 | storeYoctoConfigurationsGroup.setLayout(layout); | ||
48 | gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
49 | gd.horizontalSpan = 2; | ||
50 | storeYoctoConfigurationsGroup.setLayoutData(gd); | ||
51 | storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_GROUP_TITLE)); | ||
52 | |||
53 | btnUseProjectSpecificSettingsCheckbox = new Button(storeYoctoConfigurationsGroup, SWT.CHECK); | ||
54 | btnUseProjectSpecificSettingsCheckbox.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_TITLE)); | ||
55 | btnUseProjectSpecificSettingsCheckbox.addSelectionListener(new SelectionListener() { | ||
56 | @Override | ||
57 | public void widgetSelected(SelectionEvent e) { | ||
58 | if (btnUseProjectSpecificSettingsCheckbox.getSelection()){ | ||
59 | yoctoConfigurationsSetting.setUIFormEnabledState(false); | ||
60 | yoctoUISetting.setUIFormEnabledState(true); | ||
61 | |||
62 | if (preferencePage instanceof YoctoSDKProjectPropertyPage) { | ||
63 | ((YoctoSDKProjectPropertyPage) preferencePage).switchToProjectSpecificProfile(); | ||
64 | } | ||
65 | } else { | ||
66 | yoctoConfigurationsSetting.setUIFormEnabledState(true); | ||
67 | yoctoConfigurationsSetting.setButtonsEnabledState(false); | ||
68 | yoctoUISetting.setUIFormEnabledState(false); | ||
69 | |||
70 | if (preferencePage instanceof YoctoSDKProjectPropertyPage) { | ||
71 | ((YoctoSDKProjectPropertyPage) preferencePage).switchToSelectedProfile(); | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | @Override | ||
77 | public void widgetDefaultSelected(SelectionEvent e) {} | ||
78 | }); | ||
79 | } | ||
80 | |||
81 | public void setUseProjectSpecificSettings(boolean isUsingProjectSpecificSettings) { | ||
82 | btnUseProjectSpecificSettingsCheckbox.setSelection(isUsingProjectSpecificSettings); | ||
83 | } | ||
84 | |||
85 | public boolean isUsingProjectSpecificSettings() { | ||
86 | return btnUseProjectSpecificSettingsCheckbox.getSelection(); | ||
87 | } | ||
88 | } | ||