Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2017-09-13 11:37:54 +0000
committerSimeon Andreev2017-09-13 13:42:26 +0000
commitc97aed7988185ec813c6f07c648ff5131f0c75dd (patch)
treeb2eeb769d0a81e1dd78ffffc4e3e1855166e8789 /org.eclipse.debug.tests/src
parent41c2ec5532e75817763b85c0f208471a37182092 (diff)
downloadeclipse.platform.debug-c97aed7988185ec813c6f07c648ff5131f0c75dd.tar.gz
eclipse.platform.debug-c97aed7988185ec813c6f07c648ff5131f0c75dd.tar.xz
eclipse.platform.debug-c97aed7988185ec813c6f07c648ff5131f0c75dd.zip
Bug 268608 - find/replace action disabled on first opening of consoleI20170915-1030
Whenever a new console page is opened, a FindReplaceAction is registered for this console page. The target of this action is set before the new console page is set as active. 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 change ensures that the created FindReplaceAction has the correct target page: the target page is updated once the console page is activated by the ConsoleView. This fixes the bug. Change-Id: Ib59be79b361b91949e7ace4f4e1803b4039cad95 Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Diffstat (limited to 'org.eclipse.debug.tests/src')
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
index d1f315a62..98272afdb 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
@@ -14,10 +14,20 @@ package org.eclipse.debug.tests.console;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import org.eclipse.core.commands.Command;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.tests.TestUtil;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.console.IOConsoleOutputStream;
import org.eclipse.ui.console.MessageConsole;
@@ -144,4 +154,34 @@ public class ConsoleTests extends AbstractDebugTest {
}
}
+ /**
+ * Validate that we can use find and replace after opening a console in the
+ * Console View.
+ *
+ * @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=268608">bug
+ * 268608</a>
+ */
+ public void testFindReplaceIsEnabledOnConsoleOpen() throws Exception {
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IViewPart consoleView = activePage.showView(IConsoleConstants.ID_CONSOLE_VIEW);
+
+ IOConsole console = new IOConsole("Test Console 7", IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, true); //$NON-NLS-1$
+ console.getDocument().set("some text"); //$NON-NLS-1$
+
+ IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ IConsole[] consoles = { console };
+
+ try {
+ consoleManager.addConsoles(consoles);
+ consoleManager.showConsoleView(console);
+ TestUtil.waitForJobs(getName(), 100, 3000);
+
+ ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
+ Command command = commandService.getCommand(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
+ TestCase.assertTrue("expected FindReplace command to be enabled after opening console", command.isEnabled());
+ } finally {
+ consoleManager.removeConsoles(consoles);
+ activePage.hideView(consoleView);
+ }
+ }
}

Back to the top