Storing yocto settings as target profiles
v4 cover Storing yocto settings as target profiles
From: Timo Mueller <[email protected]>
Hi,
I removed the last patch that was moving the "Save as ..." button to the bottom. So now it is located beneath the dropdown box. I also changed the message in the profile deletion dialog to only ask if the user really wants to delete the profile.
From RFC v3:
<snip>
First of all I've fixed the issues with the patches (duplicate method, missing fix for NewYoctoCProjectTemplate.java).
I also changed the functionality of the "new" button according to Jessica's feedback. The logic is changed to a "Save as ..." approach. If the button is clicked the current values of the form are checked. If these are valid, the user can enter a name to store them as a new profile.
</snip>
From the original cover letter:
<snip>
currently the yocto settings can be changed globally through eclipse's preferences or locally in the project properties. But the standard configuration stored in the global preferences sometimes changes, e.g. if a new version of the toolchain or the sysroot is released.
If you change the global settings to the updated toolchain or sysroot your old working configuration is gone. If you want to reuse this configuration at a later point in time you have to (remember and) re-enter everthing. This patch set introduces the possiblity to store a configuration under a unique name, a so called target profile, and be able to select the default target profile that is used for new projects.
Building upon this change the target profiles could later also be used in the project settings and be able to quickly build and debug your software for different hard- and software combinations.
</snip>
Best regards,
Timo
Atanas Gegov (4):
plugins/sdk.ide: Extract labels to private members plugins/sdk.ide: Add method to enable and disable form plugins/sdk.ide: Set value of target array on input change plugins/sdk.ide: Create UI element for managing target profiles.
Timo Mueller (13):
plugins/sdk.ide: Removed unused message
plugins/sdk.ide: Changed method signature to be more consistent plugins/sdk.ide: Modified preferences storage to support profiles. plugins/sdk.ide: Set profile on selection change plugins/sdk.ide: Add method to allow storing the current settings plugins/sdk.ide: Add UI method to create a new profile plugins/sdk.ide: Add UI method to delete a profile plugins/sdk.ide: Add UI method to rename a profile plugins/sdk.ide: Add method to change values of the preference page plugins/sdk.ide: Add method to rename a profile and its preference
store
plugins/sdk.ide: Add method to delete a profile plugins/sdk.ide: Use profiles for the preference page plugins/sdk.ide: Added profile UI to the preference page
.../src/org/yocto/sdk/ide/YoctoProfileElement.java | 104 ++++++++++ .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 229 +++++++++++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 19 +- .../src/org/yocto/sdk/ide/YoctoSDKPlugin.java | 9 + .../org/yocto/sdk/ide/YoctoSDKProjectNature.java | 10 +- .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 62 ++++-- .../src/org/yocto/sdk/ide/YoctoUISetting.java | 60 +++++- .../sdk/ide/preferences/PreferenceConstants.java | 5 + .../sdk/ide/preferences/PreferenceInitializer.java | 22 +- .../ide/preferences/ProfileNameInputValidator.java | 63 ++++++ .../ide/preferences/YoctoSDKPreferencePage.java | 112 +++++++--- .../preferences/YoctoSDKProjectPropertyPage.java | 6 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 7 +- 13 files changed, 643 insertions(+), 65 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java
Signature · 1 line
1.7.11.7
RFC v4 1/17 plugins/sdk.ide: Removed unused message
From: Timo Mueller <[email protected]>
The dialog has been merged with the project settings. Therefor the message is no longer needed.
--- .../org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties | 1 - 1 file changed, 1 deletion(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +0 -1
@@ -22,7 +22,6 @@ Poky.Env.Script.Nonexist = Specified Build Tree Toolchain Root does not contain Poky.ADT.Sysroot.Wrongversion = OECORE related items are not found in envrionement setup files.\nThe ADT version you're using is too old.\n Please upgrade to our latest ADT Version! Poky.Toolchain.Host.Mismatch = Toolchain and host arch mismatch.\n Make sure you use 32bit toolchain for 32bit host and same for 64bit machines! Poky.Toolchain.No.Sysroot = There's no sysroots directory under your toolchain directory under /opt/poky! -Menu.SDK.Dialog.Title = Yocto Project Settings Menu.SDK.Console.Configure.Message = The Yocto Project ADT has been successfully set up for this project.\nTo see the environment variables created during setup,\ngo to Project > Properties > C/C++ Build > Environment.
Signature · 1 line
1.7.11.7
RFC v4 2/17 plugins/sdk.ide: Extract labels to private members
From: Atanas Gegov <[email protected]>
Extracting the labels as private members allows the modification of the label settings after creation. This is will allow disabling and enabling the labels after creation of the form.
--- .../src/org/yocto/sdk/ide/YoctoUISetting.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java +7 -7
@@ -63,6 +63,12 @@ public class YoctoUISetting { private Text textRootLoc; private Combo targetArchCombo; + private Label root_label; + private Label sysroot_label; + private Label targetArchLabel; + private Label kernel_label; + private Label option_label; + public YoctoUISetting(YoctoUIElement elem) { yoctoUIElement = elem;
@@ -140,10 +146,6 @@ public class YoctoUISetting { private void createQemuSetup(final Group targetGroup) throws YoctoGeneralException { - Label kernel_label; - Label option_label; - - //QEMU Setup kernel_label= new Label(targetGroup, SWT.NONE); kernel_label.setText("Kernel: ");
@@ -180,8 +182,6 @@ public class YoctoUISetting { } public void createComposite(Composite composite) throws YoctoGeneralException { - Label root_label, sysroot_label; - GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); GridLayout layout = new GridLayout(2, false); composite.setLayout(layout);
@@ -224,7 +224,7 @@ public class YoctoUISetting { btnSysrootLoc = addFileSelectButton(textContainer, textSysrootLoc, PreferenceConstants.SYSROOT); updateSDKControlState(); - Label targetArchLabel= new Label(crossCompilerGroup, SWT.NONE); + targetArchLabel = new Label(crossCompilerGroup, SWT.NONE); targetArchLabel.setText("Target Architecture: "); targetArchCombo= new Combo(crossCompilerGroup, SWT.READ_ONLY);
Signature · 1 line
1.7.11.7
RFC v4 3/17 plugins/sdk.ide: Add method to enable and disable form
From: Atanas Gegov <[email protected]>
The YoctoUISetting form as a whole can be disabled and enabled using this method. A disabled form can for example show a read-only yocto configuration.
--- .../src/org/yocto/sdk/ide/YoctoUISetting.java | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java +44 -0
@@ -370,6 +370,50 @@ public class YoctoUISetting { return pass; } + public void setUIFormEnabledState(boolean isEnabled) { + btnSDKRoot.setEnabled(isEnabled); + btnPokyRoot.setEnabled(isEnabled); + + root_label.setEnabled(isEnabled); + textRootLoc.setEnabled(isEnabled); + btnToolChainLoc.setEnabled(isEnabled); + + sysroot_label.setEnabled(isEnabled); + textSysrootLoc.setEnabled(isEnabled); + btnSysrootLoc.setEnabled(isEnabled); + + targetArchLabel.setEnabled(isEnabled); + targetArchCombo.setEnabled(isEnabled); + + btnQemu.setEnabled(isEnabled); + + if(isEnabled) { + /* enabling widgets regarding + * Kernel and Custom Options + * depends on the state of the QEMU button */ + kernel_label.setEnabled(isEnabled); + option_label.setEnabled(isEnabled); + + if(btnQemu.getSelection()) { + textKernelLoc.setEnabled(isEnabled); + btnKernelLoc.setEnabled(isEnabled); + + textQemuOption.setEnabled(isEnabled); + } + } else { + /* disable all widgets regarding + * Kernel and Custom Options */ + kernel_label.setEnabled(isEnabled); + textKernelLoc.setEnabled(isEnabled); + btnKernelLoc.setEnabled(isEnabled); + + option_label.setEnabled(isEnabled); + textQemuOption.setEnabled(isEnabled); + } + + btnDevice.setEnabled(isEnabled); + } + private void updateQemuControlState() { boolean bQemuMode = btnQemu.getSelection();
Signature · 1 line
1.7.11.7
RFC v4 4/17 plugins/sdk.ide: Set value of target array on input change
From: Atanas Gegov <[email protected]>
The value of the target array set in the constructor is now also affected when the input of the element is changed.
--- plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java | 2 ++ 1 file changed, 2 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java +2 -0
@@ -303,6 +303,8 @@ public class YoctoUISetting { } public void setCurrentInput(YoctoUIElement elem){ + elem.setStrTargetsArray(getTargetArray(elem)); + btnSDKRoot.setSelection(false); btnPokyRoot.setSelection(false); if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_SDK_MODE)){
Signature · 1 line
1.7.11.7
RFC v4 5/17 plugins/sdk.ide: Changed method signature to be more consistent
From: Timo Mueller <[email protected]>
YoctoUIElement should always be the first element, e.g. as in saveElemToStore().
--- plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java | 2 +- .../src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +1 -1
@@ -423,7 +423,7 @@ public class YoctoSDKUtils { } /* Save YoctoUIElement to project settings */ - public static void saveElemToProjectEnv(IProject project, YoctoUIElement elem) + public static void saveElemToProjectEnv(YoctoUIElement elem, IProject project) { ConsoleOutputStream consoleOutStream = null;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java +1 -1
@@ -99,7 +99,7 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true); YoctoUIElement elem = yoctoUISetting.getCurrentInput(); - YoctoSDKUtils.saveElemToProjectEnv(getProject(), elem); + YoctoSDKUtils.saveElemToProjectEnv(elem, getProject()); return super.performOk(); } catch (YoctoGeneralException e) {
Signature · 1 line
1.7.11.7
RFC v4 6/17 plugins/sdk.ide: Create UI element for managing target profiles.
From: Atanas Gegov <[email protected]>
A target profile is a combination of yocto settings identified by a user-defined name. This UI element allows the user to add new profiles and to rename or delete existing ones.
--- .../src/org/yocto/sdk/ide/YoctoProfileElement.java | 104 +++++++++++++++++++++ .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 98 +++++++++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 5 + .../sdk/ide/preferences/PreferenceConstants.java | 1 + 4 files changed, 208 insertions(+) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java new file +104 -0
@@ -0,0 +1,104 @@ +/******************************************************************************* + * 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 java.util.Comparator; +import java.util.StringTokenizer; +import java.util.TreeSet; + +import org.yocto.sdk.ide.preferences.PreferenceConstants; + +public class YoctoProfileElement { + private TreeSet<String> profiles = new TreeSet<String>(new Comparator<String>() { + + @Override + public int compare(String o1, String o2) { + int strcompare = o1.compareTo(o2); + + if (strcompare == 0) { + return strcompare; + } + + // Standard profile always less than anything else + if (o1.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { + return -1; + } + + if (o2.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { + return 1; + } + + return strcompare; + } + }); + + private String selectedProfile; + + public YoctoProfileElement(String profilesString, String selectedProfile) { + setProfilesFromString(profilesString); + this.selectedProfile = selectedProfile; + } + + public void addProfile(String profile) { + this.profiles.add(profile); + } + + public boolean contains(String newText) { + return profiles.contains(newText); + } + + public TreeSet<String> getProfiles() { + return profiles; + } + + public String getProfilesAsString() { + String profileString = ""; + + for (String profile : profiles) { + profileString += "\"" + profile + "\","; + } + return profileString.substring(0, profileString.length() - 1); + } + + public String getSelectedProfile() { + return selectedProfile; + } + + public void remove(String profile) { + this.profiles.remove(profile); + } + + public void rename(String oldProfileName, String newProfileName) { + this.remove(oldProfileName); + this.addProfile(newProfileName); + + if (selectedProfile.equals(oldProfileName)) { + selectedProfile = newProfileName; + } + } + + public void setProfiles(TreeSet<String> profiles) { + this.profiles = profiles; + } + + public void setProfilesFromString(String profilesString) { + StringTokenizer tokenizer = new StringTokenizer(profilesString, ","); + + while (tokenizer.hasMoreElements()) { + String config = (String) tokenizer.nextElement(); + profiles.add(config.replace("\"", "")); + } + } + + public void setSelectedProfile(String selectedProfile) { + this.selectedProfile = selectedProfile; + } +}
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java new file +98 -0
98 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +5 -0
@@ -7,6 +7,7 @@ * * Contributors: * Intel - initial API and implementation + * BMW Car IT - added keys for target profiles *******************************************************************************/ Wizard.SDK.Warning.Title = Invalid Yocto Project ADT Location
@@ -45,6 +46,10 @@ Preferences.SDK.Target.name = Target Preferences: Preferences.SDK.Informing.Title = Yocto Project ADT has been successfully set up. Preferences.SDK.Informing.Message = You might need to reconfigure your existing Yocto Project Autotools Projects to use the Yocto Project ADT. Do this from Project > Reconfigure Project! +Preferences.Profiles.Title = Target profiles: +Preferences.Profile.New.Title = Save as ... +Preferences.Profile.Rename.Title = Rename +Preferences.Profile.Remove.Title = Remove Console.SDK.Name = Yocto Project Console
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java +1 -0
@@ -33,4 +33,5 @@ public class PreferenceConstants { public static final String IP_ADDR = "IPAddr"; + public static final String STANDARD_PROFILE_NAME = "Standard Profile"; }
Signature · 1 line
1.7.11.7
RFC v4 7/17 plugins/sdk.ide: Modified preferences storage to support profiles.
From: Timo Mueller <[email protected]>
Yocto preferences are now stored using a user-defined name that identifies a target profile. To store these preferences eclipse' scoped preferences provider is used. The filename in the eclipse configuration area is derived from the unique target profile name.
--- .../src/org/yocto/sdk/ide/YoctoSDKPlugin.java | 9 ++++ .../org/yocto/sdk/ide/YoctoSDKProjectNature.java | 10 ++-- .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 60 +++++++++++++++++----- .../sdk/ide/preferences/PreferenceConstants.java | 4 ++ .../sdk/ide/preferences/PreferenceInitializer.java | 22 ++++---- .../ide/preferences/YoctoSDKPreferencePage.java | 36 ++++--------- .../preferences/YoctoSDKProjectPropertyPage.java | 4 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 7 ++- 8 files changed, 99 insertions(+), 53 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java +9 -0
@@ -16,9 +16,12 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.osgi.framework.BundleContext; /**
@@ -65,6 +68,12 @@ public class YoctoSDKPlugin extends AbstractUIPlugin { return plugin; } + public static IPreferenceStore getProfilePreferenceStore(String profileName) { + int profileIdentifier = profileName.hashCode(); + + return new ScopedPreferenceStore(InstanceScope.INSTANCE,getUniqueIdentifier() + "." + profileIdentifier); + } + public static void log(IStatus status) { ResourcesPlugin.getPlugin().getLog().log(status); }
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java +7 -3
@@ -18,10 +18,13 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; + import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; +import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager; +import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
@@ -34,8 +37,7 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager; -import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration; +import org.eclipse.jface.preference.IPreferenceStore; import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom;
@@ -151,7 +153,9 @@ public class YoctoSDKProjectNature implements IProjectNature { } public static void configureAutotools(IProject project) throws YoctoGeneralException { - YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(); + YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); + IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile()); + YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore); YoctoSDKUtils.SDKCheckResults result = YoctoSDKUtils.checkYoctoSDK(elem); if (result != YoctoSDKUtils.SDKCheckResults.SDK_PASS){ String strErrorMsg = YoctoSDKUtils.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java +48 -12
115 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java +4 -0
@@ -34,4 +34,8 @@ public class PreferenceConstants { public static final String IP_ADDR = "IPAddr"; public static final String STANDARD_PROFILE_NAME = "Standard Profile"; + + public static final String PROFILES = "profiles"; + + public static final String SELECTED_PROFILE = "selectedProfile"; }
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java +13 -9
@@ -15,6 +15,8 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.yocto.sdk.ide.YoctoSDKPlugin; +import static org.yocto.sdk.ide.preferences.PreferenceConstants.*; + /** * Class used to initialize default preference values. */
@@ -26,15 +28,17 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer { */ public void initializeDefaultPreferences() { IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore(); - store.setDefault(PreferenceConstants.TOOLCHAIN_ROOT, ""); - store.setDefault(PreferenceConstants.SDK_MODE, true); - store.setDefault(PreferenceConstants.TARGET_MODE, false); - store.setDefault(PreferenceConstants.TARGET_ARCH_INDEX, -1); - store.setDefault(PreferenceConstants.IP_ADDR, ""); - store.setDefault(PreferenceConstants.QEMU_KERNEL, ""); - store.setDefault(PreferenceConstants.QEMU_OPTION, ""); - store.setDefault(PreferenceConstants.SYSROOT, ""); - store.setDefault(PreferenceConstants.TOOLCHAIN_TRIPLET, ""); + store.setDefault(TOOLCHAIN_ROOT, ""); + store.setDefault(SDK_MODE, true); + store.setDefault(TARGET_MODE, false); + store.setDefault(TARGET_ARCH_INDEX, -1); + store.setDefault(IP_ADDR, ""); + store.setDefault(QEMU_KERNEL, ""); + store.setDefault(QEMU_OPTION, ""); + store.setDefault(SYSROOT, ""); + store.setDefault(TOOLCHAIN_TRIPLET, ""); + store.setDefault(PROFILES, "\"" + STANDARD_PROFILE_NAME + "\""); + store.setDefault(SELECTED_PROFILE, STANDARD_PROFILE_NAME); } }
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +10 -26
@@ -10,32 +10,20 @@ *******************************************************************************/ package org.yocto.sdk.ide.preferences; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; - +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; import org.yocto.sdk.ide.YoctoGeneralException; -import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoSDKPlugin; +import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom; - import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.YoctoUISetting; -import java.util.ArrayList; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Text; - - - public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private YoctoUISetting yoctoUISetting;
@@ -44,7 +32,7 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench //super(GRID); setPreferenceStore(YoctoSDKPlugin.getDefault().getPreferenceStore()); //setDescription(YoctoSDKMessages.getString(PREFERENCES_Yocto_CONFIG)); - YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(); + YoctoUIElement elem = YoctoSDKUtils.getElemFromDefaultStore(); this.yoctoUISetting = new YoctoUISetting(elem); }
@@ -74,30 +62,26 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench * @see IPreferencePage#performOk() */ public boolean performOk() { - - try { yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true); YoctoUIElement elem = yoctoUISetting.getCurrentInput(); - YoctoSDKUtils.saveElemToStore(elem); + YoctoSDKUtils.saveElemToDefaultStore(elem); return super.performOk(); } catch (YoctoGeneralException e) { // TODO Auto-generated catch block System.out.println(e.getMessage()); return false; - } + } } /* * @see PreferencePage#performDefaults() */ protected void performDefaults() { - YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromStore(); + YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromDefaultStore(); yoctoUISetting.setCurrentInput(defaultElement); super.performDefaults(); } - - }
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java +2 -2
@@ -74,7 +74,7 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements || uiElement.getStrTarget().isEmpty()) { // No project environment has been set yet, use the Preference // values - uiElement = YoctoSDKUtils.getElemFromStore(); + uiElement = YoctoSDKUtils.getElemFromDefaultStore(); } return uiElement;
@@ -85,7 +85,7 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements */ @Override protected void performDefaults() { - YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromStore(); + YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromDefaultStore(); yoctoUISetting.setCurrentInput(defaultElement); super.performDefaults(); }
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java +6 -1
@@ -40,8 +40,11 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature; import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager; +import org.eclipse.jface.preference.IPreferenceStore; import org.yocto.sdk.ide.YoctoGeneralException; +import org.yocto.sdk.ide.YoctoProfileElement; import org.yocto.sdk.ide.YoctoSDKEmptyProjectNature; +import org.yocto.sdk.ide.YoctoSDKPlugin; import org.yocto.sdk.ide.YoctoSDKProjectNature; import org.yocto.sdk.ide.YoctoSDKUtils; import org.yocto.sdk.ide.YoctoUIElement;
@@ -114,7 +117,9 @@ public class NewYoctoCProjectTemplate extends ProcessRunner { IWorkspace workspace = ResourcesPlugin.getWorkspace(); turnOffAutoBuild(workspace); - YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(); + YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); + IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile()); + YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore); YoctoSDKUtils.SDKCheckResults result = YoctoSDKUtils.checkYoctoSDK(elem); if (result != YoctoSDKUtils.SDKCheckResults.SDK_PASS){ String strErrorMsg = YoctoSDKUtils.getErrorMessage(result, SDKCheckRequestFrom.Wizard);
Signature · 1 line
1.7.11.7
RFC v4 8/17 plugins/sdk.ide: Set profile on selection change
From: Timo Mueller <[email protected]>
When a profile is selected through the combo box the value of the profileElement changed to contain the selected profile.
--- .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java +23 -0
@@ -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);
Signature · 1 line
1.7.11.7
RFC v4 9/17 plugins/sdk.ide: Add method to allow storing the current settings
From: Timo Mueller <[email protected]>
The added method calls the performOK method on the provided preference page to store the current content of the page.
This callback is needed so the profile UI is able to propagate changes to the preference page it is part of.
--- .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java +8 -1
@@ -10,6 +10,7 @@ *******************************************************************************/ package org.yocto.sdk.ide; +import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout;
@@ -32,9 +33,11 @@ public class YoctoProfileSetting { private Button btnConfigSaveAs; private YoctoProfileElement profileElement; + private PreferencePage preferencePage; - public YoctoProfileSetting(YoctoProfileElement profileElement) { + public YoctoProfileSetting(YoctoProfileElement profileElement, PreferencePage preferencePage) { this.profileElement = profileElement; + this.preferencePage = preferencePage; } public void createComposite(Composite composite) {
@@ -98,6 +101,10 @@ public class YoctoProfileSetting { btnConfigRename.setText(YoctoSDKMessages.getString(RENAME_PROFILE_TITLE)); } + private void saveChangesOnCurrentProfile() { + preferencePage.performOk(); + } + private void addConfigs(Combo combo) { for (String profile : profileElement.getProfiles()) { combo.add(profile);
Signature · 1 line
1.7.11.7
RFC v4 10/17 plugins/sdk.ide: Add UI method to create a new profile
From: Timo Mueller <[email protected]>
When the save as button is clicked a dialog shows up and the user has to provide the name of the new profile. The validity of the name is checked during input. If the name is valid and the users confirms the new profile is created from the current input of the yocto settings form.
--- .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 17 ++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 7 +++ .../ide/preferences/ProfileNameInputValidator.java | 63 ++++++++++++++++++++++ .../ide/preferences/YoctoSDKPreferencePage.java | 56 ++++++++++++++++++- 4 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java +17 -0
@@ -12,6 +12,8 @@ package org.yocto.sdk.ide; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button;
@@ -20,6 +22,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Listener; +import org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage; public class YoctoProfileSetting { private static final String PROFILES_TITLE = "Preferences.Profiles.Title";
@@ -88,6 +91,14 @@ public class YoctoProfileSetting { private void createSaveAsProfileButton(Group storeYoctoConfigurationsGroup) { btnConfigSaveAs = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); btnConfigSaveAs.setText(YoctoSDKMessages.getString(NEW_PROFILE_TITLE)); + btnConfigSaveAs.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + if (preferencePage instanceof YoctoSDKPreferencePage) { + ((YoctoSDKPreferencePage) preferencePage).performSaveAs(); + } + } + }); } private void createRemoveButton(Group storeYoctoConfigurationsGroup) {
@@ -111,6 +122,12 @@ public class YoctoProfileSetting { } } + public void addProfile(String profileName) { + int index = sdkConfigsCombo.getItemCount(); + sdkConfigsCombo.add(profileName, index); + sdkConfigsCombo.select(index); + } + public void setUIFormEnabledState(boolean isEnabled) { setButtonsEnabledState(isEnabled); sdkConfigsCombo.setEnabled(isEnabled);
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +7 -0
@@ -46,8 +46,15 @@ Preferences.SDK.Target.name = Target Preferences: Preferences.SDK.Informing.Title = Yocto Project ADT has been successfully set up. Preferences.SDK.Informing.Message = You might need to reconfigure your existing Yocto Project Autotools Projects to use the Yocto Project ADT. Do this from Project > Reconfigure Project! +Preferences.Profile.Validator.InvalidName.Comma = Warning: The profile name cannot contain a comma (,). +Preferences.Profile.Validator.InvalidName.Quote = Warning: The profile name cannot contain a double quote (\"). +Preferences.Profile.Validator.InvalidName.Empty = Please provide a new profile name. +Preferences.Profile.Validator.InvalidName.Exists = Warning: The profile already exists. + Preferences.Profiles.Title = Target profiles: Preferences.Profile.New.Title = Save as ... +Preferences.Profile.New.Dialog.Title = Save as new target profile +Preferences.Profile.New.Dialog.Message = Please input a profile name. Preferences.Profile.Rename.Title = Rename Preferences.Profile.Remove.Title = Remove
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java new file +63 -0
63 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +55 -1
78 lines not on this page · raw message
Signature · 1 line
1.7.11.7
RFC v4 11/17 plugins/sdk.ide: Add UI method to delete a profile
From: Timo Mueller <[email protected]>
A profile is removed from the list, when the delete button is clicked. The deletion has to be confirmed by the user. Deleting the standard profile is not allowed.
--- .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 34 ++++++++++++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 4 +++ 2 files changed, 38 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java +34 -0
@@ -10,6 +10,7 @@ *******************************************************************************/ package org.yocto.sdk.ide; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter;
@@ -22,6 +23,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Listener; +import org.yocto.sdk.ide.preferences.PreferenceConstants; import org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage; public class YoctoProfileSetting {
@@ -29,6 +31,10 @@ public class YoctoProfileSetting { private static final String NEW_PROFILE_TITLE = "Preferences.Profile.New.Title"; private static final String RENAME_PROFILE_TITLE = "Preferences.Profile.Rename.Title"; private static final String REMOVE_PROFILE_TITLE = "Preferences.Profile.Remove.Title"; + private static final String REMOVE_DIALOG_TITLE = "Preferences.Profile.Remove.Dialog.Title"; + private static final String REMOVE_DIALOG_MESSAGE = "Preferences.Profile.Remove.Dialog.Message"; + private static final String MODIFY_STANDARD_TITLE = "Preferences.Profile.Standard.Modification.Title"; + private static final String MODIFY_STANDARD_MESSAGE = "Preferences.Profile.Standard.Modification.Message"; private Combo sdkConfigsCombo; private Button btnConfigRename;
@@ -105,6 +111,34 @@ public class YoctoProfileSetting { btnConfigRemove = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); btnConfigRemove.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false, 3, 1)); btnConfigRemove.setText(YoctoSDKMessages.getString(REMOVE_PROFILE_TITLE)); + btnConfigRemove.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + saveChangesOnCurrentProfile(); + int selectionIndex = sdkConfigsCombo.getSelectionIndex(); + String selectedItem = sdkConfigsCombo.getItem(selectionIndex); + + if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { + MessageDialog.openInformation(null, + YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE), + YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE)); + return; + } + + boolean deleteConfirmed = + MessageDialog.openConfirm(null, + YoctoSDKMessages.getString(REMOVE_DIALOG_TITLE), + YoctoSDKMessages.getFormattedString(REMOVE_DIALOG_MESSAGE, selectedItem)); + + if (!deleteConfirmed) { + return; + } + + sdkConfigsCombo.select(0); + sdkConfigsCombo.remove(selectionIndex); + profileElement.remove(selectedItem); + } + }); } private void createRenameButton(Group storeYoctoConfigurationsGroup) {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +4 -0
@@ -57,6 +57,10 @@ Preferences.Profile.New.Dialog.Title = Save as new target profile Preferences.Profile.New.Dialog.Message = Please input a profile name. Preferences.Profile.Rename.Title = Rename Preferences.Profile.Remove.Title = Remove +Preferences.Profile.Remove.Dialog.Title = Remove target profile +Preferences.Profile.Remove.Dialog.Message = Do you really want to the remove the target profile "{0}"? +Preferences.Profile.Standard.Modification.Title = Modify standard target profile +Preferences.Profile.Standard.Modification.Message = Standard target profile cannot be removed or renamed. Console.SDK.Name = Yocto Project Console
Signature · 1 line
1.7.11.7
RFC v4 12/17 plugins/sdk.ide: Add UI method to rename a profile
From: Timo Mueller <[email protected]>
When the rename button is clicked a dialog shows up and the user has to provide the new name for the profile. The validity of the name is checked during input. If the name is valid and the users confirms the profile is renamed. Renaming the standard profile is not allowed.
--- .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 38 ++++++++++++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 2 ++ 2 files changed, 40 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java +38 -0
@@ -10,6 +10,8 @@ *******************************************************************************/ package org.yocto.sdk.ide; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT;
@@ -24,12 +26,15 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Listener; import org.yocto.sdk.ide.preferences.PreferenceConstants; +import org.yocto.sdk.ide.preferences.ProfileNameInputValidator; import org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage; public class YoctoProfileSetting { private static final String PROFILES_TITLE = "Preferences.Profiles.Title"; private static final String NEW_PROFILE_TITLE = "Preferences.Profile.New.Title"; private static final String RENAME_PROFILE_TITLE = "Preferences.Profile.Rename.Title"; + private static final String RENAME_DIALOG_TITLE = "Preferences.Profile.Rename.Dialog.Title"; + private static final String RENAME_DIALOG_MESSAGE = "Preferences.Profile.Rename.Dialog.Message"; private static final String REMOVE_PROFILE_TITLE = "Preferences.Profile.Remove.Title"; private static final String REMOVE_DIALOG_TITLE = "Preferences.Profile.Remove.Dialog.Title"; private static final String REMOVE_DIALOG_MESSAGE = "Preferences.Profile.Remove.Dialog.Message";
@@ -144,6 +149,39 @@ public class YoctoProfileSetting { private void createRenameButton(Group storeYoctoConfigurationsGroup) { btnConfigRename = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); btnConfigRename.setText(YoctoSDKMessages.getString(RENAME_PROFILE_TITLE)); + btnConfigRename.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + saveChangesOnCurrentProfile(); + int selectedIndex = sdkConfigsCombo.getSelectionIndex(); + final String selectedItem = sdkConfigsCombo.getItem(selectedIndex); + + if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { + MessageDialog.openInformation(null, + YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE), + YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE)); + return; + } + + InputDialog profileNameDialog = + new InputDialog(null, + YoctoSDKMessages.getString(RENAME_DIALOG_TITLE), + YoctoSDKMessages.getString(RENAME_DIALOG_MESSAGE), + null, + new ProfileNameInputValidator(profileElement, selectedItem)); + + int returnCode = profileNameDialog.open(); + if (returnCode == IDialogConstants.CANCEL_ID) { + return; + } + + String newProfileName = profileNameDialog.getValue(); + profileElement.rename(selectedItem, profileNameDialog.getValue()); + + sdkConfigsCombo.setItem(selectedIndex, newProfileName); + sdkConfigsCombo.select(selectedIndex); + } + }); } private void saveChangesOnCurrentProfile() {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +2 -0
@@ -56,6 +56,8 @@ Preferences.Profile.New.Title = Save as ... Preferences.Profile.New.Dialog.Title = Save as new target profile Preferences.Profile.New.Dialog.Message = Please input a profile name. Preferences.Profile.Rename.Title = Rename +Preferences.Profile.Rename.Dialog.Title = Rename target profile +Preferences.Profile.Rename.Dialog.Message = Please input a new profile name. Preferences.Profile.Remove.Title = Remove Preferences.Profile.Remove.Dialog.Title = Remove target profile Preferences.Profile.Remove.Dialog.Message = Do you really want to the remove the target profile "{0}"?
Signature · 1 line
1.7.11.7
RFC v4 13/17 plugins/sdk.ide: Add method to change values of the preference page
From: Timo Mueller <[email protected]>
When switching profile the values of the profile are retrieved from the preference store. The UI is updated using the retrieved values.
--- .../org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java | 4 ++++ 1 file changed, 4 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java +4 -0
@@ -88,6 +88,10 @@ public class YoctoProfileSetting { String selectedItem = sdkCombo.getItem(sdkCombo.getSelectionIndex()); profileElement.setSelectedProfile(selectedItem); + + if (preferencePage instanceof YoctoSDKPreferencePage) { + ((YoctoSDKPreferencePage) preferencePage).switchProfile(selectedItem); + } } };
Signature · 1 line
1.7.11.7
RFC v4 14/17 plugins/sdk.ide: Add method to rename a profile and its preference store
From: Timo Mueller <[email protected]>
When renaming a profile the current values are stored in the profile's new preference store.
--- .../org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java | 4 ++++ 1 file changed, 4 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java +4 -0
@@ -182,6 +182,10 @@ public class YoctoProfileSetting { String newProfileName = profileNameDialog.getValue(); profileElement.rename(selectedItem, profileNameDialog.getValue()); + if (preferencePage instanceof YoctoSDKPreferencePage) { + ((YoctoSDKPreferencePage) preferencePage).renameProfile(selectedItem, newProfileName); + } + sdkConfigsCombo.setItem(selectedIndex, newProfileName); sdkConfigsCombo.select(selectedIndex); }
Signature · 1 line
1.7.11.7
RFC v4 15/17 plugins/sdk.ide: Add method to delete a profile
From: Timo Mueller <[email protected]>
Deletion of a profile currently has no effects on the preference page.
--- .../org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java | 4 ++++ 1 file changed, 4 insertions(+)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java +4 -0
@@ -146,6 +146,10 @@ public class YoctoProfileSetting { sdkConfigsCombo.select(0); sdkConfigsCombo.remove(selectionIndex); profileElement.remove(selectedItem); + + if (preferencePage instanceof YoctoSDKPreferencePage) { + ((YoctoSDKPreferencePage) preferencePage).deleteProfile(selectedItem); + } } }); }
Signature · 1 line
1.7.11.7
RFC v4 16/17 plugins/sdk.ide: Use profiles for the preference page
From: Timo Mueller <[email protected]>
The preference page is now aware of profiles. By default the standard profile is used and the values are stored to its preference store. If a different profile is selected it's preferences store is used instead.
--- .../ide/preferences/YoctoSDKPreferencePage.java | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +22 -6
@@ -13,6 +13,7 @@ package org.yocto.sdk.ide.preferences; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite;
@@ -39,12 +40,24 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench public YoctoSDKPreferencePage() { //super(GRID); - setPreferenceStore(YoctoSDKPlugin.getDefault().getPreferenceStore()); - //setDescription(YoctoSDKMessages.getString(PREFERENCES_Yocto_CONFIG)); - YoctoUIElement elem = YoctoSDKUtils.getElemFromDefaultStore(); - this.yoctoUISetting = new YoctoUISetting(elem); + IPreferenceStore defaultStore = YoctoSDKPlugin.getDefault().getPreferenceStore(); + String profiles = defaultStore.getString(PreferenceConstants.PROFILES); + String selectedProfile = defaultStore.getString(PreferenceConstants.SELECTED_PROFILE); + + if (profiles.isEmpty()) { + profiles = defaultStore.getDefaultString(PreferenceConstants.PROFILES); + selectedProfile = defaultStore.getDefaultString(PreferenceConstants.SELECTED_PROFILE); + } + + setPreferenceStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)); + //setDescription(YoctoSDKMessages.getString(PREFERENCES_Yocto_CONFIG)); + YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(getPreferenceStore()); + this.yoctoUISetting = new YoctoUISetting(elem); + + YoctoProfileElement profileElement = new YoctoProfileElement(profiles, selectedProfile); + this.yoctoProfileSetting = new YoctoProfileSetting(profileElement, this); } - + /* * @see IWorkbenchPreferencePage#init(IWorkbench) */
@@ -75,7 +88,10 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true); YoctoUIElement elem = yoctoUISetting.getCurrentInput(); - YoctoSDKUtils.saveElemToDefaultStore(elem); + YoctoSDKUtils.saveElemToStore(elem, getPreferenceStore()); + + YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput(); + YoctoSDKUtils.saveProfilesToDefaultStore(profileElement); return super.performOk(); } catch (YoctoGeneralException e) {
Signature · 1 line
1.7.11.7
RFC v4 17/17 plugins/sdk.ide: Added profile UI to the preference page
From: Timo Mueller <[email protected]>
Adds the UI elements that allow managing profiles to the preference page.
--- .../src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +3 -1
@@ -67,7 +67,9 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench protected Control createContents(Composite parent) { initializeDialogUnits(parent); final Composite result= new Composite(parent, SWT.NONE); - + + yoctoProfileSetting.createComposite(result); + try { yoctoUISetting.createComposite(result); yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false);
Signature · 1 line
1.7.11.7
Everything looks good and merged to eclipse-poky master. Thanks for the contribution.
Cheers,
Jessica
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Friday, February 08, 2013 5:26 AM
To: [email protected]
Cc: Timo Mueller
Subject: [yocto] [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles
From: Timo Mueller <[email protected]>
Hi,
I removed the last patch that was moving the "Save as ..." button to the bottom. So now it is located beneath the dropdown box. I also changed the message in the profile deletion dialog to only ask if the user really wants to delete the profile.
From RFC v3:
<snip>
First of all I've fixed the issues with the patches (duplicate method, missing fix for NewYoctoCProjectTemplate.java).
I also changed the functionality of the "new" button according to Jessica's feedback. The logic is changed to a "Save as ..." approach. If the button is clicked the current values of the form are checked. If these are valid, the user can enter a name to store them as a new profile. </snip>
From the original cover letter:
<snip>
currently the yocto settings can be changed globally through eclipse's preferences or locally in the project properties. But the standard configuration stored in the global preferences sometimes changes, e.g. if a new version of the toolchain or the sysroot is released. If you change the global settings to the updated toolchain or sysroot your old working configuration is gone. If you want to reuse this configuration at a later point in time you have to (remember and) re-enter everthing. This patch set introduces the possiblity to store a configuration under a unique name, a so called target profile, and be able to select the default target profile that is used for new projects.
Building upon this change the target profiles could later also be used in the project settings and be able to quickly build and debug your software for different hard- and software combinations.
</snip>
Best regards,
Timo
Atanas Gegov (4):
plugins/sdk.ide: Extract labels to private members plugins/sdk.ide: Add method to enable and disable form plugins/sdk.ide: Set value of target array on input change plugins/sdk.ide: Create UI element for managing target profiles.
Timo Mueller (13):
plugins/sdk.ide: Removed unused message
plugins/sdk.ide: Changed method signature to be more consistent plugins/sdk.ide: Modified preferences storage to support profiles. plugins/sdk.ide: Set profile on selection change plugins/sdk.ide: Add method to allow storing the current settings plugins/sdk.ide: Add UI method to create a new profile plugins/sdk.ide: Add UI method to delete a profile plugins/sdk.ide: Add UI method to rename a profile plugins/sdk.ide: Add method to change values of the preference page plugins/sdk.ide: Add method to rename a profile and its preference
store
plugins/sdk.ide: Add method to delete a profile plugins/sdk.ide: Use profiles for the preference page plugins/sdk.ide: Added profile UI to the preference page
.../src/org/yocto/sdk/ide/YoctoProfileElement.java | 104 ++++++++++ .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 229 +++++++++++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 19 +- .../src/org/yocto/sdk/ide/YoctoSDKPlugin.java | 9 + .../org/yocto/sdk/ide/YoctoSDKProjectNature.java | 10 +- .../src/org/yocto/sdk/ide/YoctoSDKUtils.java | 62 ++++-- .../src/org/yocto/sdk/ide/YoctoUISetting.java | 60 +++++- .../sdk/ide/preferences/PreferenceConstants.java | 5 + .../sdk/ide/preferences/PreferenceInitializer.java | 22 +- .../ide/preferences/ProfileNameInputValidator.java | 63 ++++++ .../ide/preferences/YoctoSDKPreferencePage.java | 112 +++++++--- .../preferences/YoctoSDKProjectPropertyPage.java | 6 +- .../sdk/ide/wizard/NewYoctoCProjectTemplate.java | 7 +- 13 files changed, 643 insertions(+), 65 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java
--
1.7.11.7
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto