Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2016-03-14 10:06:55 -0400
committerAndrey Loskutov2016-08-01 04:45:01 -0400
commitc668724f83ea175ecc55095039907e6620bcc13a (patch)
tree95b289c8d8c385cd7222eddfeca8436bdefafcfb /org.eclipse.ui.console
parent8124e2bb15eb3d3793ac8f160e83bddaf1a5c7d8 (diff)
downloadeclipse.platform.debug-c668724f83ea175ecc55095039907e6620bcc13a.tar.gz
eclipse.platform.debug-c668724f83ea175ecc55095039907e6620bcc13a.tar.xz
eclipse.platform.debug-c668724f83ea175ecc55095039907e6620bcc13a.zip
Bug 489546 - Call to ConsoleManager.showConsoleView(x) has no effect ifY20160811-1000I20160809-1300I20160809-1100
ShowConsoleViewJob is already running Change-Id: Iab3d68b31476704a81f75172cb41ef21b62a57e9 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.ui.console')
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java82
1 files changed, 50 insertions, 32 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
index db73423cd..1ef4b9830 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
@@ -7,12 +7,14 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Andrey Loskutov <loskutov@gmx.de> - bug 489546
*******************************************************************************/
package org.eclipse.ui.internal.console;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.PatternSyntaxException;
@@ -280,7 +282,7 @@ public class ConsoleManager implements IConsoleManager {
private class ShowConsoleViewJob extends WorkbenchJob {
- private IConsole console;
+ private Set<IConsole> queue = new LinkedHashSet<IConsole>();
ShowConsoleViewJob() {
super("Show Console View"); //$NON-NLS-1$
@@ -288,50 +290,66 @@ public class ConsoleManager implements IConsoleManager {
setPriority(Job.SHORT);
}
- void setConsole(IConsole console) {
- this.console = console;
+ void addConsole(IConsole console) {
+ synchronized (queue) {
+ queue.add(console);
+ }
}
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
+ Set<IConsole> consolesToShow;
+ synchronized (queue) {
+ consolesToShow = new LinkedHashSet<>(queue);
+ queue.clear();
+ }
+ for (IConsole c : consolesToShow) {
+ showConsole(c);
+ }
+ synchronized (queue) {
+ if (!queue.isEmpty()) {
+ schedule();
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ private void showConsole(IConsole c) {
boolean consoleFound = false;
- IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IConsole c = console;
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null && c != null) {
- IWorkbenchPage page= window.getActivePage();
- if (page != null) {
- synchronized (fConsoleViews) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ synchronized (fConsoleViews) {
for (IConsoleView consoleView : fConsoleViews) {
if (consoleView.getSite().getPage().equals(page)) {
- boolean consoleVisible = page.isPartVisible(consoleView);
- if (consoleVisible) {
- consoleFound = true;
+ boolean consoleVisible = page.isPartVisible(consoleView);
+ if (consoleVisible) {
+ consoleFound = true;
boolean bringToTop = shouldBringToTop(c, consoleView);
- if (bringToTop) {
- page.bringToTop(consoleView);
- }
+ if (bringToTop) {
+ page.bringToTop(consoleView);
+ }
consoleView.display(c);
- }
- }
+ }
+ }
}
- }
+ }
- if (!consoleFound) {
- try {
- IConsoleView consoleView = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW, null, IWorkbenchPage.VIEW_CREATE);
+ if (!consoleFound) {
+ try {
+ IConsoleView consoleView = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW, null, IWorkbenchPage.VIEW_CREATE);
boolean bringToTop = shouldBringToTop(c, consoleView);
- if (bringToTop) {
- page.bringToTop(consoleView);
- }
+ if (bringToTop) {
+ page.bringToTop(consoleView);
+ }
consoleView.display(c);
- } catch (PartInitException pie) {
- ConsolePlugin.log(pie);
- }
- }
- }
- }
- console = null;
- return Status.OK_STATUS;
+ } catch (PartInitException pie) {
+ ConsolePlugin.log(pie);
+ }
+ }
+ }
+ }
}
}
@@ -341,7 +359,7 @@ public class ConsoleManager implements IConsoleManager {
*/
@Override
public void showConsoleView(final IConsole console) {
- showJob.setConsole(console);
+ showJob.addConsole(console);
showJob.schedule(100);
}

Back to the top