Skip to contentSkip to conversation

Add target profile quick switch

PATCH Superseded Timo Mueller 2 participants 11 messages Jun 13, 2013 – Jun 18, 2013

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Add target profile quick switch

From: Timo Mueller <[email protected]>

Hi,

if a user wants to change the used target profile of a project he currently has to open the project preferences. This can be tedious if he has to switch the profile often.

This is a small addition which allows the user to quickly switch the used target profile of a project. Instead of having to open the project preferences the user can select the project in the navigator and then choose the desired target profile from a drop-down menu in the toolbar or from the project menu.

01: Small i18n fix
02..04: Refactoring the project specific utils 05..06: Introduce the target profile toolbar switch 07: Adds the target profile switch to the project menu

Best regards,
Timo

Timo Mueller (7):
plugins/sdk.ide: Use an internationalized dialog title plugins/sdk.ide: Extract project specific util methods plugins/sdk.ide: Move project specific util methods plugins/sdk.ide: Remove project context from method names plugins/sdk.ide: Add command to switch the target profile plugins/sdk.ide: Add profile switch menu to the toolbar plugins/sdk.ide: Add profile switch menu to the project menu

 .../OSGI-INF/l10n/bundle.properties                |   5 +
 plugins/org.yocto.sdk.ide/plugin.xml               | 105 +++++++++
 .../sdk/ide/TargetProfileContributionItem.java     | 121 +++++++++++
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |   3 +
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |   3 +-
 .../sdk/ide/actions/ProfileSwitchHandler.java      | 154 +++++++++++++
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   3 +-
 .../ide/preferences/YoctoSDKPreferencePage.java    |  11 +-
 .../preferences/YoctoSDKProjectPropertyPage.java   | 130 ++---------
 .../sdk/ide/utils/ProjectPreferenceUtils.java      | 240 +++++++++++++++++++++
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 118 ----------
 .../ide/wizard/NewYoctoProjectTemplateProcess.java |   3 +-
 12 files changed, 651 insertions(+), 245 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/7 plugins/sdk.ide: Use an internationalized dialog title

From: Timo Mueller <[email protected]>

---
 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java +1 -2
