diff options
author | Marc Khouzam | 2010-04-19 19:32:35 +0000 |
---|---|---|
committer | Marc Khouzam | 2010-04-19 19:32:35 +0000 |
commit | 9bcfc4f06268b9637ae57305d42c7a0eed1bf0e1 (patch) | |
tree | a92c361f41e3fad79627cbe8cb9bcf6362ca0250 /debug | |
parent | 7d998da9db45bc241ff9b2f7a2088c2a9538cdc2 (diff) | |
download | org.eclipse.cdt-9bcfc4f06268b9637ae57305d42c7a0eed1bf0e1.tar.gz org.eclipse.cdt-9bcfc4f06268b9637ae57305d42c7a0eed1bf0e1.tar.xz org.eclipse.cdt-9bcfc4f06268b9637ae57305d42c7a0eed1bf0e1.zip |
[248627] Fix for ShowFullPaths enablement and preference bug.
Diffstat (limited to 'debug')
2 files changed, 28 insertions, 11 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java index 3c5aeee1d8f..f4ca6a75d37 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. + * Copyright (c) 2000, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -48,6 +48,7 @@ public class ShowFullPathsAction extends ViewFilterAction { /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run( IAction action ) { final StructuredViewer viewer = getStructuredViewer(); IDebugView view = (IDebugView)getView().getAdapter( IDebugView.class ); @@ -61,6 +62,11 @@ public class ShowFullPathsAction extends ViewFilterAction { viewer.refresh(); IPreferenceStore store = getPreferenceStore(); String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$ + // We must first set a special key, to be able to tell that our preference is really set + // This is because when we set a boolean preference to false, the key is automatically + // removed, because the default value is 'false' + String isSetKey = key + IS_SET_SUFFIX; + store.setValue( isSetKey, true ); store.setValue( key, getValue() ); CDebugUIPlugin.getDefault().savePluginPreferences(); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ViewFilterAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ViewFilterAction.java index f7687c4250c..85276219d32 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ViewFilterAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ViewFilterAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,14 +10,17 @@ *******************************************************************************/ package org.eclipse.cdt.debug.internal.ui.actions; +import org.eclipse.cdt.debug.core.model.ICBreakpoint; +import org.eclipse.cdt.debug.core.model.ICDebugElement; +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IBreakpointManager; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IDebugTarget; +import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; +import org.eclipse.debug.internal.ui.views.launch.LaunchView; import org.eclipse.debug.ui.IDebugView; -import org.eclipse.cdt.debug.core.model.ICBreakpoint; -import org.eclipse.cdt.debug.core.model.ICDebugElement; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.jface.action.IAction; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.viewers.ISelection; @@ -35,6 +38,8 @@ import org.eclipse.ui.IViewPart; */ public abstract class ViewFilterAction extends ViewerFilter implements IViewActionDelegate, IActionDelegate2 { + protected final static String IS_SET_SUFFIX = ".isSet"; //$NON-NLS-1$ + private IViewPart fView; private IAction fAction; @@ -90,6 +95,11 @@ public abstract class ViewFilterAction extends ViewerFilter implements IViewActi viewer.refresh(); IPreferenceStore store = getPreferenceStore(); String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$ + // We must first set a special key, to be able to tell that our preference is really set + // This is because when we set a boolean preference to false, the key is automatically + // removed, because the default value is 'false' + String isSetKey = key + IS_SET_SUFFIX; + store.setValue(isSetKey, true); store.setValue(key, action.isChecked()); CDebugUIPlugin.getDefault().savePluginPreferences(); } @@ -110,11 +120,11 @@ public abstract class ViewFilterAction extends ViewerFilter implements IViewActi */ public void selectionChanged(IAction action, ISelection selection) { boolean enable = false; - Object input = getStructuredViewer().getInput(); + IDebugView view = (IDebugView)getView().getAdapter(IDebugView.class); // Debug view - if (input instanceof ILaunchManager) { - ILaunchManager launchmgr = (ILaunchManager)input; + if (view instanceof LaunchView) { + ILaunchManager launchmgr = DebugPlugin.getDefault().getLaunchManager(); IDebugTarget[] debugTargets = launchmgr.getDebugTargets(); for (IDebugTarget debugTarget : debugTargets) { if (debugTarget instanceof ICDebugElement) { @@ -124,8 +134,8 @@ public abstract class ViewFilterAction extends ViewerFilter implements IViewActi } } // Breakpoints view - else if (input instanceof IBreakpointManager) { - IBreakpointManager bkptmgr = (IBreakpointManager)input; + else if (view instanceof BreakpointsView) { + IBreakpointManager bkptmgr = DebugPlugin.getDefault().getBreakpointManager(); IBreakpoint[] bkpts = bkptmgr.getBreakpoints(); for (IBreakpoint bkpt : bkpts) { if (bkpt instanceof ICBreakpoint) { @@ -156,9 +166,10 @@ public abstract class ViewFilterAction extends ViewerFilter implements IViewActi String baseKey = getPreferenceKey(); String viewKey = part.getSite().getId(); String compositeKey = viewKey + "." + baseKey; //$NON-NLS-1$ + String isSetCompositeKey = compositeKey + IS_SET_SUFFIX; IPreferenceStore store = getPreferenceStore(); boolean value = false; - if (store.contains(compositeKey)) { + if (store.contains(isSetCompositeKey)) { value = store.getBoolean(compositeKey); } else { value = store.getBoolean(baseKey); |