mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Add id to GdbFullCliConsole and GdbBasicCliConsole menu
The GdbFullCliConsole has id: GdbFullCliConsole.#ContextMenu The GdbBasicCliConsole has id: GdbBasicCliConsole.#ContextMenu The commit also adds an example of adding a new button to those menus in org.eclipse.examples.dsf.gdb Change-Id: If9579e3e60524f39a332df868f512c5f457043ed
This commit is contained in:
parent
01b791031c
commit
c2914e9be9
4 changed files with 77 additions and 3 deletions
|
@ -69,7 +69,7 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
|
||||||
};
|
};
|
||||||
|
|
||||||
public GdbBasicCliConsole(ILaunch launch, String label, Process process) {
|
public GdbBasicCliConsole(ILaunch launch, String label, Process process) {
|
||||||
super("", null, null, false); //$NON-NLS-1$
|
super("", "GdbBasicCliConsole", null, false); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
fLaunch = launch;
|
fLaunch = launch;
|
||||||
fLabel = label;
|
fLabel = label;
|
||||||
fProcess = process;
|
fProcess = process;
|
||||||
|
|
|
@ -20,9 +20,20 @@ import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.IToolBarManager;
|
import org.eclipse.jface.action.IToolBarManager;
|
||||||
import org.eclipse.jface.action.Separator;
|
import org.eclipse.jface.action.Separator;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.console.IConsoleView;
|
import org.eclipse.ui.console.IConsoleView;
|
||||||
import org.eclipse.ui.internal.console.IOConsolePage;
|
import org.eclipse.ui.internal.console.IOConsolePage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page used for a basic GDB console. Each Debug session which uses the basic GDB console will
|
||||||
|
* use its own instance of this page. The basic console is used for older GDB versions.
|
||||||
|
*
|
||||||
|
* Contributions to this page's context menu can be done using id "GdbBasicCliConsole.#ContextMenu".
|
||||||
|
* For example, using the extension point:<br>
|
||||||
|
* <code>
|
||||||
|
* menuContribution locationURI="popup:GdbBasicCliConsole.#ContextMenu?after=additions"
|
||||||
|
* </code>
|
||||||
|
*/
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugContextListener {
|
public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugContextListener {
|
||||||
|
|
||||||
|
@ -67,6 +78,10 @@ public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugConte
|
||||||
protected void contextMenuAboutToShow(IMenuManager menuManager) {
|
protected void contextMenuAboutToShow(IMenuManager menuManager) {
|
||||||
menuManager.add(fTerminateLaunchAction);
|
menuManager.add(fTerminateLaunchAction);
|
||||||
menuManager.add(new Separator());
|
menuManager.add(new Separator());
|
||||||
|
|
||||||
|
// Other plug-ins can contribute there actions here
|
||||||
|
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
|
||||||
|
|
||||||
menuManager.add(fShowPreferencePageAction);
|
menuManager.add(fShowPreferencePageAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,19 @@ import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory;
|
||||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
|
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
|
||||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
||||||
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||||
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.part.Page;
|
import org.eclipse.ui.part.Page;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page used for a full GDB console. Each Debug session which uses the full GDB console will
|
||||||
|
* use its own instance of this page. GDB 7.12 is required to use the full GDB console.
|
||||||
|
*
|
||||||
|
* Contributions to this page's context menu can be done using id "GdbFullCliConsole.#ContextMenu".
|
||||||
|
* For example, using the extension point:<br>
|
||||||
|
* <code>
|
||||||
|
* menuContribution locationURI="popup:GdbFullCliConsole.#ContextMenu?after=additions"
|
||||||
|
* </code>
|
||||||
|
*/
|
||||||
public class GdbFullCliConsolePage extends Page implements IDebugContextListener {
|
public class GdbFullCliConsolePage extends Page implements IDebugContextListener {
|
||||||
|
|
||||||
private final ILaunch fLaunch;
|
private final ILaunch fLaunch;
|
||||||
|
@ -177,7 +188,10 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createContextMenu() {
|
protected void createContextMenu() {
|
||||||
fMenuManager = new MenuManager();
|
// Choose the id to be similar in format to what
|
||||||
|
// the GdbBasicCliConsole has as id, for consistency
|
||||||
|
String id = "GdbFullCliConsole.#ContextMenu"; //$NON-NLS-1$
|
||||||
|
fMenuManager = new MenuManager(id, id);
|
||||||
fMenuManager.setRemoveAllWhenShown(true);
|
fMenuManager.setRemoveAllWhenShown(true);
|
||||||
fMenuManager.addMenuListener((menuManager) -> { contextMenuAboutToShow(menuManager); });
|
fMenuManager.addMenuListener((menuManager) -> { contextMenuAboutToShow(menuManager); });
|
||||||
Menu menu = fMenuManager.createContextMenu(fTerminalControl.getControl());
|
Menu menu = fMenuManager.createContextMenu(fTerminalControl.getControl());
|
||||||
|
@ -185,7 +199,7 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
|
|
||||||
getSite().registerContextMenu(null, fMenuManager, getSite().getSelectionProvider());
|
getSite().registerContextMenu(id, fMenuManager, getSite().getSelectionProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createActions() {
|
protected void createActions() {
|
||||||
|
@ -220,6 +234,9 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
|
||||||
menuManager.add(fTerminateLaunchAction);
|
menuManager.add(fTerminateLaunchAction);
|
||||||
menuManager.add(fAutoTerminateAction);
|
menuManager.add(fAutoTerminateAction);
|
||||||
menuManager.add(new Separator());
|
menuManager.add(new Separator());
|
||||||
|
|
||||||
|
// Other plug-ins can contribute their actions here
|
||||||
|
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
|
||||||
|
|
||||||
menuManager.add(fShowPreferencePageAction);
|
menuManager.add(fShowPreferencePageAction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,6 +180,48 @@
|
||||||
</command>
|
</command>
|
||||||
</menuContribution>
|
</menuContribution>
|
||||||
|
|
||||||
|
<!-- Contribute Show GDB Version to the popup menu of the GdbFullCliConsole View -->
|
||||||
|
<menuContribution
|
||||||
|
locationURI="popup:GdbFullCliConsole.#ContextMenu?after=additions">
|
||||||
|
<command
|
||||||
|
commandId="org.eclipse.cdt.examples.dsf.gdb.command.showVersion"
|
||||||
|
icon="icons/sample.gif"
|
||||||
|
label="Show GDB Version"
|
||||||
|
style="push"
|
||||||
|
tooltip="Show the GDB Version in a pop-up">
|
||||||
|
<visibleWhen
|
||||||
|
checkEnabled="false">
|
||||||
|
<with variable="org.eclipse.core.runtime.Platform">
|
||||||
|
<test property="org.eclipse.core.runtime.bundleState"
|
||||||
|
args="org.eclipse.cdt.examples.dsf.gdb"
|
||||||
|
value="ACTIVE">
|
||||||
|
</test>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
|
|
||||||
|
<!-- Contribute Show GDB Version to the popup menu of the GdbBasicCliConsole View -->
|
||||||
|
<menuContribution
|
||||||
|
locationURI="popup:GdbBasicCliConsole.#ContextMenu?after=additions">
|
||||||
|
<command
|
||||||
|
commandId="org.eclipse.cdt.examples.dsf.gdb.command.showVersion"
|
||||||
|
icon="icons/sample.gif"
|
||||||
|
label="Show GDB Version"
|
||||||
|
style="push"
|
||||||
|
tooltip="Show the GDB Version in a pop-up">
|
||||||
|
<visibleWhen
|
||||||
|
checkEnabled="false">
|
||||||
|
<with variable="org.eclipse.core.runtime.Platform">
|
||||||
|
<test property="org.eclipse.core.runtime.bundleState"
|
||||||
|
args="org.eclipse.cdt.examples.dsf.gdb"
|
||||||
|
value="ACTIVE">
|
||||||
|
</test>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<!-- Connect the Show GDB Version command ID to its handler -->
|
<!-- Connect the Show GDB Version command ID to its handler -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue