mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 19:25:38 +02:00
Bug 303808: Add a terminate button to the debugger console view
Change-Id: I67b37be1991c564dca961d3d2f85b9ba0da098c5
This commit is contained in:
parent
489be2aa59
commit
e9b297390b
11 changed files with 99 additions and 2 deletions
|
@ -26,7 +26,7 @@ Export-Package:
|
|||
org.eclipse.cdt.debug.internal.ui.propertypages;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.sourcelookup;x-friends:="org.eclipse.cdt.dsf.ui",
|
||||
org.eclipse.cdt.debug.internal.ui.views;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.views.debuggerconsole;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.views.debuggerconsole;x-friends:="org.eclipse.cdt.dsf.gdb.ui",
|
||||
org.eclipse.cdt.debug.internal.ui.views.executables;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.views.memory;x-internal:=true,
|
||||
org.eclipse.cdt.debug.internal.ui.views.modules;x-internal:=true,
|
||||
|
|
|
@ -35,6 +35,7 @@ public class DebuggerConsoleDropDownAction extends Action implements IMenuCreato
|
|||
|
||||
public DebuggerConsoleDropDownAction(DebuggerConsoleView view) {
|
||||
fView = view;
|
||||
setId(DebuggerConsoleView.DROP_DOWN_ACTION_ID);
|
||||
setText(ConsoleMessages.ConsoleDropDownAction_name);
|
||||
setToolTipText(ConsoleMessages.ConsoleDropDownAction_description);
|
||||
setImageDescriptor(CDebugImages.DESC_OBJS_DEBUGGER_CONSOLE_SELECT);
|
||||
|
|
|
@ -45,6 +45,8 @@ public class DebuggerConsoleView extends PageBookView
|
|||
implements IConsoleView, IDebuggerConsoleView, IConsoleListener, IPropertyChangeListener {
|
||||
|
||||
public static final String DEBUGGER_CONSOLE_VIEW_ID = "org.eclipse.cdt.debug.ui.debuggerConsoleView"; //$NON-NLS-1$
|
||||
public static final String DROP_DOWN_ACTION_ID = DEBUGGER_CONSOLE_VIEW_ID + ".DebuggerConsoleDropDownAction"; //$NON-NLS-1$
|
||||
|
||||
|
||||
/** The console being displayed, or <code>null</code> if none */
|
||||
private IDebuggerConsole fActiveConsole;
|
||||
|
|
BIN
dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/dlcl16/stop.gif
Normal file
BIN
dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/dlcl16/stop.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 152 B |
BIN
dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/elcl16/stop.gif
Normal file
BIN
dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/icons/full/elcl16/stop.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 215 B |
|
@ -28,6 +28,9 @@ public class ConsoleMessages extends NLS {
|
|||
public static String ConsoleInvertColorsAction_name;
|
||||
public static String ConsoleInvertColorsAction_description;
|
||||
|
||||
public static String ConsoleTerminateLaunchAction_name;
|
||||
public static String ConsoleTerminateLaunchAction_description;
|
||||
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(ConsoleMessages.class.getName(), ConsoleMessages.class);
|
||||
|
|
|
@ -20,3 +20,6 @@ ConsoleMessages_save_info_io_error_desc=Error during save console content. Task
|
|||
|
||||
ConsoleInvertColorsAction_name=Invert Colors
|
||||
ConsoleInvertColorsAction_description=Invert the colors for the gdb consoles
|
||||
|
||||
ConsoleTerminateLaunchAction_name=Terminate Launch
|
||||
ConsoleTerminateLaunchAction_description=Terminate the launch associated to this GDB console
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.console;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.views.debuggerconsole.DebuggerConsoleView;
|
||||
import org.eclipse.cdt.debug.ui.debuggerconsole.IDebuggerConsole;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
|
@ -27,6 +28,7 @@ public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugConte
|
|||
private final IDebuggerConsole fConsole;
|
||||
|
||||
private GdbConsoleInvertColorsAction fInvertColorsAction;
|
||||
private GdbConsoleTerminateLaunchAction fTerminateLaunchAction;
|
||||
|
||||
public GdbBasicCliConsolePage(GdbBasicCliConsole gdbConsole, IConsoleView view) {
|
||||
super(gdbConsole, view);
|
||||
|
@ -49,16 +51,18 @@ public class GdbBasicCliConsolePage extends IOConsolePage implements IDebugConte
|
|||
|
||||
@Override
|
||||
protected void configureToolBar(IToolBarManager mgr) {
|
||||
// Don't do anything
|
||||
mgr.insertBefore(DebuggerConsoleView.DROP_DOWN_ACTION_ID, fTerminateLaunchAction);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createActions() {
|
||||
fInvertColorsAction = new GdbConsoleInvertColorsAction();
|
||||
fTerminateLaunchAction = new GdbConsoleTerminateLaunchAction(fLaunch);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void contextMenuAboutToShow(IMenuManager menuManager) {
|
||||
menuManager.add(fTerminateLaunchAction);
|
||||
menuManager.add(fInvertColorsAction);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016 Ericsson 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
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.console;
|
||||
|
||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchesListener2;
|
||||
import org.eclipse.jface.action.Action;
|
||||
|
||||
public class GdbConsoleTerminateLaunchAction extends Action implements ILaunchesListener2 {
|
||||
|
||||
private final ILaunch fLaunch;
|
||||
|
||||
public GdbConsoleTerminateLaunchAction(ILaunch launch) {
|
||||
fLaunch = launch;
|
||||
setText(ConsoleMessages.ConsoleTerminateLaunchAction_name);
|
||||
setToolTipText(ConsoleMessages.ConsoleTerminateLaunchAction_description);
|
||||
setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_TERMINATE_ACTIVE_COLOR));
|
||||
setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_TERMINATE_DISABLED_COLOR));
|
||||
|
||||
if (fLaunch.isTerminated()) {
|
||||
// Launch already terminated
|
||||
setEnabled(false);
|
||||
} else {
|
||||
// Listen to launch events
|
||||
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
fLaunch.terminate();
|
||||
} catch (DebugException e) {
|
||||
GdbUIPlugin.log(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Unable to terminate launch", e)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchesTerminated(ILaunch[] launches) {
|
||||
// This notification can come from this action's run
|
||||
// or other types of termination e.g. program's exit
|
||||
for (ILaunch launch : launches) {
|
||||
if (launch.equals(fLaunch)) {
|
||||
setEnabled(false);
|
||||
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchesRemoved(ILaunch[] launches) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchesAdded(ILaunch[] launches) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchesChanged(ILaunch[] launches) {
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.views.debuggerconsole.DebuggerConsoleView;
|
||||
import org.eclipse.cdt.debug.ui.debuggerconsole.IDebuggerConsole;
|
||||
import org.eclipse.cdt.debug.ui.debuggerconsole.IDebuggerConsoleView;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||
|
@ -28,6 +29,7 @@ import org.eclipse.debug.ui.DebugUITools;
|
|||
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -59,6 +61,7 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
|
|||
private MenuManager fMenuManager;
|
||||
|
||||
private GdbConsoleInvertColorsAction fInvertColorsAction;
|
||||
private GdbConsoleTerminateLaunchAction fTerminateLaunchAction;
|
||||
|
||||
/** The control for the terminal widget embedded in the console */
|
||||
private ITerminalViewControl fTerminalControl;
|
||||
|
@ -95,6 +98,7 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
|
|||
|
||||
createTerminalControl();
|
||||
createContextMenu();
|
||||
configureToolBar(getSite().getActionBars().getToolBarManager());
|
||||
|
||||
// Hook the terminal control to the GDB process
|
||||
attachTerminalToGdbProcess();
|
||||
|
@ -135,9 +139,15 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
|
|||
|
||||
protected void createActions() {
|
||||
fInvertColorsAction = new GdbConsoleInvertColorsAction();
|
||||
fTerminateLaunchAction = new GdbConsoleTerminateLaunchAction(fLaunch);
|
||||
}
|
||||
|
||||
protected void configureToolBar(IToolBarManager mgr) {
|
||||
mgr.insertBefore(DebuggerConsoleView.DROP_DOWN_ACTION_ID, fTerminateLaunchAction);
|
||||
}
|
||||
|
||||
protected void contextMenuAboutToShow(IMenuManager menuManager) {
|
||||
menuManager.add(fTerminateLaunchAction);
|
||||
menuManager.add(fInvertColorsAction);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,4 +16,6 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.console;
|
|||
public interface IConsoleImagesConst {
|
||||
public static final String IMG_SAVE_CONSOLE = "icons/full/obj16/save_console.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_CONSOLE_INVERT_COLORS = "icons/full/obj16/console_invert_colors.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_CONSOLE_TERMINATE_ACTIVE_COLOR = "icons/full/elcl16/stop.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_CONSOLE_TERMINATE_DISABLED_COLOR = "icons/full/dlcl16/stop.gif"; //$NON-NLS-1$
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue