diff options
author | Paul Pazderski | 2020-05-18 07:57:13 +0000 |
---|---|---|
committer | Paul Pazderski | 2020-06-30 15:50:53 +0000 |
commit | 57d79764eaace00697da31d84379a04ff27042c0 (patch) | |
tree | b0c85321c0ad3dc106e3b386f7b4446f893d04ad | |
parent | 4c211278c0d0edf4fb86da00b36eac39edd348d1 (diff) | |
download | eclipse.platform.debug-57d79764eaace00697da31d84379a04ff27042c0.tar.gz eclipse.platform.debug-57d79764eaace00697da31d84379a04ff27042c0.tar.xz eclipse.platform.debug-57d79764eaace00697da31d84379a04ff27042c0.zip |
Bug 81461 - [console] needs key to clear
Does not include a default key binding.
Change-Id: I93361fa760ba7c72e83da39abee10dfbb6e35abb
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
3 files changed, 51 insertions, 13 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index d8b1dc8f5..618f41d4f 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -200,6 +200,9 @@ ActionContext.breakpointsview.description=The breakpoints view context ActionDefinition.eof.name= EOF ActionDefinition.eof.description= Send end of file +ActionDefinition.clear.name=Clear Console +ActionDefinition.clear.description=Clear Console + ActionDefinition.addMemoryBlock.name= Add Memory Block ActionDefinition.addMemoryBlock.description=Add memory block diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index c06fdbfeb..7739ce4a7 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -1989,21 +1989,27 @@ M4 = Platform-specific fourth key categoryId="org.eclipse.debug.ui.category.run" id="org.eclipse.debug.ui.commands.ToggleMethodBreakpoint"> </command> -<!-- console --> +<!-- console --> <command name="%ActionDefinition.eof.name" categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.eof.description" id="org.eclipse.debug.ui.commands.eof"> </command> + <command + name="%ActionDefinition.clear.name" + categoryId="org.eclipse.debug.ui.category.run" + description="%ActionDefinition.clear.description" + id="org.eclipse.debug.ui.commands.console.clear"> + </command> <!-- Memory View --> <command categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.addMemoryBlock.description" id="org.eclipse.debug.ui.commands.addMemoryMonitor" - name="%ActionDefinition.addMemoryBlock.name"/> + name="%ActionDefinition.addMemoryBlock.name"/> <!-- views --> -<!-- Perspective --> +<!-- Perspective --> <command name="%DebugPerspective.name" description="%command.openDebugPerspective.description" @@ -2060,6 +2066,12 @@ M4 = Platform-specific fourth key </extension> <extension point="org.eclipse.ui.bindings"> <key + commandId="org.eclipse.debug.ui.commands.console.clear" + contextId="org.eclipse.ui.console.ConsoleView" + schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" + sequence="M1+L"> + </key> + <key sequence="M2+F5" commandId="org.eclipse.debug.ui.commands.ToggleStepFilters" diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java index f3ca1e23b..968aa0271 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -40,6 +40,7 @@ import org.eclipse.ui.console.IConsole; import org.eclipse.ui.console.IConsoleConstants; import org.eclipse.ui.console.IConsolePageParticipant; import org.eclipse.ui.console.IConsoleView; +import org.eclipse.ui.console.actions.ClearOutputAction; import org.eclipse.ui.contexts.IContextActivation; import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.handlers.IHandlerActivation; @@ -70,10 +71,13 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I private IConsoleView fView; + private static final String fContextId = "org.eclipse.debug.ui.console"; //$NON-NLS-1$; private EOFHandler fEOFHandler; - private String fContextId = "org.eclipse.debug.ui.console"; //$NON-NLS-1$; + private ClearConsoleHandler fClearConsoleHandler; + private ClearOutputAction fClearConsoleAction; private IContextActivation fActivatedContext; - private IHandlerActivation fActivatedHandler; + private IHandlerActivation fEOFActivatedHandler; + private IHandlerActivation fClearConsoleActivatedHandler; /** * Handler to send EOF */ @@ -90,7 +94,19 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I } return null; } + } + /** + * Handler to send clear console + */ + private class ClearConsoleHandler extends AbstractHandler { + @Override + public Object execute(ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException { + if (fClearConsoleAction != null) { + fClearConsoleAction.run(); + } + return null; + } } @Override @@ -113,8 +129,10 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I IActionBars actionBars = fPage.getSite().getActionBars(); configureToolBar(actionBars.getToolBarManager()); - // create handler and submissions for EOF + // create handler for EOF and clear fEOFHandler = new EOFHandler(); + fClearConsoleHandler = new ClearConsoleHandler(); + fClearConsoleAction = new ClearOutputAction(fConsole); } @Override @@ -223,26 +241,31 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I @Override public void activated() { - // add EOF submissions + // add EOF and clear submissions IPageSite site = fPage.getSite(); - if(fActivatedContext == null && fActivatedHandler == null) { + if (fActivatedContext == null) { IHandlerService handlerService = site.getService(IHandlerService.class); IContextService contextService = site.getService(IContextService.class); fActivatedContext = contextService.activateContext(fContextId); - fActivatedHandler = handlerService.activateHandler("org.eclipse.debug.ui.commands.eof", fEOFHandler); //$NON-NLS-1$ + fEOFActivatedHandler = handlerService.activateHandler("org.eclipse.debug.ui.commands.eof", fEOFHandler); //$NON-NLS-1$ + fClearConsoleActivatedHandler = handlerService + .activateHandler("org.eclipse.debug.ui.commands.console.clear", fClearConsoleHandler); //$NON-NLS-1$ } } @Override public void deactivated() { - // remove EOF submissions + // remove EOF and clear submissions IPageSite site = fPage.getSite(); IHandlerService handlerService = site.getService(IHandlerService.class); IContextService contextService = site.getService(IContextService.class); - handlerService.deactivateHandler(fActivatedHandler); + handlerService.deactivateHandler(fClearConsoleActivatedHandler); + handlerService.deactivateHandler(fEOFActivatedHandler); contextService.deactivateContext(fActivatedContext); fActivatedContext = null; - fActivatedHandler = null; + fEOFActivatedHandler = null; + fClearConsoleActivatedHandler = null; + fClearConsoleAction = null; } @Override |