From c7da892cb23d50d4d85746c9a0b6b14bf570989d Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Thu, 26 Jun 2014 13:23:09 +0200 Subject: initial commit for Enea Linux 4.0 Migrated from the internal git server on the daisy-enea branch Signed-off-by: Adrian Dudau --- .../yocto/sdk/ide/YoctoProjectSpecificSetting.java | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java (limited to 'plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java') 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 @@ +/******************************************************************************* + * Copyright (c) 2012 BMW Car IT GmbH. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * BMW Car IT - initial API and implementation + *******************************************************************************/ +package org.yocto.sdk.ide; + +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage; + +public class YoctoProjectSpecificSetting { + private static final String PROJECT_SPECIFIC_TITLE = "Preferences.Profile.ProjectSpecific.Title"; + private static final String PROJECT_SPECIFIC_GROUP_TITLE = "Preferences.Profile.ProjectSpecific.Group.Title"; + + private YoctoProfileSetting yoctoConfigurationsSetting; + private YoctoUISetting yoctoUISetting; + + private Button btnUseProjectSpecificSettingsCheckbox; + private PreferencePage preferencePage; + + public YoctoProjectSpecificSetting(YoctoProfileSetting yoctoConfigurationsSetting, + YoctoUISetting yoctoUISetting, PreferencePage preferencePage) { + this.yoctoConfigurationsSetting = yoctoConfigurationsSetting; + this.yoctoUISetting = yoctoUISetting; + this.preferencePage = preferencePage; + } + + public void createComposite(Composite composite) { + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + GridLayout layout = new GridLayout(2, false); + + Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE); + layout = new GridLayout(2, false); + storeYoctoConfigurationsGroup.setLayout(layout); + gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + gd.horizontalSpan = 2; + storeYoctoConfigurationsGroup.setLayoutData(gd); + storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_GROUP_TITLE)); + + btnUseProjectSpecificSettingsCheckbox = new Button(storeYoctoConfigurationsGroup, SWT.CHECK); + btnUseProjectSpecificSettingsCheckbox.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_TITLE)); + btnUseProjectSpecificSettingsCheckbox.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + if (btnUseProjectSpecificSettingsCheckbox.getSelection()){ + yoctoConfigurationsSetting.setUIFormEnabledState(false); + yoctoUISetting.setUIFormEnabledState(true); + + if (preferencePage instanceof YoctoSDKProjectPropertyPage) { + ((YoctoSDKProjectPropertyPage) preferencePage).switchToProjectSpecificProfile(); + } + } else { + yoctoConfigurationsSetting.setUIFormEnabledState(true); + yoctoConfigurationsSetting.setButtonsEnabledState(false); + yoctoUISetting.setUIFormEnabledState(false); + + if (preferencePage instanceof YoctoSDKProjectPropertyPage) { + ((YoctoSDKProjectPropertyPage) preferencePage).switchToSelectedProfile(); + } + } + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) {} + }); + } + + public void setUseProjectSpecificSettings(boolean isUsingProjectSpecificSettings) { + btnUseProjectSpecificSettingsCheckbox.setSelection(isUsingProjectSpecificSettings); + } + + public boolean isUsingProjectSpecificSettings() { + return btnUseProjectSpecificSettingsCheckbox.getSelection(); + } +} -- cgit v1.2.3-54-g00ecf