1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

Bug 303808: Add base terminal actions to the GDBFullCliConsole

Change-Id: I90967e4e8b16059201d11b509a9737a01dad526d
This commit is contained in:
Alvaro Sanchez-Leon 2016-09-07 11:06:49 -04:00
parent 33f528d1ee
commit 1b7f91a406
16 changed files with 260 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

View file

@ -31,6 +31,21 @@ public class ConsoleMessages extends NLS {
public static String ConsoleTerminateLaunchAction_name;
public static String ConsoleTerminateLaunchAction_description;
public static String ConsoleClearAction_name;
public static String ConsoleClearAction_description;
public static String ConsoleScrollLockAction_name;
public static String ConsoleScrollLockAction_description;
public static String ConsoleCopyAction_name;
public static String ConsoleCopyAction_description;
public static String ConsolePasteAction_name;
public static String ConsolePasteAction_description;
public static String ConsoleSelectAllAction_name;
public static String ConsoleSelectAllAction_description;
static {
// initialize resource bundle
NLS.initializeMessages(ConsoleMessages.class.getName(), ConsoleMessages.class);

View file

@ -21,5 +21,20 @@ 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_name=Termi&nate Launch
ConsoleTerminateLaunchAction_description=Terminate the launch associated to this GDB console
ConsoleClearAction_name=Clea&r
ConsoleClearAction_description=Clear console contents
ConsoleScrollLockAction_name=&Scroll Lock
ConsoleScrollLockAction_description=Lock the scrolling of the associated console
ConsoleCopyAction_name=&Copy
ConsoleCopyAction_description=Copy selection to clip-board
ConsolePasteAction_name=&Paste
ConsolePasteAction_description=Paste contents of clip-board to console
ConsoleSelectAllAction_name=Select &All
ConsoleSelectAllAction_description=Select All available text in the associated console

View file

@ -0,0 +1,38 @@
/*******************************************************************************
* 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.jface.action.Action;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
/**
* Action to clear the contents of the associated GDB terminal
*/
public class GdbConsoleClearAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
public GdbConsoleClearAction(ITerminalViewControl terminalControl) {
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
setEnabled(false);
}
setText(ConsoleMessages.ConsoleClearAction_name);
setToolTipText(ConsoleMessages.ConsoleClearAction_description);
setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_CLEAR_ACTIVE_COLOR));
setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_CLEAR_DISABLED_COLOR));
}
@Override
public void run() {
if (fTerminalCtrl != null) {
fTerminalCtrl.clearTerminal();
}
}
}

View file

@ -0,0 +1,38 @@
/*******************************************************************************
* 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.jface.action.Action;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
/**
* Action to copy the selected text from the associated terminal
*/
public class GdbConsoleCopyAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
public GdbConsoleCopyAction(ITerminalViewControl terminalControl) {
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
setEnabled(false);
}
setText(ConsoleMessages.ConsoleCopyAction_name);
setToolTipText(ConsoleMessages.ConsoleCopyAction_description);
setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_COPY_ACTIVE_COLOR));
setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_COPY_DISABLED_COLOR));
}
@Override
public void run() {
if (fTerminalCtrl != null) {
fTerminalCtrl.copy();
}
}
}

View file

@ -0,0 +1,37 @@
/*******************************************************************************
* 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.jface.action.Action;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
/**
* Action to paste from the clip-board to the associated terminal
*/
public class GdbConsolePasteAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
public GdbConsolePasteAction(ITerminalViewControl terminalControl) {
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
setEnabled(false);
}
setText(ConsoleMessages.ConsolePasteAction_name);
setToolTipText(ConsoleMessages.ConsolePasteAction_description);
setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_PASTE_ACTIVE_COLOR));
setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_PASTE_ACTIVE_COLOR));
}
@Override
public void run() {
if (fTerminalCtrl != null) {
fTerminalCtrl.paste();
}
}
}

View file

@ -0,0 +1,45 @@
/*******************************************************************************
* 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.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
/**
* Action to lock the scrolling of the associated terminal
*/
public class GdbConsoleScrollLockAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
private Boolean fScrollLocked = false;
public GdbConsoleScrollLockAction(ITerminalViewControl terminalControl) {
super(ConsoleMessages.ConsoleScrollLockAction_name, IAction.AS_CHECK_BOX);
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
setEnabled(false);
} else {
fTerminalCtrl.setScrollLock(fScrollLocked);
}
setToolTipText(ConsoleMessages.ConsoleScrollLockAction_description);
setImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_SCROLL_LOCK_ACTIVE_COLOR));
setDisabledImageDescriptor(GdbUIPlugin.getImageDescriptor(IConsoleImagesConst.IMG_CONSOLE_SCROLL_LOCK_DISABLED_COLOR));
}
@Override
public void run() {
if (fTerminalCtrl != null) {
fScrollLocked = !fScrollLocked;
fTerminalCtrl.setScrollLock(fScrollLocked);
}
}
}

