diff options
author | Pawel Piech | 2013-01-16 18:12:28 +0000 |
---|---|---|
committer | Pawel Piech | 2013-01-16 18:12:28 +0000 |
commit | fded632c531a923715e02bb661c3033a7b221dbb (patch) | |
tree | bbb399150e279e259950bb13625f3f35a6140350 | |
parent | 5a56ad8505ee4fbf56a914e9c6dcb9ec0c40bdeb (diff) | |
download | eclipse.platform.debug-fded632c531a923715e02bb661c3033a7b221dbb.tar.gz eclipse.platform.debug-fded632c531a923715e02bb661c3033a7b221dbb.tar.xz eclipse.platform.debug-fded632c531a923715e02bb661c3033a7b221dbb.zip |
Bug 396356 - [variables] Ctrl-C accelerator doesn't work in Variables view
5 files changed, 48 insertions, 21 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java index 879939de7..a37a520d9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2013 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 @@ -22,13 +22,13 @@ import org.eclipse.debug.core.IBreakpointsListener; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.internal.ui.viewers.model.VirtualCopyToClipboardActionDelegate; import org.eclipse.debug.ui.AbstractDebugView; +import org.eclipse.debug.ui.IDebugView; import org.eclipse.jface.action.IAction; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IViewPart; -import org.eclipse.ui.actions.ActionFactory; /** * Copies breakpoint labels to the text clipboard and breakpoint objects @@ -46,7 +46,7 @@ public class CopyBreakpointsActionDelegate extends VirtualCopyToClipboardActionD LocalSelectionTransfer.getTransfer().setSelection(getSelection()); fStamp = System.currentTimeMillis(); LocalSelectionTransfer.getTransfer().setSelectionSetTime(fStamp); - IAction pasteAction = ((AbstractDebugView)getView()).getAction(ActionFactory.PASTE.getCommandId()); + IAction pasteAction = ((AbstractDebugView)getView()).getAction(IDebugView.PASTE_ACTION); // update the enablement of the paste action // workaround since the clipboard does not suppot callbacks if (pasteAction instanceof PasteBreakpointsAction) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java index 7791d4f7c..123e35197 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java @@ -1,5 +1,5 @@ /***************************************************************** - * Copyright (c) 2009, 2012 Texas Instruments and others + * Copyright (c) 2009, 2013 Texas Instruments 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 @@ -244,7 +244,7 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager setAction(PASTE_ACTION, paste); paste.setActionDefinitionId(ActionFactory.PASTE.getCommandId()); //actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste); - setGlobalAction(ActionFactory.PASTE.getId(), paste); + setGlobalAction(PASTE_ACTION, paste); getViewer().addSelectionChangedListener(paste); paste.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java index 77b1a13a7..54f3d965d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -191,7 +191,7 @@ public class ExpressionView extends VariablesView { */ private void configure(IAction action, String defId, String globalId, String imgId) { - setAction(defId, action); + setAction(globalId, action); action.setActionDefinitionId(defId); setGlobalAction(globalId, action); if (imgId != null) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java index 06b1b7c57..a1712a85e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -69,6 +69,7 @@ import org.eclipse.debug.ui.AbstractDebugView; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.IDebugView; import org.eclipse.debug.ui.contexts.DebugContextEvent; import org.eclipse.debug.ui.contexts.IDebugContextListener; import org.eclipse.debug.ui.contexts.IDebugContextService; @@ -704,6 +705,24 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis getViewSite().getActionBars().updateActionBars(); } + /** + * Save the global actions from action bar so they are not overriden by + * the detail pane. + */ + protected void createContextMenu(Control menuControl) { + super.createContextMenu(menuControl); + IActionBars actionBars = getViewSite().getActionBars(); + if (!fGlobalActionMap.containsKey(SELECT_ALL_ACTION)) { + setGlobalAction(IDebugView.SELECT_ALL_ACTION, actionBars.getGlobalActionHandler(SELECT_ALL_ACTION)); + } + if (!fGlobalActionMap.containsKey(COPY_ACTION)) { + setGlobalAction(COPY_ACTION, actionBars.getGlobalActionHandler(COPY_ACTION)); + } + if (!fGlobalActionMap.containsKey(PASTE_ACTION)) { + setGlobalAction(PASTE_ACTION, actionBars.getGlobalActionHandler(PASTE_ACTION)); + } + } + private void clearGlobalActions() { for (Iterator keyItr = fGlobalActionMap.keySet().iterator(); keyItr.hasNext();) { String id = (String)keyItr.next(); @@ -946,7 +965,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis /** * Adds the given action to the set of global actions managed by this - * variables view. Global actions are cleard and reset whenever the detail + * variables view. Global actions are cleared and reset whenever the detail * pane is activated to allow the detail pane to set the actions as * well. * diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java index 09a6ba8a3..bde6a9a3a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2013 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 @@ -345,6 +345,12 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane private IStructuredSelection fLastDisplayed = null; /** + * Flag used to track whether source viewer has focus. It helps avoid + * resetting global actions incorrectly. + */ + private boolean fHasFocus = false; + + /** * Variables used to create the detailed information for a selection */ private IDocument fDetailDocument; @@ -437,7 +443,7 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane getViewSite().getActionBars().updateActionBars(); updateAction(DETAIL_FIND_REPLACE_TEXT_ACTION); - + fHasFocus = true; } public void focusLost(FocusEvent e) { @@ -450,7 +456,7 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane setGlobalAction(getAction(DETAIL_CONTENT_ASSIST_ACTION).getActionDefinitionId(), null); getViewSite().getActionBars().updateActionBars(); - + fHasFocus = false; } }); @@ -458,15 +464,17 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane // have been deactivated fSourceViewer.getControl().addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { - setGlobalAction(IDebugView.SELECT_ALL_ACTION, null); - setGlobalAction(IDebugView.CUT_ACTION, null); - setGlobalAction(IDebugView.COPY_ACTION, null); - setGlobalAction(IDebugView.PASTE_ACTION, null); - setGlobalAction(IDebugView.FIND_ACTION, null); - setGlobalAction(getAction(DETAIL_ASSIGN_VALUE_ACTION) - .getActionDefinitionId(), null); - setGlobalAction(getAction(DETAIL_CONTENT_ASSIST_ACTION) - .getActionDefinitionId(), null); + if (fHasFocus) { + setGlobalAction(IDebugView.SELECT_ALL_ACTION, null); + setGlobalAction(IDebugView.CUT_ACTION, null); + setGlobalAction(IDebugView.COPY_ACTION, null); + setGlobalAction(IDebugView.PASTE_ACTION, null); + setGlobalAction(IDebugView.FIND_ACTION, null); + setGlobalAction(getAction(DETAIL_ASSIGN_VALUE_ACTION) + .getActionDefinitionId(), null); + setGlobalAction(getAction(DETAIL_CONTENT_ASSIST_ACTION) + .getActionDefinitionId(), null); + } } }); |