index e5a7897..d192538 100644
@@ -42,7 +42,6 @@ import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
 
 public class YoctoUISetting {
-
 	private static final String ENV_SCRIPT_FILE_PREFIX = "environment-setup-";
 
 	private SelectionListener fSelectionListener;
@@ -375,7 +374,7 @@ public class YoctoUISetting {
 		if ((result != SDKCheckResults.SDK_PASS) && showErrorDialog) {
 			Display display = Display.getCurrent();
 			ErrorDialog.openError(display.getActiveShell(),
-									"Yocto Project Configuration Error",
+									YoctoSDKChecker.SDKCheckRequestFrom.Other.getErrorMessage(),
 									YoctoSDKChecker.getErrorMessage(result, from),
 									new Status(Status.ERROR, YoctoSDKPlugin.PLUGIN_ID, result.getMessage()));
 
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 2/7 plugins/sdk.ide: Extract project specific util methods

From: Timo Mueller <[email protected]>

Project specific util methods are moved to a separate util class. This way the general util class will get more concise and other project specific methods can be move to this new util class later.

---
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   3 +-
 .../ide/preferences/YoctoSDKPreferencePage.java    |  11 +-
 .../preferences/YoctoSDKProjectPropertyPage.java   |  13 +-
 .../sdk/ide/utils/ProjectPreferenceUtils.java      | 138 +++++++++++++++++++++
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 118 ------------------
 .../ide/wizard/NewYoctoProjectTemplateProcess.java |   3 +-
 6 files changed, 155 insertions(+), 131 deletions(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java +2 -1
index fb53c53..ce80d77 100644
@@ -18,6 +18,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoUIElement;
+import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
 public class YoctoSDKAutotoolsProjectNature extends YoctoSDKProjectNature {
@@ -35,7 +36,7 @@ public class YoctoSDKAutotoolsProjectNature extends YoctoSDKProjectNature {
 	public static void configureAutotoolsOptions(IProject project) {
 		IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
 		IConfiguration icfg = info.getDefaultConfiguration();
-		YoctoUIElement elem = YoctoSDKUtils.getElemFromProjectEnv(project);
+		YoctoUIElement elem = ProjectPreferenceUtils.getElemFromProjectEnv(project);
 		String sysroot_str = elem.getStrSysrootLoc();
 		String id = icfg.getId();
 		String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS");
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +6 -5
index 211c4f9..e8123e2 100644
@@ -34,6 +34,7 @@ import org.yocto.sdk.ide.YoctoProfileSetting;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
+import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 import org.yocto.sdk.ide.YoctoSDKMessages;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
@@ -240,10 +241,10 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 
 		for (IProject project : yoctoProjects)
 		{
-			YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
+			ProjectPreferenceUtils.saveProfilesToProjectPreferences(profileElement, project);
 			YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(
 											YoctoSDKPlugin.getProfilePreferenceStore(PreferenceConstants.STANDARD_PROFILE_NAME));
-			YoctoSDKUtils.saveElemToProjectEnv(elem, project);
+			ProjectPreferenceUtils.saveElemToProjectEnv(elem, project);
 		}
 	}
 
@@ -254,14 +255,14 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 
 		for (IProject project : yoctoProjects)
 		{
-			YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
+			ProjectPreferenceUtils.saveProfilesToProjectPreferences(profileElement, project);
 		}
 	}
 
 	private void updateProjects(HashSet<IProject> yoctoProjects, YoctoUIElement elem) {
 		for (IProject project : yoctoProjects)
 		{
-			YoctoSDKUtils.saveElemToProjectEnv(elem, project);
+			ProjectPreferenceUtils.saveElemToProjectEnv(elem, project);
 		}
 	}
 
@@ -295,7 +296,7 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 
 	private boolean projectUsesProfile(IProject project, String profile)
 	{
-		YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromProjectPreferences(project);
+		YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfilesFromProjectPreferences(project);
 
 		if (!profileElement.getSelectedProfile().equals(profile)) {
 			return false;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java +7 -6
index 9f99caf..f075c5b 100644
@@ -34,6 +34,7 @@ import org.yocto.sdk.ide.YoctoProjectSpecificSetting;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.YoctoSDKMessages;
+import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
@@ -69,7 +70,7 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 		IProject project = getProject();
 
 		YoctoProfileElement globalProfileElement= YoctoSDKUtils.getProfilesFromDefaultStore();
-		YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromProjectPreferences(project);
+		YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfilesFromProjectPreferences(project);
 
 		String selectedProfile = profileElement.getSelectedProfile();
 		if (!globalProfileElement.contains(selectedProfile)) {
@@ -160,14 +161,14 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 			}
 
 			saveUseProjectSpecificOptionToProjectPreferences(project, true);
-			YoctoSDKUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
+			ProjectPreferenceUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
 			saveElemToProjectPreferences(yoctoUISetting.getCurrentInput(), project);
 		} else {
 			saveUseProjectSpecificOptionToProjectPreferences(project, false);
-			YoctoSDKUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
+			ProjectPreferenceUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
 		}
 
-		YoctoSDKUtils.saveElemToProjectEnv(yoctoUISetting.getCurrentInput(), getProject());
+		ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUISetting.getCurrentInput(), getProject());
 
 		return super.performOk();
 	}
@@ -245,7 +246,7 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 		IScopeContext projectScope = new ProjectScope(project);
 		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
 		if (projectNode == null) {
-			return YoctoSDKUtils.getElemFromProjectEnv(project);
+			return ProjectPreferenceUtils.getElemFromProjectEnv(project);
 		}
 
 		YoctoUIElement elem = new YoctoUIElement();
@@ -287,7 +288,7 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 
 	public void switchToProjectSpecificProfile()
 	{
-		YoctoUIElement profileElement = getElemFromProjectPreferences(getProject());
+		YoctoUIElement profileElement = ProjectPreferenceUtils.getElemFromProjectEnv(getProject());
 		yoctoUISetting.setCurrentInput(profileElement);
 	}
 
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java new file +138 -0

138 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +0 -118

166 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java +2 -1
index 3ea7e33..f64043d 100644
@@ -60,6 +60,7 @@ import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature;
 import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature;
 import org.yocto.sdk.ide.natures.YoctoSDKNatureUtils;
 import org.yocto.sdk.ide.natures.YoctoSDKProjectNature;
+import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
 @SuppressWarnings("restriction")
@@ -205,7 +206,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner {
 		YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
 
 		YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
-		YoctoSDKUtils.saveProfilesToProjectPreferences(profileElement, project);
+		ProjectPreferenceUtils.saveProfilesToProjectPreferences(profileElement, project);
 
 		IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
 		YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
Signature · 1 line
1.8.1.4
#3 lore raw

PATCH 3/7 plugins/sdk.ide: Move project specific util methods

From: Timo Mueller <[email protected]>

Move project specific methods to the new util class to allow public usage of theses methods.

---
 .../preferences/YoctoSDKProjectPropertyPage.java   | 121 ++-------------------
 .../sdk/ide/utils/ProjectPreferenceUtils.java      | 102 +++++++++++++++++
 2 files changed, 109 insertions(+), 114 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java +7 -114
index f075c5b..1f82fe1 100644
@@ -13,12 +13,8 @@
 package org.yocto.sdk.ide.preferences;
 
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ProjectScope;
 import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
 import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
@@ -27,19 +23,17 @@ import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.ui.IWorkbenchPropertyPage;
 import org.eclipse.ui.dialogs.PropertyPage;
-import org.osgi.service.prefs.BackingStoreException;
 import org.yocto.sdk.ide.YoctoProfileElement;
 import org.yocto.sdk.ide.YoctoProfileSetting;
 import org.yocto.sdk.ide.YoctoProjectSpecificSetting;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
 import org.yocto.sdk.ide.YoctoSDKMessages;
-import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
-import org.yocto.sdk.ide.utils.YoctoSDKUtils;
-import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.YoctoUISetting;
+import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
+import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
 public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 		IWorkbenchPropertyPage {
@@ -79,10 +73,10 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 
 		yoctoProfileSetting = new YoctoProfileSetting(
 				new YoctoProfileElement(globalProfileElement.getProfilesAsString(), selectedProfile), this, false);
-		boolean useProjectSpecificSetting = getUseProjectSpecificOptionFromProjectPreferences(project);
+		boolean useProjectSpecificSetting = ProjectPreferenceUtils.getUseProjectSpecificOptionFromProjectPreferences(project);
 
 		if (useProjectSpecificSetting) {
-			yoctoUISetting = new YoctoUISetting(getElemFromProjectPreferences(project));
+			yoctoUISetting = new YoctoUISetting(ProjectPreferenceUtils.getElemFromProjectPreferences(project));
 		} else {
 			yoctoUISetting = new YoctoUISetting(YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)));
 		}
@@ -160,11 +154,11 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 				return false;
 			}
 
-			saveUseProjectSpecificOptionToProjectPreferences(project, true);
+			ProjectPreferenceUtils.saveUseProjectSpecificOptionToProjectPreferences(project, true);
 			ProjectPreferenceUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
-			saveElemToProjectPreferences(yoctoUISetting.getCurrentInput(), project);
+			ProjectPreferenceUtils.saveElemToProjectPreferences(yoctoUISetting.getCurrentInput(), project);
 		} else {
-			saveUseProjectSpecificOptionToProjectPreferences(project, false);
+			ProjectPreferenceUtils.saveUseProjectSpecificOptionToProjectPreferences(project, false);
 			ProjectPreferenceUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
 		}
 
@@ -173,107 +167,6 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 		return super.performOk();
 	}
 
-	private void saveUseProjectSpecificOptionToProjectPreferences(IProject project, boolean useProjectSpecificSetting) {
-		IScopeContext projectScope = new ProjectScope(project);
-		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
-		if (projectNode == null) {
-			return;
-		}
-
-		if (useProjectSpecificSetting) {
-			projectNode.put(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.TRUE);
-		} else {
-			projectNode.put(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.FALSE);
-		}
-
-		try {
-			projectNode.flush();
-		} catch (BackingStoreException e) {
-			e.printStackTrace();
-		}
-	}
-
-	private boolean getUseProjectSpecificOptionFromProjectPreferences(IProject project) {
-		IScopeContext projectScope = new ProjectScope(project);
-		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
-		if (projectNode == null) {
-			return false;
-		}
-
-		String useProjectSpecificSettingString = projectNode.get(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.FALSE);
-
-		if (useProjectSpecificSettingString.equals(IPreferenceStore.FALSE)) {
-			return false;
-		}
-		return true;
-	}
-
-	/* Save POKY Preference settings to project's preference store */
-	private void saveElemToProjectPreferences(YoctoUIElement elem, IProject project) {
-		IScopeContext projectScope = new ProjectScope(project);
-		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
-		if (projectNode == null) {
-			return;
-		}
-
-		projectNode.putInt(PreferenceConstants.TARGET_ARCH_INDEX, elem.getIntTargetIndex());
-		if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) {
-			projectNode.put(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE);
-		} else {
-			projectNode.put(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE);
-		}
-		projectNode.put(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc());
-		projectNode.put(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption());
-		projectNode.put(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc());
-
-		if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) {
-			projectNode.put(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE);
-		} else {
-			projectNode.put(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE);
-		}
-		projectNode.put(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot());
-		projectNode.put(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget());
-
-		try {
-			projectNode.flush();
-		} catch (BackingStoreException e) {
-			e.printStackTrace();
-		}
-	}
-
-	/* Get POKY Preference settings from project's preference store */
-	private YoctoUIElement getElemFromProjectPreferences(IProject project) {
-		IScopeContext projectScope = new ProjectScope(project);
-		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
-		if (projectNode == null) {
-			return ProjectPreferenceUtils.getElemFromProjectEnv(project);
-		}
-
-		YoctoUIElement elem = new YoctoUIElement();
-		elem.setStrToolChainRoot(projectNode.get(PreferenceConstants.TOOLCHAIN_ROOT,""));
-		elem.setStrTarget(projectNode.get(PreferenceConstants.TOOLCHAIN_TRIPLET,""));
-		elem.setStrQemuKernelLoc(projectNode.get(PreferenceConstants.QEMU_KERNEL,""));
-		elem.setStrSysrootLoc(projectNode.get(PreferenceConstants.SYSROOT,""));
-		elem.setStrQemuOption(projectNode.get(PreferenceConstants.QEMU_OPTION,""));
-		String sTemp = projectNode.get(PreferenceConstants.TARGET_ARCH_INDEX,"");
-		if (!sTemp.isEmpty()) {
-			elem.setIntTargetIndex(Integer.valueOf(sTemp).intValue());
-		}
-
-		if (projectNode.get(PreferenceConstants.SDK_MODE,"").equalsIgnoreCase(IPreferenceStore.TRUE)) {
-			elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE);
-		} else {
-			elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE);
-		}
-
-		if(projectNode.get(PreferenceConstants.TARGET_MODE,"").equalsIgnoreCase(IPreferenceStore.TRUE)) {
-			elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE);
-		} else {
-			elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE);
-		}
-		return elem;
-	}
-
 	private void clearMessages() {
 		setErrorMessage(null);
 		setMessage(null);
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java +102 -0

118 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#4 lore raw

PATCH 4/7 plugins/sdk.ide: Remove project context from method names

From: Timo Mueller <[email protected]>

Through the context of the ProjectPreferenceUtil class we can infer that all methods act on project preferences. Having this context information duplicated in the method name is not needed anymore and can be removed to get a cleaner API.

---
 .../sdk/ide/preferences/YoctoSDKPreferencePage.java      |  6 +++---
 .../sdk/ide/preferences/YoctoSDKProjectPropertyPage.java | 16 ++++++++--------
 .../org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java  | 12 ++++++------
 .../sdk/ide/wizard/NewYoctoProjectTemplateProcess.java   |  2 +-
 4 files changed, 18 insertions(+), 18 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java +3 -3
index e8123e2..4e6ca2a 100644
@@ -241,7 +241,7 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 
 		for (IProject project : yoctoProjects)
 		{
-			ProjectPreferenceUtils.saveProfilesToProjectPreferences(profileElement, project);
+			ProjectPreferenceUtils.saveProfiles(profileElement, project);
 			YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(
 											YoctoSDKPlugin.getProfilePreferenceStore(PreferenceConstants.STANDARD_PROFILE_NAME));
 			ProjectPreferenceUtils.saveElemToProjectEnv(elem, project);
@@ -255,7 +255,7 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 
 		for (IProject project : yoctoProjects)
 		{
-			ProjectPreferenceUtils.saveProfilesToProjectPreferences(profileElement, project);
+			ProjectPreferenceUtils.saveProfiles(profileElement, project);
 		}
 	}
 
@@ -296,7 +296,7 @@ public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbench
 
 	private boolean projectUsesProfile(IProject project, String profile)
 	{
-		YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfilesFromProjectPreferences(project);
+		YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfiles(project);
 
 		if (!profileElement.getSelectedProfile().equals(profile)) {
 			return false;
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java +8 -8
index 1f82fe1..f6026ee 100644
@@ -64,7 +64,7 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 		IProject project = getProject();
 
 		YoctoProfileElement globalProfileElement= YoctoSDKUtils.getProfilesFromDefaultStore();
-		YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfilesFromProjectPreferences(project);
+		YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfiles(project);
 
 		String selectedProfile = profileElement.getSelectedProfile();
 		if (!globalProfileElement.contains(selectedProfile)) {
@@ -73,10 +73,10 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 
 		yoctoProfileSetting = new YoctoProfileSetting(
 				new YoctoProfileElement(globalProfileElement.getProfilesAsString(), selectedProfile), this, false);
-		boolean useProjectSpecificSetting = ProjectPreferenceUtils.getUseProjectSpecificOptionFromProjectPreferences(project);
+		boolean useProjectSpecificSetting = ProjectPreferenceUtils.getUseProjectSpecificOption(project);
 
 		if (useProjectSpecificSetting) {
-			yoctoUISetting = new YoctoUISetting(ProjectPreferenceUtils.getElemFromProjectPreferences(project));
+			yoctoUISetting = new YoctoUISetting(ProjectPreferenceUtils.getElem(project));
 		} else {
 			yoctoUISetting = new YoctoUISetting(YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)));
 		}
@@ -154,12 +154,12 @@ public class YoctoSDKProjectPropertyPage extends PropertyPage implements
 				return false;
 			}
 
-			ProjectPreferenceUtils.saveUseProjectSpecificOptionToProjectPreferences(project, true);
-			ProjectPreferenceUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
-			ProjectPreferenceUtils.saveElemToProjectPreferences(yoctoUISetting.getCurrentInput(), project);
+			ProjectPreferenceUtils.saveUseProjectSpecificOption(project, true);
+			ProjectPreferenceUtils.saveProfiles(yoctoProfileSetting.getCurrentInput(), project);
+			ProjectPreferenceUtils.saveElem(yoctoUISetting.getCurrentInput(), project);
 		} else {
-			ProjectPreferenceUtils.saveUseProjectSpecificOptionToProjectPreferences(project, false);
-			ProjectPreferenceUtils.saveProfilesToProjectPreferences(yoctoProfileSetting.getCurrentInput(), project);
+			ProjectPreferenceUtils.saveUseProjectSpecificOption(project, false);
+			ProjectPreferenceUtils.saveProfiles(yoctoProfileSetting.getCurrentInput(), project);
 		}
 
 		ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUISetting.getCurrentInput(), getProject());
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java +6 -6
index 50904c1..a06a03c 100644
@@ -36,7 +36,7 @@ public class ProjectPreferenceUtils {
 	private static final String CONSOLE_MESSAGE  = "Menu.SDK.Console.Configure.Message";
 
 	/* Get POKY Preference settings from project's preference store */
-	public static YoctoUIElement getElemFromProjectPreferences(IProject project) {
+	public static YoctoUIElement getElem(IProject project) {
 		IScopeContext projectScope = new ProjectScope(project);
 		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
 		if (projectNode == null) {
@@ -98,7 +98,7 @@ public class ProjectPreferenceUtils {
 	}
 
 	/* Get profiles and selected profile from the project's preference store */
-	public static YoctoProfileElement getProfilesFromProjectPreferences(IProject project) {
+	public static YoctoProfileElement getProfiles(IProject project) {
 		IScopeContext projectScope = new ProjectScope(project);
 		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
 
@@ -112,7 +112,7 @@ public class ProjectPreferenceUtils {
 		return new YoctoProfileElement(profiles, selectedProfile);
 	}
 
-	public static boolean getUseProjectSpecificOptionFromProjectPreferences(IProject project) {
+	public static boolean getUseProjectSpecificOption(IProject project) {
 		IScopeContext projectScope = new ProjectScope(project);
 		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
 		if (projectNode == null) {
@@ -130,7 +130,7 @@ public class ProjectPreferenceUtils {
 	}
 
 	/* Save POKY Preference settings to project's preference store */
-	public static void saveElemToProjectPreferences(YoctoUIElement elem, IProject project) {
+	public static void saveElem(YoctoUIElement elem, IProject project) {
 		IScopeContext projectScope = new ProjectScope(project);
 		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
 		if (projectNode == null) {
@@ -199,7 +199,7 @@ public class ProjectPreferenceUtils {
 	}
 
 	/* Save profiles and selected profile to the project's preference store */
-	public static void saveProfilesToProjectPreferences(YoctoProfileElement profileElement, IProject project) {
+	public static void saveProfiles(YoctoProfileElement profileElement, IProject project) {
 		IScopeContext projectScope = new ProjectScope(project);
 		IEclipsePreferences projectPreferences = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
 
@@ -218,7 +218,7 @@ public class ProjectPreferenceUtils {
 		}
 	}
 
-	public static void saveUseProjectSpecificOptionToProjectPreferences(IProject project, boolean useProjectSpecificSetting) {
+	public static void saveUseProjectSpecificOption(IProject project, boolean useProjectSpecificSetting) {
 		IScopeContext projectScope = new ProjectScope(project);
 		IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE);
 		if (projectNode == null) {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java +1 -1
index f64043d..d8c1232 100644
@@ -206,7 +206,7 @@ public class NewYoctoProjectTemplateProcess extends ProcessRunner {
 		YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid();
 
 		YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore();
-		ProjectPreferenceUtils.saveProfilesToProjectPreferences(profileElement, project);
+		ProjectPreferenceUtils.saveProfiles(profileElement, project);
 
 		IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile());
 		YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore);
Signature · 1 line
1.8.1.4
#5 lore raw

PATCH 5/7 plugins/sdk.ide: Add command to switch the target profile

From: Timo Mueller <[email protected]>

The command can be used in a radio group to switch the target profile of a selected project.

Radio items should call this command handing over the name of the target profile as the command's parameter.

---
 .../OSGI-INF/l10n/bundle.properties                |   3 +
 plugins/org.yocto.sdk.ide/plugin.xml               |  18 +++
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |   3 +
 .../sdk/ide/actions/ProfileSwitchHandler.java      | 130 +++++++++++++++++++++
 4 files changed, 154 insertions(+)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java
plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties +3 -0
index 48eb653..1191af6 100644
@@ -6,6 +6,9 @@ extension.name.2 = YoctoSDKCMakeNature
 command.name = ReconfigureYoctoProject
 command.label.0 = Change Yocto Project Settings
 command.mnemonic = C
+command.targetProfileSwitch.name = Change Target Profile
+command.targetProfileSwitch.description = Changes the target profile of a selected project
+command.targetProfileSwitch.parameter.name = Selected Target Profile
 projectType.name.0 = Yocto Project ADT Autotools Project
 projectProperties.label.0 = Yocto Project Settings
 Bundle-Vendor = yoctoproject.org
plugins/org.yocto.sdk.ide/plugin.xml +18 -0
index 7ea55c7..62f1297 100644
@@ -225,5 +225,23 @@
          </filter>
       </page>
    </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            defaultHandler="org.yocto.sdk.ide.actions.ProfileSwitchHandler"
+            description="%command.targetProfileSwitch.description"
+            id="org.yocto.sdk.ide.targetProfile.switch"
+            name="%command.targetProfileSwitch.name">
+         <commandParameter
+               id="org.eclipse.ui.commands.radioStateParameter"
+               name="%command.targetProfileSwitch.parameter.name"
+               optional="false">
+         </commandParameter>
+         <state
+               class="org.eclipse.ui.handlers.RadioState:project-specific"
+               id="org.eclipse.ui.commands.radioState">
+         </state>
+      </command>
+   </extension>
 
 </plugin>
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +3 -0
index 4ff1574..d6b5cdb 100644
@@ -89,6 +89,9 @@ Preferences.Profile.Standard.Modification.Message = Standard cross development p
 Preferences.Profile.ProjectSpecific.Title = Use project specific settings
 Preferences.Profile.ProjectSpecific.Group.Title = Project specific settings:
 
+Preferences.Profile.ProjectSpecific.Error.Title = Could not change to project specific target profile
+Preferences.Profile.ProjectSpecific.Error.Message = The project specific target profile is not defined for the project "{0}".\nYou can define it in the project's property page.  
+
 Console.SDK.Name = Yocto Project Console
 
 LaunchConfig.Type.Name = org.eclipse.ui.externaltools.ProgramLaunchConfigurationType
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#6 lore raw

PATCH 6/7 plugins/sdk.ide: Add profile switch menu to the toolbar

From: Timo Mueller <[email protected]>

If a project with a yocto nature is selected, the toolbar will show a target profile menu which allows the user to switch the used target profile of the project.

The content of this menu is dynamically created using the list of globally defined target profiles.

---
 .../OSGI-INF/l10n/bundle.properties                |   2 +
 plugins/org.yocto.sdk.ide/plugin.xml               |  57 ++++++++++
 .../sdk/ide/TargetProfileContributionItem.java     | 121 +++++++++++++++++++++
 .../sdk/ide/actions/ProfileSwitchHandler.java      |  26 ++++-
 4 files changed, 205 insertions(+), 1 deletion(-)
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java
plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties +2 -0
index 1191af6..f60df76 100644
@@ -7,8 +7,10 @@ command.name = ReconfigureYoctoProject
 command.label.0 = Change Yocto Project Settings
 command.mnemonic = C
 command.targetProfileSwitch.name = Change Target Profile
+command.targetProfileSwitch.label = Target Profiles
 command.targetProfileSwitch.description = Changes the target profile of a selected project
 command.targetProfileSwitch.parameter.name = Selected Target Profile
+command.targetProfileSwitch.projectSpeficic.label = Project Specific
 projectType.name.0 = Yocto Project ADT Autotools Project
 projectProperties.label.0 = Yocto Project Settings
 Bundle-Vendor = yoctoproject.org
plugins/org.yocto.sdk.ide/plugin.xml +57 -0

62 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java new file +121 -0

121 lines not on this page · raw message

plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java +25 -1
index f751244..548458a 100644
@@ -10,12 +10,16 @@
  *******************************************************************************/
 package org.yocto.sdk.ide.actions;
 
+import java.util.Map;
+
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.commands.Command;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.IHandler;
 import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.commands.State;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IAdaptable;
@@ -25,8 +29,11 @@ import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ITreeSelection;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.commands.IElementUpdater;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.handlers.RadioState;
+import org.eclipse.ui.menus.UIElement;
 import org.yocto.sdk.ide.YoctoProfileElement;
 import org.yocto.sdk.ide.YoctoSDKChecker;
 import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults;
@@ -36,7 +43,7 @@ import org.yocto.sdk.ide.YoctoUIElement;
 import org.yocto.sdk.ide.utils.ProjectPreferenceUtils;
 import org.yocto.sdk.ide.utils.YoctoSDKUtils;
 
-public class ProfileSwitchHandler implements IHandler {
+public class ProfileSwitchHandler implements IHandler, IElementUpdater {
 	private static final String PROJECT_SPECIFIC_ERROR = "Preferences.Profile.ProjectSpecific.Error.Title";
 	private static final String PROJECT_SPECIFIC_ERROR_MESSAGE = "Preferences.Profile.ProjectSpecific.Error.Message";
 
@@ -127,4 +134,21 @@ public class ProfileSwitchHandler implements IHandler {
 
 	@Override
 	public void removeHandlerListener(IHandlerListener handlerListener) {}
+
+	/*
+	 * Workaround for BUG 398647 to allow checking radio items
+	 * in a dynamic contribution
+	 *
+	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=398647
+	 */
+	@Override
+	public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
+			ICommandService service = (ICommandService) element.getServiceLocator().getService(ICommandService.class);
+			String state = (String) parameters.get(RadioState.PARAMETER_ID);
+			Command command = service.getCommand(PROFILE_SWITCH_COMMAND);
+			State commandState = command.getState(RadioState.STATE_ID);
+			if (commandState.getValue().equals(state)) {
+				element.setChecked(true);
+			}
+	}
 }
Signature · 1 line
1.8.1.4
#7 lore raw

PATCH 7/7 plugins/sdk.ide: Add profile switch menu to the project menu

From: Timo Mueller <[email protected]>

If a project with a yocto nature is selected, the project menu will show a target profile menu which allows the user to switch the used target profile of the project.

---
 plugins/org.yocto.sdk.ide/plugin.xml | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
plugins/org.yocto.sdk.ide/plugin.xml +30 -0
index 9ff8473..c766ba2 100644
@@ -247,6 +247,15 @@
          point="org.eclipse.ui.menus">
       <menuContribution
             allPopups="true"
+            locationURI="menu:project">
+         <menu
+               id="org.yocto.sdk.ide.profiles.menu"
+               label="%command.targetProfileSwitch.label"
+               tooltip="%command.targetProfileSwitch.description">
+         </menu>
+      </menuContribution>
+      <menuContribution
+            allPopups="true"
             locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
          <toolbar
                id="org.yocto.sdk.ide.profiles.toolbar">
@@ -280,6 +289,27 @@
       </menuContribution>
       <menuContribution
             allPopups="false"
+            locationURI="menu:org.yocto.sdk.ide.profiles.menu">
+         <command
+               commandId="org.yocto.sdk.ide.targetProfile.switch"
+               label="%command.targetProfileSwitch.projectSpeficic.label"
+               style="radio">
+            <parameter
+                  name="org.eclipse.ui.commands.radioStateParameter"
+                  value="project-specific">
+            </parameter>
+         </command>
+         <separator
+               name="org.yocto.sdk.ide.profiles.separator"
+               visible="true">
+         </separator>
+         <dynamic
+               class="org.yocto.sdk.ide.TargetProfileContributionItem"
+               id="org.yocto.sdk.ide.dynamic.targetProfile">
+         </dynamic>
+      </menuContribution>
+      <menuContribution
+            allPopups="false"
             locationURI="menu:org.yocto.sdk.ide.profiles.toolbar.dropdown">
          <command
                commandId="org.yocto.sdk.ide.targetProfile.switch"
Signature · 1 line
1.8.1.4
#8 lore raw
In reply to Timo Mueller

Hi Timo,

First thanks for continuous making improvement. Most of the patches looked fine, but when I tested the functionality, I noticed that in either cases, your list contains:
Project Specific and my customized profiles e.g. Standard Profile and profile_static. I can toggle my customized profiles with no issue. But if I click on the radio button for "project specific", I'm getting:

The project specific target profile is not defined for the project "YHWC". You can define it in the projects property page

Reason:
Specified Toolchain Root Location is empty.

So I'm a little lost here,do we really need this project specific option? The other nit picking is, you have "projectSpeficic.label", is that a typo?

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Thursday, June 13, 2013 6:30 AM
To: [email protected]
Cc: Timo Mueller
Subject: [yocto] [PATCH 0/7][eclipse-poky] Add target profile quick switch

From: Timo Mueller <[email protected]>

Hi,

if a user wants to change the used target profile of a project he currently has to open the project preferences. This can be tedious if he has to switch the profile often.

This is a small addition which allows the user to quickly switch the used target profile of a project. Instead of having to open the project preferences the user can select the project in the navigator and then choose the desired target profile from a drop-down menu in the toolbar or from the project menu.

01: Small i18n fix
02..04: Refactoring the project specific utils 05..06: Introduce the target profile toolbar switch 07: Adds the target profile switch to the project menu

Best regards,
Timo

Timo Mueller (7):
plugins/sdk.ide: Use an internationalized dialog title plugins/sdk.ide: Extract project specific util methods plugins/sdk.ide: Move project specific util methods plugins/sdk.ide: Remove project context from method names plugins/sdk.ide: Add command to switch the target profile plugins/sdk.ide: Add profile switch menu to the toolbar plugins/sdk.ide: Add profile switch menu to the project menu

 .../OSGI-INF/l10n/bundle.properties                |   5 +
 plugins/org.yocto.sdk.ide/plugin.xml               | 105 +++++++++
 .../sdk/ide/TargetProfileContributionItem.java     | 121 +++++++++++
 .../org/yocto/sdk/ide/YoctoSDKMessages.properties  |   3 +
 .../src/org/yocto/sdk/ide/YoctoUISetting.java      |   3 +-
 .../sdk/ide/actions/ProfileSwitchHandler.java      | 154 +++++++++++++
 .../natures/YoctoSDKAutotoolsProjectNature.java    |   3 +-
 .../ide/preferences/YoctoSDKPreferencePage.java    |  11 +-
 .../preferences/YoctoSDKProjectPropertyPage.java   | 130 ++---------
 .../sdk/ide/utils/ProjectPreferenceUtils.java      | 240 +++++++++++++++++++++
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 118 ----------
 .../ide/wizard/NewYoctoProjectTemplateProcess.java |   3 +-
 12 files changed, 651 insertions(+), 245 deletions(-)  create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java
 create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java

--
1.8.1.4

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#9 lore raw

Hi Jessica,

Zhang, Jessica wrote, On 14.06.2013 21:42:

Quoted 9 lines

Hi Timo,

First thanks for continuous making improvement. Most of the patches looked fine, but when I tested the functionality, I noticed that in either cases, your list contains: Project Specific and my customized profiles e.g. Standard Profile and profile_static. I can toggle my customized profiles with no issue. But if I click on the radio button for "project specific", I'm getting:

Quoted 7 lines

The project specific target profile is not defined for the project "YHWC". You can define it in the projects property page

Reason: Specified Toolchain Root Location is empty.

So I'm a little lost here,do we really need this project specific option?

The "project specific" option correlates to the checkbox in the project properties. The error you get is thrown if you haven't configured the project specific profile in you project. I think in general this is needed as otherwise the project specific would be kind of a second-class profile

However, I think we can handle this error case more gracefully. I have two possible ideas in mind, both with pros and cons:

1) disable/hide the project specific option, if it is not defined in the project
* Pro: Only valid options are shown and accessible.
* Con: Might be confusing if the option is only available with some projects. Especially if you haven't heard of the project specific settings yet.

2) open the project properties to allow the user to do the configuration
* Pro: Forwards the user to the configuration page, allowing him to quickly create the configuration.
* Con: Opens a new window. As there's no hint about the state of the project specific configuration. The user might enter the configuration page unintended.

I'm slightly in favour of option two. Maybe the cons can be worked around by changing the label according to the state of the project specific configuration. E.g. "Configure project specific" and "project specific". I'll rework the patches to see how this feels like.

What do you think about this? Something I miss?

Quoted 2 lines

The other nit picking is, you have "projectSpeficic.label", is that a typo?

Yes, that's a typo. I will fix it along with the reworks mentioned above.

Quoted 43 lines

Thanks, Jessica

-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Thursday, June 13, 2013 6:30 AM To: [email protected] Cc:
Timo Mueller Subject: [yocto] [PATCH 0/7][eclipse-poky] Add target profile quick switch

From: Timo Mueller <[email protected]>

Hi,

if a user wants to change the used target profile of a project he currently has to open the project preferences. This can be tedious if he has to switch the profile often.

This is a small addition which allows the user to quickly switch the used target profile of a project. Instead of having to open the project preferences the user can select the project in the navigator and then choose the desired target profile from a drop-down menu in the toolbar or from the project menu.

01: Small i18n fix 02..04: Refactoring the project specific utils 05..06: Introduce the target profile toolbar switch 07: Adds the target profile switch to the project menu

Best regards, Timo

Timo Mueller (7): plugins/sdk.ide: Use an internationalized dialog title plugins/sdk.ide: Extract project specific util methods plugins/sdk.ide: Move project specific util methods plugins/sdk.ide:
Remove project context from method names plugins/sdk.ide: Add command to switch the target profile plugins/sdk.ide: Add profile switch menu to the toolbar plugins/sdk.ide: Add profile switch menu to the project menu

.../OSGI-INF/l10n/bundle.properties                |   5 +
plugins/org.yocto.sdk.ide/plugin.xml               | 105 +++++++++
.../sdk/ide/TargetProfileContributionItem.java     | 121 +++++++++++
.../org/yocto/sdk/ide/YoctoSDKMessages.properties  |   3 +
.../src/org/yocto/sdk/ide/YoctoUISetting.java      |   3 +-
.../sdk/ide/actions/ProfileSwitchHandler.java      | 154
Quoted 11 lines

+++++++++++++ .../natures/YoctoSDKAutotoolsProjectNature.java |
3 +- .../ide/preferences/YoctoSDKPreferencePage.java | 11 +-
.../preferences/YoctoSDKProjectPropertyPage.java | 130 ++---------
.../sdk/ide/utils/ProjectPreferenceUtils.java | 240
+++++++++++++++++++++
.../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 118 ----------
.../ide/wizard/NewYoctoProjectTemplateProcess.java | 3 +- 12 files
changed, 651 insertions(+), 245 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java

create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java

Quoted 8 lines

create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java

-- 1.8.1.4

_______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto

Best regards,
Timo

#10 lore raw

Hi Timo,

I'd opt for if user is not check the "Project Specific settings" which is a valid case that he/she just chooses one of defined profiles. Just grey out the option in the drop down list instead of totally hiding it. This way, it'll show but we don't enforce user to set it and also avoid the situation that user click on it by accident and got an error as what happened to me. Make sense?

Thanks,
Jessica

-----Original Message-----
From: Timo Müller [mailto:[email protected]]
Sent: Monday, June 17, 2013 3:05 AM
To: Zhang, Jessica
Cc: [email protected]; Timo Mueller
Subject: Re: [yocto] [PATCH 0/7][eclipse-poky] Add target profile quick switch

Hi Jessica,

Zhang, Jessica wrote, On 14.06.2013 21:42:

Quoted 9 lines

Hi Timo,

First thanks for continuous making improvement. Most of the patches looked fine, but when I tested the functionality, I noticed that in either cases, your list contains: Project Specific and my customized profiles e.g. Standard Profile and profile_static. I can toggle my customized profiles with no issue. But if I click on the radio button for "project specific", I'm getting:

Quoted 7 lines

The project specific target profile is not defined for the project "YHWC". You can define it in the projects property page

Reason: Specified Toolchain Root Location is empty.

So I'm a little lost here,do we really need this project specific option?

The "project specific" option correlates to the checkbox in the project properties. The error you get is thrown if you haven't configured the project specific profile in you project. I think in general this is needed as otherwise the project specific would be kind of a second-class profile

However, I think we can handle this error case more gracefully. I have two possible ideas in mind, both with pros and cons:

1) disable/hide the project specific option, if it is not defined in the project
* Pro: Only valid options are shown and accessible.
* Con: Might be confusing if the option is only available with some projects. Especially if you haven't heard of the project specific settings yet.

2) open the project properties to allow the user to do the configuration
* Pro: Forwards the user to the configuration page, allowing him to quickly create the configuration.
* Con: Opens a new window. As there's no hint about the state of the project specific configuration. The user might enter the configuration page unintended.

I'm slightly in favour of option two. Maybe the cons can be worked around by changing the label according to the state of the project specific configuration. E.g. "Configure project specific" and "project specific". I'll rework the patches to see how this feels like.

What do you think about this? Something I miss?

Quoted 2 lines

The other nit picking is, you have "projectSpeficic.label", is that a typo?

Yes, that's a typo. I will fix it along with the reworks mentioned above.

Quoted 43 lines

Thanks, Jessica

-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Thursday, June 13, 2013 6:30 AM To: [email protected] Cc:
Timo Mueller Subject: [yocto] [PATCH 0/7][eclipse-poky] Add target profile quick switch

From: Timo Mueller <[email protected]>

Hi,

if a user wants to change the used target profile of a project he currently has to open the project preferences. This can be tedious if he has to switch the profile often.

This is a small addition which allows the user to quickly switch the used target profile of a project. Instead of having to open the project preferences the user can select the project in the navigator and then choose the desired target profile from a drop-down menu in the toolbar or from the project menu.

01: Small i18n fix 02..04: Refactoring the project specific utils 05..06: Introduce the target profile toolbar switch 07: Adds the target profile switch to the project menu

Best regards, Timo

Timo Mueller (7): plugins/sdk.ide: Use an internationalized dialog title plugins/sdk.ide: Extract project specific util methods plugins/sdk.ide: Move project specific util methods plugins/sdk.ide:
Remove project context from method names plugins/sdk.ide: Add command to switch the target profile plugins/sdk.ide: Add profile switch menu to the toolbar plugins/sdk.ide: Add profile switch menu to the project menu

.../OSGI-INF/l10n/bundle.properties                |   5 +
plugins/org.yocto.sdk.ide/plugin.xml               | 105 +++++++++
.../sdk/ide/TargetProfileContributionItem.java     | 121 +++++++++++
.../org/yocto/sdk/ide/YoctoSDKMessages.properties  |   3 +
.../src/org/yocto/sdk/ide/YoctoUISetting.java      |   3 +-
.../sdk/ide/actions/ProfileSwitchHandler.java      | 154
Quoted 12 lines

+++++++++++++ .../natures/YoctoSDKAutotoolsProjectNature.java |
3 +- .../ide/preferences/YoctoSDKPreferencePage.java | 11 +-
.../preferences/YoctoSDKProjectPropertyPage.java | 130 ++---------
.../sdk/ide/utils/ProjectPreferenceUtils.java | 240
+++++++++++++++++++++
.../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | 118 ----------
.../ide/wizard/NewYoctoProjectTemplateProcess.java | 3 +- 12 files
changed, 651 insertions(+), 245 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContribut ionItem.java

create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java

Quoted 9 lines

create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenc eUtils.java

-- 1.8.1.4

_______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto

Best regards,
Timo