From 090afb9378e858a3c7d5f04f3e6b9cda9aa8c9b8 Mon Sep 17 00:00:00 2001 From: Vodorok Date: Tue, 8 Oct 2019 13:51:17 +0200 Subject: [PATCH 1/2] CodeChecker Console gets focus on write --- .../eclipse/plugin/views/console/ConsoleFactory.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bundles/org.codechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/views/console/ConsoleFactory.java b/bundles/org.codechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/views/console/ConsoleFactory.java index 66072e4f..37764a15 100644 --- a/bundles/org.codechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/views/console/ConsoleFactory.java +++ b/bundles/org.codechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/views/console/ConsoleFactory.java @@ -23,6 +23,18 @@ private static MessageConsole getConsole() { public static void consoleWrite(String msg) { console = getConsole(); + if (console != null) { + IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); + IConsole[] existing = manager.getConsoles(); + boolean exists = false; + for (int i = 0; i < existing.length; i++) { + if (console == existing[i]) + exists = true; + } + if (!exists) + manager.addConsoles(new IConsole[] { console }); + manager.showConsoleView(console); + } MessageConsoleStream out = console.newMessageStream(); out.println(msg); } From 2923a6ccbe003c82ff070f8b444d2a7594dce5b7 Mon Sep 17 00:00:00 2001 From: Vodorok Date: Mon, 14 Oct 2019 12:39:45 +0200 Subject: [PATCH 2/2] remove duplicate --- .../plugin/views/console/ConsoleFactory.java | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/bundles/org.codechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/views/console/ConsoleFactory.java b/bundles/org.codechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/views/console/ConsoleFactory.java index 37764a15..3216975f 100644 --- a/bundles/org.codechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/views/console/ConsoleFactory.java +++ b/bundles/org.codechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/views/console/ConsoleFactory.java @@ -23,18 +23,8 @@ private static MessageConsole getConsole() { public static void consoleWrite(String msg) { console = getConsole(); - if (console != null) { - IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); - IConsole[] existing = manager.getConsoles(); - boolean exists = false; - for (int i = 0; i < existing.length; i++) { - if (console == existing[i]) - exists = true; - } - if (!exists) - manager.addConsoles(new IConsole[] { console }); - manager.showConsoleView(console); - } + showConsole(); + MessageConsoleStream out = console.newMessageStream(); out.println(msg); } @@ -49,17 +39,25 @@ public static void setActiveConsole() { @Override public void openConsole() { console = getConsole(); - if (console != null) { - IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); - IConsole[] existing = manager.getConsoles(); - boolean exists = false; - for (int i = 0; i < existing.length; i++) { - if(console == existing[i]) - exists = true; - } - if(!exists) - manager.addConsoles(new IConsole[] {console}); - manager.showConsoleView(console); + showConsole(); + } + + /** + * Shows console. + */ + public static void showConsole() { + if (console == null) + return; + + IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); + IConsole[] existing = manager.getConsoles(); + boolean exists = false; + for (int i = 0; i < existing.length; i++) { + if (console == existing[i]) + exists = true; } + if (!exists) + manager.addConsoles(new IConsole[] { console }); + manager.showConsoleView(console); } } \ No newline at end of file