Skip to content

Commit

Permalink
Restrict Pin View and Open View to active CPP debug context.
Browse files Browse the repository at this point in the history
That is if any CPP application is under debug. Because Pin View is never
enabled other than CPP application debug session.

This also includes Action to Command migration.

see #1048
  • Loading branch information
raghucssit committed Jan 27, 2025
1 parent 9e04dc5 commit 7e3c76f
Show file tree
Hide file tree
Showing 7 changed files with 372 additions and 310 deletions.
182 changes: 112 additions & 70 deletions debug/org.eclipse.cdt.debug.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -718,76 +718,6 @@
helpContextId="add_line_breakpoint_action_context"
tooltip="%AddLineBreakpoint.tooltip"/>
</viewContribution>
<viewContribution
targetID="org.eclipse.debug.ui.RegisterView"
id="org.eclipse.debug.ui.registersView.toolbar">
<menu
label="%Dummy"
id="org.eclipse.cdt.debug.ui.refresh">
<separator name="refreshGroup"/>
<separator name="emptyRefreshGroup"/>
</menu>
</viewContribution>
<viewContribution
id="org.eclipse.cdt.debug.ui.expression.toolbar"
targetID="org.eclipse.debug.ui.ExpressionView">
<action
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
icon="icons/elcl16/toolbar_pinned.gif"
id="org.eclipse.pinclone.expression.pinDebugContext"
label="%PinView.name "
style="toggle"
toolbarPath="pinGroup">
</action>
<action
class="org.eclipse.cdt.debug.internal.ui.actions.OpenNewViewActionDelegate"
icon="icons/elcl16/open_new.gif"
id="org.eclipse.pinclone.expression.clone"
label="%OpenNewView.name"
style="push"
toolbarPath="pinGroup">
</action>
</viewContribution>
<viewContribution
id="org.eclipse.cdt.debug.ui.variable.toolbar"
targetID="org.eclipse.debug.ui.VariableView">
<action
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
icon="icons/elcl16/toolbar_pinned.gif"
id="org.eclipse.pinclone.variable.pinDebugContext"
label="%PinView.name "
style="toggle"
toolbarPath="pinGroup">
</action>
<action
class="org.eclipse.cdt.debug.internal.ui.actions.OpenNewViewActionDelegate"
icon="icons/elcl16/open_new.gif"
id="org.eclipse.pinclone.variable.clone"
label="%OpenNewView.name"
style="push"
toolbarPath="pinGroup">
</action>
</viewContribution>
<viewContribution
id="org.eclipse.cdt.debug.ui.register.toolbar"
targetID="org.eclipse.debug.ui.RegisterView">
<action
class="org.eclipse.cdt.debug.internal.ui.actions.PinDebugContextActionDelegate"
icon="icons/elcl16/toolbar_pinned.gif"
id="org.eclipse.pinclone.register.pinDebugContext"
label="%PinView.name "
style="toggle"
toolbarPath="pinGroup">
</action>
<action
class="org.eclipse.cdt.debug.internal.ui.actions.OpenNewViewActionDelegate"
icon="icons/elcl16/open_new.gif"
id="org.eclipse.pinclone.register.clone"
label="%OpenNewView.name"
style="push"
toolbarPath="pinGroup">
</action>
</viewContribution>
</extension>
<extension
point="org.eclipse.ui.editorActions">
Expand Down Expand Up @@ -1402,6 +1332,102 @@
</visibleWhen>
</command>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.debug.ui.VariableView?after=additions">
<separator
name="org.eclipse.cdt.debug.ui.pinGroup"
visible="true">
</separator>
<command
commandId="org.eclipse.cdt.debug.ui.PinViewCommand"
icon="icons/elcl16/toolbar_pinned.gif"
label="%PinView.name "
style="toggle">
<visibleWhen
checkEnabled="false">
<test
property="org.eclipse.cdt.dsf.ui.canPinViewEnabled">
</test>
</visibleWhen>
</command>
<command
commandId="org.eclipse.cdt.debug.ui.OpenNewViewCommand"
icon="icons/elcl16/open_new.gif"
label="%OpenNewView.name"
style="push">
<visibleWhen
checkEnabled="false">
<test
property="org.eclipse.cdt.dsf.ui.canPinViewEnabled">
</test>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.debug.ui.ExpressionView?after=additions">
<separator
name="org.eclipse.cdt.debug.ui.pinGroup"
visible="true">
</separator>
<command
commandId="org.eclipse.cdt.debug.ui.PinViewCommand"
icon="icons/elcl16/toolbar_pinned.gif"
label="%PinView.name "
style="toggle">
<visibleWhen
checkEnabled="false">
<test
property="org.eclipse.cdt.dsf.ui.canPinViewEnabled">
</test>
</visibleWhen>
</command>
<command
commandId="org.eclipse.cdt.debug.ui.OpenNewViewCommand"
icon="icons/elcl16/open_new.gif"
label="%OpenNewView.name"
style="push">
<visibleWhen
checkEnabled="false">
<test
property="org.eclipse.cdt.dsf.ui.canPinViewEnabled">
</test>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.debug.ui.RegisterView?after=additions">
<separator
name="org.eclipse.cdt.debug.ui.pinGroup"
visible="true">
</separator>
<command
commandId="org.eclipse.cdt.debug.ui.PinViewCommand"
icon="icons/elcl16/toolbar_pinned.gif"
label="%PinView.name "
style="toggle">
<visibleWhen
checkEnabled="false">
<test
property="org.eclipse.cdt.dsf.ui.canPinViewEnabled">
</test>
</visibleWhen>
</command>
<command
commandId="org.eclipse.cdt.debug.ui.OpenNewViewCommand"
icon="icons/elcl16/open_new.gif"
label="%OpenNewView.name"
style="push">
<visibleWhen
checkEnabled="false">
<test
property="org.eclipse.cdt.dsf.ui.canPinViewEnabled">
</test>
</visibleWhen>
</command>
</menuContribution>

