All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles
@ 2013-02-08 13:25 Timo Mueller
  2013-02-08 13:25 ` [RFC v4 01/17] plugins/sdk.ide: Removed unused message Timo Mueller
  2013-02-08 21:30 ` [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles Zhang, Jessica
  0 siblings, 2 replies; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:25 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

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



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [RFC v4 01/17] plugins/sdk.ide: Removed unused message
  2013-02-08 13:25 [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles Timo Mueller
@ 2013-02-08 13:25 ` Timo Mueller
  2013-02-08 13:25   ` [RFC v4 02/17] plugins/sdk.ide: Extract labels to private members Timo Mueller
  2013-02-08 21:30 ` [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles Zhang, Jessica
  1 sibling, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:25 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

The dialog has been merged with the project settings. Therefor the
message is no longer needed.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties  | 1 -
 1 file changed, 1 deletion(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
index b302524..17240e9 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
@@ -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. 
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 02/17] plugins/sdk.ide: Extract labels to private members
  2013-02-08 13:25 ` [RFC v4 01/17] plugins/sdk.ide: Removed unused message Timo Mueller
@ 2013-02-08 13:25   ` Timo Mueller
  2013-02-08 13:26     ` [RFC v4 03/17] plugins/sdk.ide: Add method to enable and disable form Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:25 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoUISetting.java              | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
index 0fbfde0..9ec0d85 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
@@ -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);
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 03/17] plugins/sdk.ide: Add method to enable and disable form
  2013-02-08 13:25   ` [RFC v4 02/17] plugins/sdk.ide: Extract labels to private members Timo Mueller
@ 2013-02-08 13:26     ` Timo Mueller
  2013-02-08 13:26       ` [RFC v4 04/17] plugins/sdk.ide: Set value of target array on input change Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
index 9ec0d85..2e3c830 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
@@ -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();
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 04/17] plugins/sdk.ide: Set value of target array on input change
  2013-02-08 13:26     ` [RFC v4 03/17] plugins/sdk.ide: Add method to enable and disable form Timo Mueller
@ 2013-02-08 13:26       ` Timo Mueller
  2013-02-08 13:26         ` [RFC v4 05/17] plugins/sdk.ide: Changed method signature to be more consistent Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

The value of the target array set in the constructor is now also
affected when the input of the element is changed.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
index 2e3c830..5bca41a 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java
@@ -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)){
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 05/17] plugins/sdk.ide: Changed method signature to be more consistent
  2013-02-08 13:26       ` [RFC v4 04/17] plugins/sdk.ide: Set value of target array on input change Timo Mueller
@ 2013-02-08 13:26         ` Timo Mueller
  2013-02-08 13:26           ` [RFC v4 06/17] plugins/sdk.ide: Create UI element for managing target profiles Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

YoctoUIElement should always be the first element, e.g. as in
saveElemToStore().

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 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(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
index 7ea4262..ab969ea 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
@@ -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;
 		
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
index 92d476a..f2247ca 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
@@ -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) {
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 06/17] plugins/sdk.ide: Create UI element for managing target profiles.
  2013-02-08 13:26         ` [RFC v4 05/17] plugins/sdk.ide: Changed method signature to be more consistent Timo Mueller
