Skip to main content
diff options
authorSimeon Andreev2018-04-09 09:36:41 -0400
committerAndrey Loskutov2018-04-13 04:59:43 -0400
commit13ff8430aaf8568f5fb6f2f326d87222ba0e0ef6 (patch)
treeee7af0a2f871970a5e3ac492fe97ed8bccab5c65 /org.eclipse.ui.console
parent8129e5f2bae0679f218079fcc9b1972a0bb18c27 (diff)
Bug 268608 - find/replace action disabled on first opening of consoleI20180417-2000I20180416-2000I20180416-0305I20180415-2000I20180414-1500I20180413-2000
Whenever a new console page is opened in the Console View, a FindReplaceAction is registered for this console page. The target of this action is set before the new console page is set as active by the PageBookView. This results in either a disabled find/edit action, if there was no previous console page, or an action which targets the previously active console page. I.e. the user either cannot search in the new console page, or searches in an old one. This is also true when switching between consoles, or when closing the Console View and re-opening it. Two points are important here. First, global actions of TextConsolePage pages are only updated on creation of the action, or if the selection in the console's text widget changes. And second, PageBookView.showPageRec will set the current page only after the SWT control of the new page is created (i.e. only after the new actions are updated). Therefore the target of the global find/replace action is updated only when a new console page is created, and its updated with the wrong current page. This change ensures that the FindReplaceAction has the correct target page and its enabled state is correct, both when switching pages and when opening new ones. Namely, the selection of a TestConsolePage is "reset" after the new page is created and shown. Change-Id: I22c368acce902d12f83274c6df12e013fb7afaa3 Signed-off-by: Simeon Andreev <>
Diffstat (limited to 'org.eclipse.ui.console')
1 files changed, 12 insertions, 0 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/
index a69f1ed96..ab03b3adb 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/
@@ -52,6 +52,8 @@ import org.eclipse.ui.console.IConsoleListener;
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IConsolePageParticipant;
import org.eclipse.ui.console.IConsoleView;
+import org.eclipse.ui.console.TextConsolePage;
+import org.eclipse.ui.console.TextConsoleViewer;
import org.eclipse.ui.contexts.IContextActivation;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.part.IPage;
@@ -185,6 +187,16 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
if (page instanceof IOConsolePage) {
((IOConsolePage) page).setWordWrap(fWordWrap);
+ /*
+ * Bug 268608: cannot invoke find/replace after opening console
+ *
+ * Global actions of TextConsolePage must be updated here,
+ * but they are only updated on a selection change.
+ */
+ if (page instanceof TextConsolePage) {
+ TextConsoleViewer viewer = ((TextConsolePage) page).getViewer();
+ viewer.setSelection(viewer.getSelection());
+ }

Back to the top