Add target profile quick switch
v2 cover Add target profile quick switch
From: Timo Mueller <[email protected]>
Changes in v2:
Handle error when project specific profile is not configured more gracefully. Instead of showing an error message the button is now greyed out.
Patches 01..07 contain the implementation with the greyed out menu button.
After playing around with the two options discussed in the first patch series, I started to prefer inserting a different button in the menu allowing the user to quickly navigate to the project preferences instead of just greying it out. I've added this in the last patch of the series, so you can compare yourself.
From original cover letter
<snip>
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.
</snip>
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 08: Experimental: Add button to open project preferences
Best regards,
Timo
Timo Mueller (8):
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 plugins/sdk.ide: Add project configuration button
.../OSGI-INF/l10n/bundle.properties | 4 + plugins/org.yocto.sdk.ide/plugin.xml | 96 ++++++++- .../sdk/ide/ProjectSpecificContributionItem.java | 91 ++++++++ .../sdk/ide/TargetProfileContributionItem.java | 125 +++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 5 + .../src/org/yocto/sdk/ide/YoctoUISetting.java | 3 +- .../sdk/ide/actions/ProfileSwitchHandler.java | 134 ++++++++++++ .../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 +- 13 files changed, 717 insertions(+), 246 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java 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
PATCH v2 1/8 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
@@ -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
PATCH v2 2/8 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 3/8 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
@@ -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
PATCH v2 4/8 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 5/8 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 | 110 +++++++++++++++++++++ 4 files changed, 134 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
@@ -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
@@ -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
@@ -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 +110 -0
110 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH v2 6/8 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. Additionally it will also contain the project specific profile.
If the project specific profile is not yet defined for the selected project, the button will be greyed out.
--- .../OSGI-INF/l10n/bundle.properties | 1 + plugins/org.yocto.sdk.ide/plugin.xml | 57 +++++++++- .../sdk/ide/ProjectSpecificContributionItem.java | 89 +++++++++++++++ .../sdk/ide/TargetProfileContributionItem.java | 125 +++++++++++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 1 + .../sdk/ide/actions/ProfileSwitchHandler.java | 26 ++++- 6 files changed, 297 insertions(+), 2 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java 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 +1 -0
@@ -7,6 +7,7 @@ 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 projectType.name.0 = Yocto Project ADT Autotools Project
plugins/org.yocto.sdk.ide/plugin.xml +56 -1
67 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java new file +89 -0
89 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java new file +125 -0
125 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +1 -0
@@ -88,6 +88,7 @@ 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.Profile.Label = Project specific profile 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.
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java +25 -1
@@ -10,11 +10,15 @@ *******************************************************************************/ 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.AbstractHandler; +import org.eclipse.core.commands.Command; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.State; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable;
@@ -24,8 +28,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;
@@ -35,7 +42,7 @@ import org.yocto.sdk.ide.YoctoUIElement; import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; import org.yocto.sdk.ide.utils.YoctoSDKUtils; -public class ProfileSwitchHandler extends AbstractHandler { +public class ProfileSwitchHandler extends AbstractHandler implements 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";
@@ -107,4 +114,21 @@ public class ProfileSwitchHandler extends AbstractHandler { ProjectPreferenceUtils.saveProfiles(profileSettings, project); } } + + /* + * 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
PATCH v2 7/8 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 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
plugins/org.yocto.sdk.ide/plugin.xml +25 -0
@@ -251,6 +251,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">
@@ -284,6 +293,22 @@ </menuContribution> <menuContribution allPopups="false" + locationURI="menu:org.yocto.sdk.ide.profiles.menu"> + <dynamic + class="org.yocto.sdk.ide.ProjectSpecificContributionItem" + id="org.yocto.sdk.ide.dynamic.projectSpecific.targetProfile"> + </dynamic> + <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"> <dynamic class="org.yocto.sdk.ide.ProjectSpecificContributionItem"
Signature · 1 line
1.8.1.4
PATCH v2 8/8 plugins/sdk.ide: Add project configuration button
From: Timo Mueller <[email protected]>
This changes the behaviour of the project specific profile button. If the project specific profile is not yet defined for the selected project, the list will contain a button to open the project preferences instead of the greying out the button.
--- plugins/org.yocto.sdk.ide/plugin.xml | 4 ---- .../src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java | 8 +++++--- .../src/org/yocto/sdk/ide/YoctoSDKMessages.properties | 1 + 3 files changed, 6 insertions(+), 7 deletions(-)
plugins/org.yocto.sdk.ide/plugin.xml +0 -4
@@ -81,10 +81,6 @@ id="org.yocto.sdk.ide.command.reconfigYocto" name="%command.name"> </command> - <command - id="org.yocto.sdk.ide.command.disabled" - name="DisabledCommand"> - </command> </extension> <extension point="org.eclipse.ui.handlers">
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java +5 -3
@@ -27,9 +27,11 @@ import org.yocto.sdk.ide.actions.ProfileSwitchHandler; import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; public class ProjectSpecificContributionItem extends TargetProfileContributionItem { + private static final String CONFIGURE_PROJECT_SPECIFIC_PROFILE = + "Preferences.Profile.ProjectSpecific.Configure.Label"; //$NON-NLS-N$ private static final String PROJECT_SPECIFIC_PROFILE = "Preferences.Profile.ProjectSpecific.Profile.Label"; //$NON-NLS-N$ - private static final String DISABLED_COMMAND_ID = "org.yocto.sdk.ide.command.disabled"; //$NON-NLS-N$ + private static final String RECONFIG_YOCTO_COMMAND_ID = "org.yocto.sdk.ide.command.reconfigYocto"; //$NON-NLS-N$ private IServiceLocator serviceLocator;
@@ -50,10 +52,10 @@ public class ProjectSpecificContributionItem extends TargetProfileContributionIt if ((result != SDKCheckResults.SDK_PASS)) { CommandContributionItemParameter parameter = new CommandContributionItemParameter(serviceLocator, null, - DISABLED_COMMAND_ID, + RECONFIG_YOCTO_COMMAND_ID, CommandContributionItem.STYLE_PUSH); - parameter.label = YoctoSDKMessages.getString(PROJECT_SPECIFIC_PROFILE); + parameter.label = YoctoSDKMessages.getString(CONFIGURE_PROJECT_SPECIFIC_PROFILE); items.add(new CommandContributionItem(parameter)); } else {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties +1 -0
@@ -89,6 +89,7 @@ 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.Profile.Label = Project specific profile +Preferences.Profile.ProjectSpecific.Configure.Label = Configure project specific profile ... 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.
Signature · 1 line
1.8.1.4
Hi Timo,
So what's the purpose of "Project Specific Settings", my understanding is it's something that only local to project instead of global name space, e.g. profile? OK, I've played a little bit of toggling between profiles, and project specific setting and notice the following behaviors that can be confusing:
1. As your preference that user can specify "project specific settings". I've noticed for this case, if I haven't entered any project specific settings via the preference wizard, it'll always copy the profile settings prior to its selection, then in this case I don't think it makes much sense since we already have the profiles to cover all the settings
2. OK, now let's move to the case of that I do have explicit setup a project specific settings in the project property view apply it and exit the window. After that, in the drop down list, when I toggle between the options, e.g. I have two profiles besides the project specific settings, then every time after I made the selection and check in the project properties view, the settings matches my selection. So this is good and consistent behavior.
3. If inside the project properties window, I uncheck the "Use project specific settings" box, and select a profile then apply the changes close the window. Now in the drop down list I will see both the "project specific setting" and the selected profile are selected. Then next time when I go back, and re-check "Use project specific settings" box, my project specific setting will be gone, instead the settings will show as my previous profile settings.
Overall, I think we still need to play a little bit more of different setting selections via different approaches, some of the inconsistent behavior can get user lost.
Thanks,
Jessica
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Friday, June 21, 2013 5:45 AM
To: [email protected]
Cc: Timo Mueller
Subject: [yocto] [PATCHv2 0/8][eclipse-poky] Add target profile quick switch
From: Timo Mueller <[email protected]>
Changes in v2:
Handle error when project specific profile is not configured more gracefully. Instead of showing an error message the button is now greyed out.
Patches 01..07 contain the implementation with the greyed out menu button.
After playing around with the two options discussed in the first patch series, I started to prefer inserting a different button in the menu allowing the user to quickly navigate to the project preferences instead of just greying it out. I've added this in the last patch of the series, so you can compare yourself.
From original cover letter
<snip>
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. </snip>
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 08: Experimental: Add button to open project preferences
Best regards,
Timo
Timo Mueller (8):
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 plugins/sdk.ide: Add project configuration button
.../OSGI-INF/l10n/bundle.properties | 4 + plugins/org.yocto.sdk.ide/plugin.xml | 96 ++++++++- .../sdk/ide/ProjectSpecificContributionItem.java | 91 ++++++++ .../sdk/ide/TargetProfileContributionItem.java | 125 +++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 5 + .../src/org/yocto/sdk/ide/YoctoUISetting.java | 3 +- .../sdk/ide/actions/ProfileSwitchHandler.java | 134 ++++++++++++ .../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 +- 13 files changed, 717 insertions(+), 246 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java 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
Hi Jessica,
Am 21.06.2013 23:47, schrieb Zhang, Jessica:
Quoted 5 lines
Hi Timo,
So what's the purpose of "Project Specific Settings", my understanding is it's something that only local to project instead of global name space, e.g. profile?
Yes, that's the main idea.
Quoted 10 lines
OK, I've played a little bit of
toggling between profiles, and project specific setting and notice the following behaviors that can be confusing:1. As your preference that user can specify "project specific settings". I've noticed for this case, if I haven't entered any project specific settings via the preference wizard, it'll always copy the profile settings prior to its selection, then in this case I don't think it makes much sense since we already have the profiles to cover all the settings
That's independent of this patch set, right?
The original idea behind copying the settings of the currently selected profile was to give the user a starting point for creating the project specific settings. The assumption was that the user most of the times only does small modifications to an existing profile.
Sure, if the user doesn't alter the settings, the project specific ones match an already defined target profile. One difference remains, if he changes the target profile it will update all projects that use this profile. The project that is using it's own configuration won't be changed, although the settings are similar.
An alternative to copying the inital settings would be to blank out the form, when the checkbox is checked. If the assumption is not correct and we think that this is easier to understand for the user, I'll provide a patch set changing this behaviour.
Quoted 9 lines
2. OK, now let's move to the case of that I do have explicit setup a project specific settings in the project property view apply it and exit the window. After that, in the drop down list, when I toggle between the options, e.g. I have two profiles besides the project specific settings, then every time after I made the selection and check in the project properties view, the settings matches my selection. So this is good and consistent behavior.
Quoted 7 lines
3. If inside the project properties window, I uncheck the "Use project specific settings" box, and select a profile then apply the changes close the window. Now in the drop down list I will see both the "project specific setting" and the selected profile are selected. Then next time when I go back, and re-check "Use project specific settings" box, my project specific setting will be gone, instead the settings will show as my previous profile settings.
That's a bug in my implementation. They should always be in sink as you explained in your second point.
Quoted 38 lines
Overall, I think we still need to play a little bit more of different setting selections via different approaches, some of the inconsistent behavior can get user lost.
Thanks, Jessica -----Original Message----- From:
[email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Friday, June 21, 2013 5:45 AM To: [email protected] Cc:
Timo Mueller Subject: [yocto] [PATCHv2 0/8][eclipse-poky] Add target profile quick switchFrom: Timo Mueller <[email protected]>
Changes in v2: Handle error when project specific profile is not configured more gracefully. Instead of showing an error message the button is now greyed out.
Patches 01..07 contain the implementation with the greyed out menu button.
After playing around with the two options discussed in the first patch series, I started to prefer inserting a different button in the menu allowing the user to quickly navigate to the project preferences instead of just greying it out. I've added this in the last patch of the series, so you can compare yourself.
From original cover letter <snip> 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. </snip>
Quoted 6 lines
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 08: Experimental: Add button to open project preferences
Best regards, Timo
Thanks, for the input. I'll fix the bug and send a v3.
Best regards,
Timo
Hi Timo,
For case 1, I think we probably should bring back the grey out option. In my opinion, it's more consistent. The property window should be the centralized place for user to setup the settings. The drop down list is for user to quickly toggle between the different settings. So the behavior should be:
If there's no project specific settings, that option will be greyed out. I don't think it'll make it secondary as long as it's still visible. Once user 1st time check the project specific setting in the project properties window, we copy the prior profile settings as start point then the user can further customize if there's the need. Once a project has its own specific settings, the option will be enabled in the drop down list and the selection will be consistent between the drop down list selection and project properties settings.
What do you think?
Jessica
-----Original Message-----
From: Timo Mueller [mailto:[email protected]]
Sent: Sunday, June 23, 2013 1:36 AM
To: Zhang, Jessica
Cc: [email protected]; Timo Mueller
Subject: Re: [yocto] [PATCHv2 0/8][eclipse-poky] Add target profile quick switch
Hi Jessica,
Am 21.06.2013 23:47, schrieb Zhang, Jessica:
Quoted 3 lines
Hi Timo,
So what's the purpose of "Project Specific Settings", my > understanding is it's something that only local to project instead of > global name space, e.g. profile?
Yes, that's the main idea.
Quoted 4 lines
OK, I've played a little bit of
toggling between profiles, and project specific setting and notice > the following behaviors that can be confusing:1. As your preference that user can specify "project specific > settings". I've noticed for this case, if I haven't entered any > project specific settings via the preference wizard, it'll always > copy the profile settings prior to its selection, then in this case I > don't think it makes much sense since we already have the profiles to > cover all the settings
That's independent of this patch set, right?
The original idea behind copying the settings of the currently selected profile was to give the user a starting point for creating the project specific settings. The assumption was that the user most of the times only does small modifications to an existing profile.
Sure, if the user doesn't alter the settings, the project specific ones match an already defined target profile. One difference remains, if he changes the target profile it will update all projects that use this profile. The project that is using it's own configuration won't be changed, although the settings are similar.
An alternative to copying the inital settings would be to blank out the form, when the checkbox is checked. If the assumption is not correct and we think that this is easier to understand for the user, I'll provide a patch set changing this behaviour.
Quoted 5 lines
2. OK, now let's move to the case of that I do have explicit setup a > project specific settings in the project property view apply it and > exit the window. After that, in the drop down list, when I toggle > between the options, e.g. I have two profiles besides the project > specific settings, then every time after I made the selection and > check in the project properties view, the settings matches my > selection. So this is good and consistent behavior.
3. If inside the project properties window, I uncheck the "Use > project specific settings" box, and select a profile then apply the > changes close the window. Now in the drop down list I will see both > the "project specific setting" and the selected profile are selected. Then next time when I go back, and re-check "Use project specific > settings" box, my project specific setting will be gone, instead the > settings will show as my previous profile settings.
That's a bug in my implementation. They should always be in sink as you explained in your second point.
Quoted 8 lines
Overall, I think we still need to play a little bit more of different > setting selections via different approaches, some of the inconsistent > behavior can get user lost.
Thanks, Jessica -----Original Message----- From:
[email protected]
[mailto:[email protected]] On Behalf Of Timo Mueller > Sent: Friday, June 21, 2013 5:45 AM To: [email protected] Cc:
Timo Mueller Subject: [yocto] [PATCHv2 0/8][eclipse-poky] Add target > profile quick switch > > From: Timo Mueller <[email protected]> > > Changes in v2: Handle error when project specific profile is not > configured more gracefully. Instead of showing an error message the > button is now greyed out.
Quoted 7 lines
Patches 01..07 contain the implementation with the greyed out menu > button.
After playing around with the two options discussed in the first > patch series, I started to prefer inserting a different button in the > menu allowing the user to quickly navigate to the project preferences > instead of just greying it out. I've added this in the last patch of > the series, so you can compare yourself.
From original cover letter <snip> 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. </snip> > > 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 08: Experimental: Add > button to open project preferences > > Best regards, Timo
Thanks, for the input. I'll fix the bug and send a v3.
Best regards,
Timo
Hi Jessica
Zhang, Jessica wrote, On 24.06.2013 07:25:
Quoted 18 lines
Hi Timo,
For case 1, I think we probably should bring back the grey out option. In my opinion, it's more consistent. The property window should be the centralized place for user to setup the settings. The drop down list is for user to quickly toggle between the different settings. So the behavior should be:
If there's no project specific settings, that option will be greyed out. I don't think it'll make it secondary as long as it's still visible. Once user 1st time check the project specific setting in the project properties window, we copy the prior profile settings as start point then the user can further customize if there's the need. Once a project has its own specific settings, the option will be enabled in the drop down list and the selection will be consistent between the drop down list selection and project properties settings.
Quoted 1 line
What do you think?
I get your point. I'll kick out the last patch to restore the greyed out version.
I tried to reproduce case 3. And I haven't been able to bring the menu to a state where two menu items are checked. I tried all sorts of combinations without success. Could you maybe tell me the exact steps on how you get this behaviour?
However, when trying the different options I realized that there's a bug in the project preferences. Maybe you've already pointed it out and I didn't get it. But if you've configured a project specific profile and change to a target profile, when you enable the project specific profile again, your settings are lost. Instead the selected profile is copied all of the time, instead of only at the first time of configuration.
I'll send a fix and a v3 of the menu with the greyed out menu item.
Quoted 103 lines
Jessica -----Original Message----- From: Timo Mueller [mailto:[email protected]] Sent: Sunday, June 23, 2013 1:36 AM To:
Zhang, Jessica Cc: [email protected]; Timo Mueller Subject: Re:
[yocto] [PATCHv2 0/8][eclipse-poky] Add target profile quick switchHi Jessica,
Am 21.06.2013 23:47, schrieb Zhang, Jessica:
Quoted 5 lines
Hi Timo,
So what's the purpose of "Project Specific Settings", my > understanding is it's something that only local to project instead of > global name space, e.g. profile?
Yes, that's the main idea.
Quoted 10 lines
OK, I've played a little bit of toggling between profiles, and project specific setting and notice > the following behaviors that can be confusing:
1. As your preference that user can specify "project specific > settings". I've noticed for this case, if I haven't entered any > project specific settings via the preference wizard, it'll always
Quoted 1 line
copy the profile settings prior to its selection, then in this
case I > don't think it makes much sense since we already have the profiles to > cover all the settings
That's independent of this patch set, right?
The original idea behind copying the settings of the currently selected profile was to give the user a starting point for creating the project specific settings. The assumption was that the user most of the times only does small modifications to an existing profile.
Sure, if the user doesn't alter the settings, the project specific ones match an already defined target profile. One difference remains, if he changes the target profile it will update all projects that use this profile. The project that is using it's own configuration won't be changed, although the settings are similar.
An alternative to copying the inital settings would be to blank out the form, when the checkbox is checked. If the assumption is not correct and we think that this is easier to understand for the user, I'll provide a patch set changing this behaviour.
Quoted 9 lines
2. OK, now let's move to the case of that I do have explicit setup a > project specific settings in the project property view apply it and > exit the window. After that, in the drop down list, when I toggle > between the options, e.g. I have two profiles besides the project > specific settings, then every time after I made the selection and > check in the project properties view, the settings matches my > selection. So this is good and consistent behavior.
Quoted 8 lines
3. If inside the project properties window, I uncheck the "Use > project specific settings" box, and select a profile then apply the
Quoted 1 line
changes close the window. Now in the drop down list I will see
both > the "project specific setting" and the selected profile are selected. Then next time when I go back, and re-check "Use project specific > settings" box, my project specific setting will be gone, instead the > settings will show as my previous profile settings.
That's a bug in my implementation. They should always be in sink as you explained in your second point.
Quoted 36 lines
Overall, I think we still need to play a little bit more of different > setting selections via different approaches, some of the inconsistent > behavior can get user lost.
Thanks, Jessica -----Original Message----- From:
[email protected] [mailto:[email protected]] On Behalf Of Timo MuellerQuoted 1 line
Sent: Friday, June 21, 2013 5:45 AM To: [email protected]
Cc: Timo Mueller Subject: [yocto] [PATCHv2 0/8][eclipse-poky] Add target > profile quick switch > > From: Timo Mueller <[email protected]> > > Changes in v2: Handle error when project specific profile is not > configured more gracefully. Instead of showing an error message the > button is now greyed out.
Patches 01..07 contain the implementation with the greyed out menu
Quoted 1 line
button.
After playing around with the two options discussed in the first > patch series, I started to prefer inserting a different button in the > menu allowing the user to quickly navigate to the project preferences > instead of just greying it out. I've added this in the last patch of > the series, so you can compare yourself.
From original cover letter <snip> 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. </snip>
Quoted 1 line
Quoted 1 line
01: Small i18n fix 02..04: Refactoring the project specific
Quoted 9 lines
Quoted 4 lines
utils > 05..06: Introduce the target profile toolbar switch 07:
Adds the > target profile switch to the project menu 08:
Experimental: Add > button to open project preferences > > Best regards, TimoThanks, for the input. I'll fix the bug and send a v3.
Best regards, Timo
Best regards,
Timo
Hi Timo,
Your finding is described in my case 3. For reproduce the double selection, you need to select "project specific" apply exit the property window. Then go back to property window, deselect "project specific" apply, exit the window. Then check the drop down list, I can consistently reproduce the case this way. Give it a try.
Thanks,
Jessica
-----Original Message-----
From: Timo Müller [mailto:[email protected]]
Sent: Sunday, June 23, 2013 11:52 PM
To: Zhang, Jessica
Cc: [email protected]; Timo Mueller
Subject: Re: [yocto] [PATCHv2 0/8][eclipse-poky] Add target profile quick switch
Hi Jessica
Zhang, Jessica wrote, On 24.06.2013 07:25:
Quoted 17 lines
Hi Timo,
For case 1, I think we probably should bring back the grey out option. In my opinion, it's more consistent. The property window should be the centralized place for user to setup the settings. The drop down list is for user to quickly toggle between the different settings. So the behavior should be:
If there's no project specific settings, that option will be greyed out. I don't think it'll make it secondary as long as it's still visible. Once user 1st time check the project specific setting in the project properties window, we copy the prior profile settings as start point then the user can further customize if there's the need. Once a project has its own specific settings, the option will be enabled in the drop down list and the selection will be consistent between the drop down list selection and project properties settings.
Quoted 1 line
What do you think?
I get your point. I'll kick out the last patch to restore the greyed out version.
I tried to reproduce case 3. And I haven't been able to bring the menu to a state where two menu items are checked. I tried all sorts of combinations without success. Could you maybe tell me the exact steps on how you get this behaviour?
However, when trying the different options I realized that there's a bug in the project preferences. Maybe you've already pointed it out and I didn't get it. But if you've configured a project specific profile and change to a target profile, when you enable the project specific profile again, your settings are lost. Instead the selected profile is copied all of the time, instead of only at the first time of configuration.
I'll send a fix and a v3 of the menu with the greyed out menu item.
Quoted 101 lines
Jessica -----Original Message----- From: Timo Mueller [mailto:[email protected]] Sent: Sunday, June 23, 2013 1:36 AM To:
Zhang, Jessica Cc: [email protected]; Timo Mueller Subject: Re:
[yocto] [PATCHv2 0/8][eclipse-poky] Add target profile quick switchHi Jessica,
Am 21.06.2013 23:47, schrieb Zhang, Jessica:
Quoted 5 lines
Hi Timo,
So what's the purpose of "Project Specific Settings", my > understanding is it's something that only local to project instead of
Quoted 1 line
global name space, e.g. profile?
Yes, that's the main idea.
Quoted 10 lines
OK, I've played a little bit of toggling between profiles, and project specific setting and notice > the following behaviors that can be confusing:
1. As your preference that user can specify "project specific > settings". I've noticed for this case, if I haven't entered any > project specific settings via the preference wizard, it'll always
Quoted 1 line
copy the profile settings prior to its selection, then in this
case I > don't think it makes much sense since we already have the profiles to > cover all the settings
That's independent of this patch set, right?
The original idea behind copying the settings of the currently selected profile was to give the user a starting point for creating the project specific settings. The assumption was that the user most of the times only does small modifications to an existing profile.
Sure, if the user doesn't alter the settings, the project specific ones match an already defined target profile. One difference remains, if he changes the target profile it will update all projects that use this profile. The project that is using it's own configuration won't be changed, although the settings are similar.
An alternative to copying the inital settings would be to blank out the form, when the checkbox is checked. If the assumption is not correct and we think that this is easier to understand for the user, I'll provide a patch set changing this behaviour.
Quoted 9 lines
2. OK, now let's move to the case of that I do have explicit setup a
Quoted 5 lines
project specific settings in the project property view apply it and exit the window. After that, in the drop down list, when I toggle between the options, e.g. I have two profiles besides the project specific settings, then every time after I made the selection and check in the project properties view, the settings matches my >
selection. So this is good and consistent behavior.
Quoted 7 lines
3. If inside the project properties window, I uncheck the "Use > project specific settings" box, and select a profile then apply the
Quoted 1 line
changes close the window. Now in the drop down list I will see
both > the "project specific setting" and the selected profile are selected. Then next time when I go back, and re-check "Use project specific > settings" box, my project specific setting will be gone, instead the > settings will show as my previous profile settings.
That's a bug in my implementation. They should always be in sink as you explained in your second point.
Quoted 35 lines
Overall, I think we still need to play a little bit more of different
Quoted 1 line
setting selections via different approaches, some of the
inconsistent > behavior can get user lost.
Thanks, Jessica -----Original Message----- From:
[email protected] [mailto:[email protected]] On Behalf Of Timo MuellerQuoted 1 line
Sent: Friday, June 21, 2013 5:45 AM To: [email protected]
Cc: Timo Mueller Subject: [yocto] [PATCHv2 0/8][eclipse-poky] Add target > profile quick switch > > From: Timo Mueller <[email protected]> > > Changes in v2: Handle error when project specific profile is not > configured more gracefully. Instead of showing an error message the > button is now greyed out.
Patches 01..07 contain the implementation with the greyed out menu
Quoted 1 line
button.
After playing around with the two options discussed in the first > patch series, I started to prefer inserting a different button in the
Quoted 1 line
menu allowing the user to quickly navigate to the project
preferences > instead of just greying it out. I've added this in the last patch of > the series, so you can compare yourself.
From original cover letter <snip> if a user wants to change the used
Quoted 1 line
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
Quoted 1 line
used target profile of a project. Instead of having to open the >
project preferences the user can select the project in the navigator
Quoted 3 lines
and then choose the desired target profile from a drop-down menu in the toolbar or from the project menu. </snip>
Quoted 1 line
01: Small i18n fix 02..04: Refactoring the project specific
Quoted 9 lines
Quoted 4 lines
utils > 05..06: Introduce the target profile toolbar switch 07:
Adds the > target profile switch to the project menu 08:
Experimental: Add > button to open project preferences > > Best regards, TimoThanks, for the input. I'll fix the bug and send a v3.
Best regards, Timo
Best regards,
Timo