@ 2013-02-08 13:26           ` Timo Mueller
  2013-02-08 13:26             ` [RFC v4 07/17] plugins/sdk.ide: Modified preferences storage to support profiles Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Atanas Gegov <atanas.gegov@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../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

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java
new file mode 100644
index 0000000..02626ad
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java
@@ -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;
+	}
+}
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
new file mode 100644
index 0000000..7476bd3
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+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.Group;
+
+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 REMOVE_PROFILE_TITLE = "Preferences.Profile.Remove.Title";
+
+	private Combo sdkConfigsCombo;
+	private Button btnConfigRename;
+	private Button btnConfigRemove;
+	private Button btnConfigSaveAs;
+
+	private YoctoProfileElement profileElement;
+
+	public YoctoProfileSetting(YoctoProfileElement profileElement) {
+		this.profileElement = profileElement;
+	}
+
+	public void createComposite(Composite composite) {
+		GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+		GridLayout layout = new GridLayout(2, false);
+		composite.setLayout(layout);
+
+		Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE);
+		layout = new GridLayout(3, false);
+		storeYoctoConfigurationsGroup.setLayout(layout);
+		gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+		gd.horizontalSpan = 2;
+		storeYoctoConfigurationsGroup.setLayoutData(gd);
+		storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROFILES_TITLE));
+
+		sdkConfigsCombo = new Combo(storeYoctoConfigurationsGroup, SWT.READ_ONLY);
+		addConfigs(sdkConfigsCombo);
+		sdkConfigsCombo.select(sdkConfigsCombo.indexOf(profileElement.getSelectedProfile()));
+		sdkConfigsCombo.setLayout(new GridLayout(2, false));
+		sdkConfigsCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
+
+		createSaveAsProfileButton(storeYoctoConfigurationsGroup);
+		createRenameButton(storeYoctoConfigurationsGroup);
+		createRemoveButton(storeYoctoConfigurationsGroup);
+	}
+
+	private void createSaveAsProfileButton(Group storeYoctoConfigurationsGroup) {
+		btnConfigSaveAs = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD);
+		btnConfigSaveAs.setText(YoctoSDKMessages.getString(NEW_PROFILE_TITLE));
+	}
+
+	private void createRemoveButton(Group storeYoctoConfigurationsGroup) {
+		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));
+	}
+
+	private void createRenameButton(Group storeYoctoConfigurationsGroup) {
+		btnConfigRename = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD);
+		btnConfigRename.setText(YoctoSDKMessages.getString(RENAME_PROFILE_TITLE));
+	}
+
+	private void addConfigs(Combo combo) {
+		for (String profile : profileElement.getProfiles()) {
+			combo.add(profile);
+		}
+	}
+
+	public void setUIFormEnabledState(boolean isEnabled) {
+		setButtonsEnabledState(isEnabled);
+		sdkConfigsCombo.setEnabled(isEnabled);
+	}
+
+	public YoctoProfileElement getCurrentInput() {
+		return profileElement;
+	}
+
+	public void setButtonsEnabledState(boolean isEnabled) {
+		btnConfigRename.setEnabled(isEnabled);
+		btnConfigRemove.setEnabled(isEnabled);
+		btnConfigSaveAs.setEnabled(isEnabled);
+	}
+}
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
index 17240e9..7200741 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
@@ -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
 
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java
index cf79578..d6ca41f 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java
@@ -33,4 +33,5 @@ public class PreferenceConstants {
 		
 	public static final String IP_ADDR = "IPAddr";
 
+	public static final String STANDARD_PROFILE_NAME = "Standard Profile";
 }
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 07/17] plugins/sdk.ide: Modified preferences storage to support profiles.
  2013-02-08 13:26           ` [RFC v4 06/17] plugins/sdk.ide: Create UI element for managing target profiles Timo Mueller
@ 2013-02-08 13:26             ` Timo Mueller
  2013-02-08 13:26               ` [RFC v4 08/17] plugins/sdk.ide: Set profile on selection change Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../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(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java
index b0b5447..9777396 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java
@@ -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);
 	}
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
index ec49dcc..6f16732 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKProjectNature.java
@@ -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);
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
index ab969ea..12af7e3 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  * Intel - initial API and implementation
+ * BMW Car IT - add methods to use different preference stores
  *******************************************************************************/
 package org.yocto.sdk.ide;
 
@@ -16,7 +17,6 @@ import java.io.FileReader;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.io.InputStreamReader;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -38,6 +38,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoSDKUtils {
+
 	public static enum SDKCheckResults {
 		SDK_PASS,
 		POKY_DEVICE_EMPTY,
@@ -396,7 +397,7 @@ public class YoctoSDKUtils {
 
 	}
 
-	/* Load project wide POKY Preference settings into YoctoUIElement */
+	/* Get POKY Preference settings from project's environment */
 	public static YoctoUIElement getElemFromProjectEnv(IProject project)
 	{
 		YoctoUIElement elem = new YoctoUIElement();
@@ -422,7 +423,7 @@ public class YoctoSDKUtils {
 		return elem;
 	}
 	
-	/* Save YoctoUIElement to project settings */
+	/* Save POKY Preference settings to project's environment */
 	public static void saveElemToProjectEnv(YoctoUIElement elem, IProject project)
 	{
 		ConsoleOutputStream consoleOutStream = null;
@@ -461,11 +462,15 @@ public class YoctoSDKUtils {
 		}
 	}
 
-	/* Load IDE wide POKY Preference settings into Preference Store */
-	public static void saveElemToStore(YoctoUIElement elem)
+	/* Save IDE wide POKY Preference settings to the default preference store */
+	public static void saveElemToDefaultStore(YoctoUIElement elem)
 	{
-		IPreferenceStore store= YoctoSDKPlugin.getDefault().getPreferenceStore();
+		saveElemToStore(elem, YoctoSDKPlugin.getDefault().getPreferenceStore());
+	}
 
+	/* Save IDE wide POKY Preference settings to a specific preference store */
+	public static void saveElemToStore(YoctoUIElement elem, IPreferenceStore store)
+	{
 		store.setValue(PreferenceConstants.TARGET_ARCH_INDEX, elem.getIntTargetIndex());
 		if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE)
 			store.setValue(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE);
@@ -482,10 +487,14 @@ public class YoctoSDKUtils {
 		store.setValue(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget());		
 	}
 
-	/* Load IDE wide POKY Preference settings into YoctoUIElement */
-	public static YoctoUIElement getElemFromStore()
+	/* Get IDE wide POKY Preference settings from the default preference store */
+	public static YoctoUIElement getElemFromDefaultStore()
 	{
-		IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore();
+		return getElemFromStore(YoctoSDKPlugin.getDefault().getPreferenceStore());
+	}
+
+	/* Get IDE wide POKY Preference settings from a specific preference store */
+	public static YoctoUIElement getElemFromStore(IPreferenceStore store) {
 		YoctoUIElement elem = new YoctoUIElement();
 		if (store.getString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE))
 			elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
@@ -507,8 +516,8 @@ public class YoctoSDKUtils {
 		return elem;
 	}
 
-	/* Load default IDE wide POKY Preference settings into YoctoUIElement */
-	public static YoctoUIElement getDefaultElemFromStore()
+	/* Get default POKY Preference settings from the default preference store */
+	public static YoctoUIElement getDefaultElemFromDefaultStore()
 	{
 		IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore();
 		YoctoUIElement elem = new YoctoUIElement();
@@ -674,4 +683,31 @@ public class YoctoSDKUtils {
         }
 		return arch;
 	}
-}
\ No newline at end of file
+
+	/* Save profiles and selected profile to the default preference store */
+	public static void saveProfilesToDefaultStore(YoctoProfileElement profileElement) {
+		saveProfilesToStore(profileElement, YoctoSDKPlugin.getDefault().getPreferenceStore());
+	}
+
+	/* Save profiles and selected profile to a specific preference store */
+	public static void saveProfilesToStore(YoctoProfileElement profileElement, IPreferenceStore store)
+	{
+		store.setValue(PreferenceConstants.PROFILES, profileElement.getProfilesAsString());
+		store.setValue(PreferenceConstants.SELECTED_PROFILE, profileElement.getSelectedProfile());
+	}
+
+	/* Get profiles and selected profile from the default preference store */
+	public static YoctoProfileElement getProfilesFromDefaultStore()
+	{
+		return getProfilesFromStore(YoctoSDKPlugin.getDefault().getPreferenceStore());
+	}
+
+	/* Get profiles and selected profile from a specific preference store */
+	public static YoctoProfileElement getProfilesFromStore(IPreferenceStore store)
+	{
+		String profiles = store.getString(PreferenceConstants.PROFILES);
+		String selectedProfile = store.getString(PreferenceConstants.SELECTED_PROFILE);
+
+		return new YoctoProfileElement(profiles, selectedProfile);
+	}
+}
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java
index d6ca41f..814397a 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java
@@ -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";
 }
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java
index 33c7117..40f37d0 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java
@@ -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);
 	}
 
 }
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
index d1c1a72..64c9968 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
@@ -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();
 	}
-
-
 }
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
index f2247ca..56cc4cb 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java
@@ -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();
 	}
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
index ec241aa..7c02f87 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoCProjectTemplate.java
@@ -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);
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 08/17] plugins/sdk.ide: Set profile on selection change
  2013-02-08 13:26             ` [RFC v4 07/17] plugins/sdk.ide: Modified preferences storage to support profiles Timo Mueller
@ 2013-02-08 13:26               ` Timo Mueller
  2013-02-08 13:26                 ` [RFC v4 09/17] plugins/sdk.ide: Add method to allow storing the current settings Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@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@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



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 09/17] plugins/sdk.ide: Add method to allow storing the current settings
  2013-02-08 13:26               ` [RFC v4 08/17] plugins/sdk.ide: Set profile on selection change Timo Mueller
@ 2013-02-08 13:26                 ` Timo Mueller
  2013-02-08 13:26                   ` [RFC v4 10/17] plugins/sdk.ide: Add UI method to create a new profile Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoProfileSetting.java               | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 b35a167..7949cdf 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
@@ -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);
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 10/17] plugins/sdk.ide: Add UI method to create a new profile
  2013-02-08 13:26                 ` [RFC v4 09/17] plugins/sdk.ide: Add method to allow storing the current settings Timo Mueller
@ 2013-02-08 13:26                   ` Timo Mueller
  2013-02-08 13:26                     ` [RFC v4 11/17] plugins/sdk.ide: Add UI method to delete a profile Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../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

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 7949cdf..633eb67 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
@@ -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);
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
index 7200741..14b7846 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
@@ -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
 
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java
new file mode 100644
index 0000000..38e38b1
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.preferences;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.yocto.sdk.ide.YoctoProfileElement;
+import org.yocto.sdk.ide.YoctoSDKMessages;
+
+public class ProfileNameInputValidator implements IInputValidator {
+	private static final String WARNING_CONTAINS_COMMA = "Preferences.Profile.Validator.InvalidName.Comma";
+	private static final String WARNING_CONTAINS_DOUBLEQUOTE = "Preferences.Profile.Validator.InvalidName.Quote";
+	private static final String PROFILE_NAME_IS_EMPTY = "Preferences.Profile.Validator.InvalidName.Empty";
+	private static final String WARNING_ALREADY_EXISTS = "Preferences.Profile.Validator.InvalidName.Exists";
+
+	private final String selectedItem;
+	private final YoctoProfileElement profileSetting;
+
+	public ProfileNameInputValidator(YoctoProfileElement profileSetting) {
+		this(profileSetting, "");
+	}
+
+	public ProfileNameInputValidator(YoctoProfileElement profileSetting, String selectedItem) {
+		this.selectedItem = selectedItem;
+		this.profileSetting = profileSetting;
+	}
+
+	@Override
+	public String isValid(String newText) {
+		if (newText.contains(",")) {
+			return YoctoSDKMessages.getString(WARNING_CONTAINS_COMMA);
+		}
+
+		if (newText.contains("\"")) {
+			return YoctoSDKMessages.getString(WARNING_CONTAINS_DOUBLEQUOTE);
+		}
+
+		if (newText.isEmpty()) {
+			return YoctoSDKMessages.getString(PROFILE_NAME_IS_EMPTY);
+		}
+
+		if (selectedItemEquals(newText)) {
+			return null;
+		}
+
+		if (profileSetting.contains(newText)) {
+			return YoctoSDKMessages.getString(WARNING_ALREADY_EXISTS);
+		}
+
+		return null;
+	}
+
+	private boolean selectedItemEquals(String newText) {
+		return !selectedItem.isEmpty() && newText.equals(selectedItem);
+	}
+}
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
index 64c9968..276e366 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
@@ -11,6 +11,8 @@
 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.PreferencePage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
