### Eclipse Workspace Patch 1.0 #P org.eclipse.debug.ui Index: ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewActionOverride.java =================================================================== RCS file: ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewActionOverride.java diff -N ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewActionOverride.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewActionOverride.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,35 @@ +/***************************************************************** + * Copyright (c) 2011 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Texas Instruments - View action override (Bug 344023) + *****************************************************************/ +package org.eclipse.debug.internal.ui.viewers.model.provisional; + +import org.eclipse.jface.action.IAction; + + +/** + * An interface that allows an implementation to provide (contribute) its own + * action which is used to override an action for the same action id. + * + * @since 3.7 + */ +public interface IViewActionOverride { + /** + * Get action for a given presentation context and action id. Implementation + * class can use presentation context to figure out the view part or view + * model (IVMProvider) which wants to provide (contribute) an action. Once + * the view part or view model is known, the dedicated action for the view + * can be figured out by the implementation, view model, or some other + * classes. + * @param presentationContext presentation context + * @param actionID action id + * @return action or null + */ + public IAction getAction(IPresentationContext presentationContext, String actionID); +} Index: ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java,v retrieving revision 1.201 diff -u -r1.201 VariablesView.java --- ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java 18 Mar 2011 23:51:35 -0000 1.201 +++ ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java 27 Apr 2011 21:50:24 -0000 @@ -44,6 +44,7 @@ import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swt.widgets.Widget; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.ListenerList; @@ -109,12 +110,15 @@ import org.eclipse.debug.internal.ui.actions.variables.ShowTypesAction; import org.eclipse.debug.internal.ui.actions.variables.ToggleDetailPaneAction; import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; +import org.eclipse.debug.internal.ui.viewers.model.ViewerAdapterService; import org.eclipse.debug.internal.ui.viewers.model.VirtualFindAction; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDeltaVisitor; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewActionOverride; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputRequestor; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; @@ -931,6 +935,21 @@ action= new VirtualFindAction(getVariablesViewer()); setAction(VARIABLES_FIND_ELEMENT_ACTION, action); } + + + public IAction getAction(String actionID) { + IViewerInputProvider inputProvider = ViewerAdapterService.getInputProvider(getViewer().getInput()); + if (inputProvider instanceof IAdaptable) { + Object x = ((IAdaptable) inputProvider).getAdapter(IViewActionOverride.class); + if (x instanceof IViewActionOverride) { + IAction action = ((IViewActionOverride) x).getAction(getPresentationContext(), actionID); + if (action != null) { + return action; + } + } + } + return super.getAction(actionID); + } /* (non-Javadoc) *