View file

@ -0,0 +1,35 @@
/*******************************************************************************
* 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.jface.action.Action;
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
/**
* Action to Select-All the available text from the associated terminal
*/
public class GdbConsoleSelectAllAction extends Action {
private final ITerminalViewControl fTerminalCtrl;
public GdbConsoleSelectAllAction(ITerminalViewControl terminalControl) {
fTerminalCtrl = terminalControl;
if (fTerminalCtrl == null || fTerminalCtrl.isDisposed()) {
setEnabled(false);
}
setText(ConsoleMessages.ConsoleSelectAllAction_name);
setToolTipText(ConsoleMessages.ConsoleSelectAllAction_description);
}
@Override
public void run() {
if (fTerminalCtrl != null) {
fTerminalCtrl.selectAll();
}
}
}

View file

@ -31,6 +31,7 @@ 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.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
@ -65,6 +66,11 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
/** The control for the terminal widget embedded in the console */
private ITerminalViewControl fTerminalControl;
private GdbConsoleClearAction fClearAction;
private GdbConsoleCopyAction fCopyAction;
private GdbConsolePasteAction fPasteAction;
private GdbConsoleScrollLockAction fScrollLockAction;
private GdbConsoleSelectAllAction fSelectAllAction;
public GdbFullCliConsolePage(GdbFullCliConsole gdbConsole, IDebuggerConsoleView view) {
fConsole = gdbConsole;
@ -140,13 +146,31 @@ public class GdbFullCliConsolePage extends Page implements IDebugContextListener
protected void createActions() {
fInvertColorsAction = new GdbConsoleInvertColorsAction();
fTerminateLaunchAction = new GdbConsoleTerminateLaunchAction(fLaunch);
}
fClearAction = new GdbConsoleClearAction(fTerminalControl);
fCopyAction = new GdbConsoleCopyAction(fTerminalControl);
fPasteAction = new GdbConsolePasteAction(fTerminalControl);
fScrollLockAction = new GdbConsoleScrollLockAction(fTerminalControl);
fSelectAllAction = new GdbConsoleSelectAllAction(fTerminalControl);
}
protected void configureToolBar(IToolBarManager mgr) {
mgr.insertBefore(DebuggerConsoleView.DROP_DOWN_ACTION_ID, fTerminateLaunchAction);
mgr.insertBefore(DebuggerConsoleView.DROP_DOWN_ACTION_ID, fClearAction);
mgr.insertBefore(DebuggerConsoleView.DROP_DOWN_ACTION_ID, fScrollLockAction);
}
protected void contextMenuAboutToShow(IMenuManager menuManager) {
menuManager.add(fCopyAction);
menuManager.add(fPasteAction);
menuManager.add(fSelectAllAction);
menuManager.add(new Separator());
menuManager.add(fClearAction);
menuManager.add(new Separator());
menuManager.add(fScrollLockAction);
menuManager.add(new Separator());
menuManager.add(fTerminateLaunchAction);
menuManager.add(fInvertColorsAction);
}

View file

@ -18,4 +18,15 @@ public interface IConsoleImagesConst {
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$
public static final String IMG_CONSOLE_CLEAR_ACTIVE_COLOR = "icons/full/elcl16/clear_co.png"; //$NON-NLS-1$
public static final String IMG_CONSOLE_CLEAR_DISABLED_COLOR = "icons/full/dlcl16/clear_co.png"; //$NON-NLS-1$
public static final String IMG_CONSOLE_COPY_ACTIVE_COLOR = "icons/full/elcl16/copy_edit_co.png"; //$NON-NLS-1$
public static final String IMG_CONSOLE_COPY_DISABLED_COLOR = "icons/full/dlcl16/copy_edit_co.gif"; //$NON-NLS-1$
public static final String IMG_CONSOLE_PASTE_ACTIVE_COLOR = "icons/full/obj16/paste_edit.png"; //$NON-NLS-1$
public static final String IMG_CONSOLE_SCROLL_LOCK_ACTIVE_COLOR = "icons/full/elcl16/lock_co.png"; //$NON-NLS-1$
public static final String IMG_CONSOLE_SCROLL_LOCK_DISABLED_COLOR = "icons/full/dlcl16/lock_co.png"; //$NON-NLS-1$
}