@@ -18,6 +20,9 @@ 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.YoctoProfileElement;
+import org.yocto.sdk.ide.YoctoProfileSetting;
+import org.yocto.sdk.ide.YoctoSDKMessages;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoSDKUtils.SDKCheckRequestFrom;
@@ -25,7 +30,11 @@ import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.YoctoUISetting;
 
 public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-    
+
+	private static final String NEW_DIALOG_TITLE = "Preferences.Profile.New.Dialog.Title";
+	private static final String NEW_DIALOG_MESSAGE = "Preferences.Profile.New.Dialog.Message";
+
+	private YoctoProfileSetting yoctoProfileSetting;
 	private YoctoUISetting yoctoUISetting;
 
 	public YoctoSDKPreferencePage() {
@@ -84,4 +93,49 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 		yoctoUISetting.setCurrentInput(defaultElement);
 		super.performDefaults();
 	}
+
+	public void performSaveAs() {
+		YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput();
+		YoctoUIElement uiElement = yoctoUISetting.getCurrentInput();
+
+		try {
+			yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true);
+		} catch (YoctoGeneralException e) {
+			// just abort saving, validateInput will show an error dialog
+			return;
+		}
+
+		InputDialog profileNameDialog =
+							new InputDialog(null,
+											YoctoSDKMessages.getString(NEW_DIALOG_TITLE),
+											YoctoSDKMessages.getString(NEW_DIALOG_MESSAGE),
+											null,
+											new ProfileNameInputValidator(profileElement));
+
+		int returnCode = profileNameDialog.open();
+		if (returnCode == IDialogConstants.CANCEL_ID) {
+			return;
+		}
+
+		profileElement.addProfile(profileNameDialog.getValue());
+		yoctoProfileSetting.addProfile(profileNameDialog.getValue());
+
+		yoctoUISetting.setCurrentInput(uiElement);
+		performOk();
+	}
+
+	public void switchProfile(String selectedProfile) {
+		setPreferenceStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile));
+		YoctoUIElement profileElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore());
+		yoctoUISetting.setCurrentInput(profileElement);
+	}
+
+	public void renameProfile(String oldProfileName, String newProfileName) {
+		YoctoUIElement oldProfileElement = YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(oldProfileName));
+		YoctoSDKUtils.saveElemToStore(oldProfileElement, YoctoSDKPlugin.getProfilePreferenceStore(newProfileName));
+	}
+
+	public void deleteProfile(String selectedProfile) {
+		// do nothing
+	}
 }
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 11/17] plugins/sdk.ide: Add UI method to delete a profile
  2013-02-08 13:26                   ` [RFC v4 10/17] plugins/sdk.ide: Add UI method to create a new profile Timo Mueller
@ 2013-02-08 13:26                     ` Timo Mueller
  2013-02-08 13:26                       ` [RFC v4 12/17] plugins/sdk.ide: Add UI method to rename " Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 34 ++++++++++++++++++++++
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |  4 +++
 2 files changed, 38 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 633eb67..aa6f4b2 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
@@ -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) {
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
index 14b7846..1788968 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
@@ -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
 
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 12/17] plugins/sdk.ide: Add UI method to rename a profile
  2013-02-08 13:26                     ` [RFC v4 11/17] plugins/sdk.ide: Add UI method to delete a profile Timo Mueller
@ 2013-02-08 13:26                       ` Timo Mueller
  2013-02-08 13:26                         ` [RFC v4 13/17] plugins/sdk.ide: Add method to change values of the preference page Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/YoctoProfileSetting.java | 38 ++++++++++++++++++++++
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |  2 ++
 2 files changed, 40 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 aa6f4b2..077dc28 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
@@ -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() {
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
index 1788968..f631112 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties
@@ -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}"?
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 13/17] plugins/sdk.ide: Add method to change values of the preference page
  2013-02-08 13:26                       ` [RFC v4 12/17] plugins/sdk.ide: Add UI method to rename " Timo Mueller
@ 2013-02-08 13:26                         ` Timo Mueller
  2013-02-08 13:26                           ` [RFC v4 14/17] plugins/sdk.ide: Add method to rename a profile and its preference store Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

When switching profile the values of the profile are retrieved from
the preference store. The UI is updated using the retrieved values.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java  | 4 ++++
 1 file changed, 4 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 077dc28..105fd9c 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
@@ -88,6 +88,10 @@ public class YoctoProfileSetting {
 
 				String selectedItem = sdkCombo.getItem(sdkCombo.getSelectionIndex());
 				profileElement.setSelectedProfile(selectedItem);
+
+				if (preferencePage instanceof YoctoSDKPreferencePage) {
+					((YoctoSDKPreferencePage) preferencePage).switchProfile(selectedItem);
+				}
 			}
 		};
 
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 14/17] plugins/sdk.ide: Add method to rename a profile and its preference store
  2013-02-08 13:26                         ` [RFC v4 13/17] plugins/sdk.ide: Add method to change values of the preference page Timo Mueller
