From: Timo Mueller <[email protected]>

Signed-off-by: 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

diff --git a/plugins/org.yocto.sdk.ide/.options 
b/plugins/org.yocto.sdk.ide/.options
new file mode 100644
index 0000000..30ba9c2
--- /dev/null
+++ b/plugins/org.yocto.sdk.ide/.options
@@ -0,0 +1,2 @@
+org.yocto.sdk.ide/debug=false
+org.yocto.sdk.ide/debug/profileMenu=true
diff --git 
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java
 
b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java
index 95d8229..755005d 100644
--- 
a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java
+++ 
b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java
@@ -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();
+                       }
                }
        }
 }
-- 
1.8.1.4

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

Reply via email to