Add target profile quick switch
v3 cover Add target profile quick switch
From: Timo Mueller <[email protected]>
Hi,
in conclusion to the previous discussion, we've agreed that the quick switch menu will enable the user to select only configured profiles. An unconfigured project specific profile will be shown as a greyed out option in the menu.
There also has been a bug where the projects specific settings and one profile could be marked as selected at the same time. I could only reproduce by naming the target profile "project-specific" which collides with the radioParamter used for the menu. This case is resolved in this patch set. I've additionally merged the two places where the state of the menu was set so have one consistent place.
In any case, I've added one patch marked as TESTING to enable tracing in the relevant components. In case the problem prevails, please enable the tracing for th org.yocto.sdk.ide plugin and send me the output.
Changes in v3:
- Only grey out project specific profile if not configured.
- Fix Bug where multiple menu item could be selected at the same time
Changes in v2:
Handle error when project specific profile is not configure 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: TESTING: Enalbe tracing to pin down the multi-select problem
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
TESTING: add tracing for radio menu
plugins/org.yocto.sdk.ide/.options | 2 + .../OSGI-INF/l10n/bundle.properties | 4 + plugins/org.yocto.sdk.ide/plugin.xml | 100 ++++++++- .../sdk/ide/ProjectSpecificContributionItem.java | 69 ++++++ .../sdk/ide/TargetProfileContributionItem.java | 139 ++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 4 + .../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 +- 14 files changed, 714 insertions(+), 246 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/.options 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 v3 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 v3 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 v3 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 v3 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 v3 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 v3 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 | 69 +++++++++++ .../sdk/ide/TargetProfileContributionItem.java | 126 +++++++++++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 1 + .../sdk/ide/actions/ProfileSwitchHandler.java | 26 ++++- 6 files changed, 278 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 +69 -0
69 lines not on this page · raw message
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java new file +126 -0
126 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 v3 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 v3 8/8 TESTING: add tracing for radio menu
From: Timo Mueller <[email protected]>
--- plugins/org.yocto.sdk.ide/.options | 2 ++ .../org/yocto/sdk/ide/TargetProfileContributionItem.java | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 plugins/org.yocto.sdk.ide/.options
plugins/org.yocto.sdk.ide/.options new file +2 -0
@@ -0,0 +1,2 @@ +org.yocto.sdk.ide/debug=false +org.yocto.sdk.ide/debug/profileMenu=true
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java +14 -1
@@ -21,6 +21,7 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ITreeSelection;
@@ -38,6 +39,9 @@ import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; import org.yocto.sdk.ide.utils.YoctoSDKUtils; public class TargetProfileContributionItem extends CompoundContributionItem implements IWorkbenchContribution { + private static final boolean DEBUG = YoctoSDKPlugin.getDefault().isDebugging() && + "true".equalsIgnoreCase(Platform.getDebugOption("org.yocto.sdk.ide/debug/profileMenu")); + private IServiceLocator serviceLocator; public TargetProfileContributionItem() {}
@@ -114,13 +118,22 @@ public class TargetProfileContributionItem extends CompoundContributionItem impl try { if (ProjectPreferenceUtils.getUseProjectSpecificOption(project)) { HandlerUtil.updateRadioState(command, ProfileSwitchHandler.PROJECT_SPECIFIC_PARAMETER); + + if (DEBUG) + System.out.println("Enabling project specific menu item"); + return; } String selectedProfile = ProjectPreferenceUtils.getProfiles(project).getSelectedProfile(); HandlerUtil.updateRadioState(command, selectedProfile); + if (DEBUG) + System.out.println("Enabling menu item of profile: " + selectedProfile); } catch (ExecutionException e) { - // ignore + if (DEBUG) { + System.out.println("An error occurred when trying to enable a menu item"); + e.printStackTrace(); + } } } }
Signature · 1 line
1.8.1.4
Hi Timo,
Now it look much better and also with these patch set, I don't see the multiple selection of radio buttons, so I don't think we need the last patch of the series which enable the debugging.
The only thing that's not clear to me is, after define the project specific settings which is different from profiles. From the menu bar, the project menu, when I toggled between profile and project specific setting, by checking into the project property window, I can see the correct setting is showing. But if I stayed inside the project property window, if I uncheck my project specific setting box, click on ok. Then I reopen my project property window, recheck project specific setting box, I noticed that instead of restoring my project specific settings, it copied the prior profile setting. Which is different behavior than other cases that it always able to restore the defined project specific settings once I defined it. So is this a bug or intentional behavior?
Except for this case, everything else looks great to me.
Cheers,
Jessica
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Tuesday, June 25, 2013 8:34 AM
To: [email protected]
Cc: Timo Mueller
Subject: [yocto] [PATCHv3 0/8][eclipse-poky] Add target profile quick switch
From: Timo Mueller <[email protected]>
Hi,
in conclusion to the previous discussion, we've agreed that the quick switch menu will enable the user to select only configured profiles. An unconfigured project specific profile will be shown as a greyed out option in the menu.
There also has been a bug where the projects specific settings and one profile could be marked as selected at the same time. I could only reproduce by naming the target profile "project-specific" which collides with the radioParamter used for the menu. This case is resolved in this patch set. I've additionally merged the two places where the state of the menu was set so have one consistent place.
In any case, I've added one patch marked as TESTING to enable tracing in the relevant components. In case the problem prevails, please enable the tracing for th org.yocto.sdk.ide plugin and send me the output.
Changes in v3:
- Only grey out project specific profile if not configured.
- Fix Bug where multiple menu item could be selected at the same time
Changes in v2:
Handle error when project specific profile is not configure 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: TESTING: Enalbe tracing to pin down the multi-select problem
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
TESTING: add tracing for radio menu
plugins/org.yocto.sdk.ide/.options | 2 + .../OSGI-INF/l10n/bundle.properties | 4 + plugins/org.yocto.sdk.ide/plugin.xml | 100 ++++++++- .../sdk/ide/ProjectSpecificContributionItem.java | 69 ++++++ .../sdk/ide/TargetProfileContributionItem.java | 139 ++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 4 + .../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 +- 14 files changed, 714 insertions(+), 246 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/.options 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,
Zhang, Jessica wrote, On 26.06.2013 00:07:
Quoted 6 lines
Hi Timo,
Now it look much better and also with these patch set, I don't see the multiple selection of radio buttons, so I don't think we need the last patch of the series which enable the debugging.
Quoted 12 lines
The only thing that's not clear to me is, after define the project specific settings which is different from profiles. From the menu bar, the project menu, when I toggled between profile and project specific setting, by checking into the project property window, I can see the correct setting is showing. But if I stayed inside the project property window, if I uncheck my project specific setting box, click on ok. Then I reopen my project property window, recheck project specific setting box, I noticed that instead of restoring my project specific settings, it copied the prior profile setting. Which is different behavior than other cases that it always able to restore the defined project specific settings once I defined it. So is this a bug or intentional behavior?
That is a bug and it's fixed by the patch "plugin/sdk.ide: Pre-populate project specific profile form". With this patch this patch series needs some small adjustments (in the refactoring part). Once it is merged, I'll rework this series and also remove the debugging patch.
Quoted 80 lines
Except for this case, everything else looks great to me.
Cheers, Jessica
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Tuesday, June 25, 2013 8:34 AM
To: [email protected]
Cc: Timo Mueller
Subject: [yocto] [PATCHv3 0/8][eclipse-poky] Add target profile quick switchFrom: Timo Mueller <[email protected]>
Hi,
in conclusion to the previous discussion, we've agreed that the quick switch menu will enable the user to select only configured profiles. An unconfigured project specific profile will be shown as a greyed out option in the menu.
There also has been a bug where the projects specific settings and one profile could be marked as selected at the same time. I could only reproduce by naming the target profile "project-specific" which collides with the radioParamter used for the menu. This case is resolved in this patch set. I've additionally merged the two places where the state of the menu was set so have one consistent place.
In any case, I've added one patch marked as TESTING to enable tracing in the relevant components. In case the problem prevails, please enable the tracing for th org.yocto.sdk.ide plugin and send me the output.
Changes in v3:
- Only grey out project specific profile if not configured.
- Fix Bug where multiple menu item could be selected at the same timeChanges in v2:
Handle error when project specific profile is not configure 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: TESTING: Enalbe tracing to pin down the multi-select problemBest regards,
TimoTimo 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
TESTING: add tracing for radio menuplugins/org.yocto.sdk.ide/.options | 2 + .../OSGI-INF/l10n/bundle.properties | 4 + plugins/org.yocto.sdk.ide/plugin.xml | 100 ++++++++- .../sdk/ide/ProjectSpecificContributionItem.java | 69 ++++++ .../sdk/ide/TargetProfileContributionItem.java | 139 ++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 4 + .../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 +- 14 files changed, 714 insertions(+), 246 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/.optionscreate 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
Quoted 8 lines
--
1.8.1.4_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Best regards
Timo
Hi Timo,
That patch is merged to eclipse-poky master. Please adjust your patch series and resend.
Thanks,
Jessica
-----Original Message-----
From: Timo Müller [mailto:[email protected]]
Sent: Wednesday, June 26, 2013 12:03 AM
To: Zhang, Jessica
Cc: [email protected]; Timo Mueller
Subject: Re: [yocto] [PATCHv3 0/8][eclipse-poky] Add target profile quick switch
Hi Jessica,
Zhang, Jessica wrote, On 26.06.2013 00:07:
Quoted 6 lines
Hi Timo,
Now it look much better and also with these patch set, I don't see the multiple selection of radio buttons, so I don't think we need the last patch of the series which enable the debugging.
Quoted 12 lines
The only thing that's not clear to me is, after define the project specific settings which is different from profiles. From the menu bar, the project menu, when I toggled between profile and project specific setting, by checking into the project property window, I can see the correct setting is showing. But if I stayed inside the project property window, if I uncheck my project specific setting box, click on ok. Then I reopen my project property window, recheck project specific setting box, I noticed that instead of restoring my project specific settings, it copied the prior profile setting. Which is different behavior than other cases that it always able to restore the defined project specific settings once I defined it. So is this a bug or intentional behavior?
That is a bug and it's fixed by the patch "plugin/sdk.ide: Pre-populate project specific profile form". With this patch this patch series needs some small adjustments (in the refactoring part). Once it is merged, I'll rework this series and also remove the debugging patch.
Quoted 84 lines
Except for this case, everything else looks great to me.
Cheers, Jessica
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Timo Mueller
Sent: Tuesday, June 25, 2013 8:34 AM
To: [email protected]
Cc: Timo Mueller
Subject: [yocto] [PATCHv3 0/8][eclipse-poky] Add target profile quick switchFrom: Timo Mueller <[email protected]>
Hi,
in conclusion to the previous discussion, we've agreed that the quick switch menu will enable the user to select only configured profiles. An unconfigured project specific profile will be shown as a greyed out option in the menu.
There also has been a bug where the projects specific settings and one profile could be marked as selected at the same time. I could only reproduce by naming the target profile "project-specific" which collides with the radioParamter used for the menu. This case is resolved in this patch set. I've additionally merged the two places where the state of the menu was set so have one consistent place.
In any case, I've added one patch marked as TESTING to enable tracing in the relevant components. In case the problem prevails, please enable the tracing for th org.yocto.sdk.ide plugin and send me the output.
Changes in v3:
- Only grey out project specific profile if not configured.
- Fix Bug where multiple menu item could be selected at the same timeChanges in v2:
Handle error when project specific profile is not configure 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: TESTING: Enalbe tracing to pin down the multi-select problemBest regards,
TimoTimo 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
TESTING: add tracing for radio menuplugins/org.yocto.sdk.ide/.options | 2 + .../OSGI-INF/l10n/bundle.properties | 4 + plugins/org.yocto.sdk.ide/plugin.xml | 100 ++++++++- .../sdk/ide/ProjectSpecificContributionItem.java | 69 ++++++ .../sdk/ide/TargetProfileContributionItem.java | 139 ++++++++++++ .../org/yocto/sdk/ide/YoctoSDKMessages.properties | 4 + .../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 +- 14 files changed, 714 insertions(+), 246 deletions(-) create mode 100644 plugins/org.yocto.sdk.ide/.optionscreate 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/ProjectPreferenc
eUtils.java
Quoted 8 lines
--
1.8.1.4_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Best regards
Timo