@ 2013-02-08 13:26                           ` Timo Mueller
  2013-02-08 13:26                             ` [RFC v4 15/17] plugins/sdk.ide: Add method to delete a profile Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

When renaming a profile the current values are stored in the profile's
new preference store.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java  | 4 ++++
 1 file changed, 4 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 105fd9c..2767d7a 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
@@ -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);
 			}
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 15/17] plugins/sdk.ide: Add method to delete a profile
  2013-02-08 13:26                           ` [RFC v4 14/17] plugins/sdk.ide: Add method to rename a profile and its preference store Timo Mueller
@ 2013-02-08 13:26                             ` Timo Mueller
  2013-02-08 13:26                               ` [RFC v4 16/17] plugins/sdk.ide: Use profiles for the preference page Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

Deletion of a profile currently has no effects on the preference
page.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java  | 4 ++++
 1 file changed, 4 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 2767d7a..738dba7 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
@@ -146,6 +146,10 @@ public class YoctoProfileSetting {
 				sdkConfigsCombo.select(0);
 				sdkConfigsCombo.remove(selectionIndex);
 				profileElement.remove(selectedItem);
+
+				if (preferencePage instanceof YoctoSDKPreferencePage) {
+					((YoctoSDKPreferencePage) preferencePage).deleteProfile(selectedItem);
+				}
 			}
 		});
 	}
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 16/17] plugins/sdk.ide: Use profiles for the preference page
  2013-02-08 13:26                             ` [RFC v4 15/17] plugins/sdk.ide: Add method to delete a profile Timo Mueller