</extension>
<extension
Expand Down Expand Up @@ -1689,6 +1715,14 @@
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
<command
id="org.eclipse.cdt.debug.ui.PinViewCommand"
name="%PinView.name ">
</command>
<command
id="org.eclipse.cdt.debug.ui.OpenNewViewCommand"
name="%OpenNewView.name">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
Expand Down Expand Up @@ -1771,6 +1805,14 @@
class="org.eclipse.cdt.debug.internal.ui.commands.ToggleInstructionStepModeHandler"
commandId="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeCommand">
</handler>
<handler
class="org.eclipse.cdt.debug.internal.ui.actions.PinViewHandler"
commandId="org.eclipse.cdt.debug.ui.PinViewCommand">
</handler>
<handler
class="org.eclipse.cdt.debug.internal.ui.actions.OpenNewViewHandler"
commandId="org.eclipse.cdt.debug.ui.OpenNewViewCommand">
</handler>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2010, 2014 Texas Instruments and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Patrick Chuong (Texas Instruments) - Initial implementation of run()
* Marc Dumais (Ericsson) - Bug 437692
* Raghunandana Murthappa(Advantest Europe GmbH) - Issue 1048
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.handlers.HandlerUtil;

/**
* Handler that opens the new View of the view type selected. This is used by
* the OpenNewViewCommand which is contributed to debug related views.
*/
public class OpenNewViewHandler extends AbstractHandler {
private OpenNewViewAction fOpenNewViewAction = new OpenNewViewAction();

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IViewPart viewPart = (IViewPart) HandlerUtil.getActivePart(event);
fOpenNewViewAction.init(viewPart);
fOpenNewViewAction.run();

return IStatus.OK;
}

}
Loading

0 comments on commit 7e3c76f

Please sign in to comment.