@ 2013-02-08 13:26                               ` Timo Mueller
  2013-02-08 13:26                                 ` [RFC v4 17/17] plugins/sdk.ide: Added profile UI to " Timo Mueller
  0 siblings, 1 reply; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

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.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../ide/preferences/YoctoSDKPreferencePage.java    | 28 +++++++++++++++++-----
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
index 276e366..8dc089b 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
@@ -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) {
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [RFC v4 17/17] plugins/sdk.ide: Added profile UI to the preference page
  2013-02-08 13:26                               ` [RFC v4 16/17] plugins/sdk.ide: Use profiles for the preference page Timo Mueller
@ 2013-02-08 13:26                                 ` Timo Mueller
  0 siblings, 0 replies; 19+ messages in thread
From: Timo Mueller @ 2013-02-08 13:26 UTC (permalink / raw)
  To: yocto; +Cc: Timo Mueller

From: Timo Mueller <timo.mueller@bmw-carit.de>

Adds the UI elements that allow managing profiles to the preference
page.

Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
---
 .../src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
index 8dc089b..fb015ab 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java
@@ -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);
-- 
1.7.11.7



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles
  2013-02-08 13:25 [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles Timo Mueller
  2013-02-08 13:25 ` [RFC v4 01/17] plugins/sdk.ide: Removed unused message Timo Mueller
@ 2013-02-08 21:30 ` Zhang, Jessica
  1 sibling, 0 replies; 19+ messages in thread
From: Zhang, Jessica @ 2013-02-08 21:30 UTC (permalink / raw)
  To: Timo Mueller, yocto; +Cc: Timo Mueller

Everything looks good and merged to eclipse-poky master. Thanks for the contribution.

Cheers,
Jessica

-----Original Message-----
From: yocto-bounces@yoctoproject.org [mailto:yocto-bounces@yoctoproject.org] On Behalf Of Timo Mueller
Sent: Friday, February 08, 2013 5:26 AM
To: yocto@yoctoproject.org
Cc: Timo Mueller
Subject: [yocto] [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles

From: Timo Mueller <timo.mueller@bmw-carit.de>

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
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2013-02-08 21:30 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08 13:25 [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles Timo Mueller
2013-02-08 13:25 ` [RFC v4 01/17] plugins/sdk.ide: Removed unused message Timo Mueller
2013-02-08 13:25   ` [RFC v4 02/17] plugins/sdk.ide: Extract labels to private members Timo Mueller
2013-02-08 13:26     ` [RFC v4 03/17] plugins/sdk.ide: Add method to enable and disable form Timo Mueller
2013-02-08 13:26       ` [RFC v4 04/17] plugins/sdk.ide: Set value of target array on input change Timo Mueller
2013-02-08 13:26         ` [RFC v4 05/17] plugins/sdk.ide: Changed method signature to be more consistent Timo Mueller
2013-02-08 13:26           ` [RFC v4 06/17] plugins/sdk.ide: Create UI element for managing target profiles Timo Mueller
2013-02-08 13:26             ` [RFC v4 07/17] plugins/sdk.ide: Modified preferences storage to support profiles Timo Mueller
2013-02-08 13:26               ` [RFC v4 08/17] plugins/sdk.ide: Set profile on selection change Timo Mueller
2013-02-08 13:26                 ` [RFC v4 09/17] plugins/sdk.ide: Add method to allow storing the current settings Timo Mueller
2013-02-08 13:26                   ` [RFC v4 10/17] plugins/sdk.ide: Add UI method to create a new profile Timo Mueller
2013-02-08 13:26                     ` [RFC v4 11/17] plugins/sdk.ide: Add UI method to delete a profile Timo Mueller
2013-02-08 13:26                       ` [RFC v4 12/17] plugins/sdk.ide: Add UI method to rename " Timo Mueller
2013-02-08 13:26                         ` [RFC v4 13/17] plugins/sdk.ide: Add method to change values of the preference page Timo Mueller
2013-02-08 13:26                           ` [RFC v4 14/17] plugins/sdk.ide: Add method to rename a profile and its preference store Timo Mueller
2013-02-08 13:26                             ` [RFC v4 15/17] plugins/sdk.ide: Add method to delete a profile Timo Mueller
2013-02-08 13:26                               ` [RFC v4 16/17] plugins/sdk.ide: Use profiles for the preference page Timo Mueller
2013-02-08 13:26                                 ` [RFC v4 17/17] plugins/sdk.ide: Added profile UI to " Timo Mueller
2013-02-08 21:30 ` [RFC v4 00/17][eclipse-poky] Storing yocto settings as target profiles Zhang, Jessica

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.