diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleFactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleFactory.java index dd204e3c27f..51caea277dc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleFactory.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleFactory.java @@ -24,7 +24,7 @@ public class BuildConsoleFactory implements IConsoleFactory { public void openConsole() { IBuildConsoleManager manager = CUIPlugin.getDefault().getConsoleManager(); if (manager instanceof BuildConsoleManager) { - ((BuildConsoleManager)manager).showConsole(); + ((BuildConsoleManager)manager).showConsole(true); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java index fe99ece5efc..4fa892cf111 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsoleManager.java @@ -132,14 +132,15 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang listener.consoleChange(event); } } - showConsole(); + showConsole(true); } /** * Opens the console view. If the view is already open, it is brought to the - * front. The console that is shown is the console that was last on top. + * front if requested and the respective user preference is set. The console + * that is shown is the console that was last on top. */ - protected void showConsole() { + protected void showConsole(boolean bringToTop) { IWorkbenchWindow window = CUIPlugin.getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page = window.getActivePage(); @@ -155,11 +156,9 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang //restore focus stolen by the creation of the // console page.activate(activePart); - } else { - boolean bringToTop = shouldBringToTop(consoleView); - if (bringToTop) { - page.bringToTop(consoleView); - } + } + if (bringToTop && shouldBringToTop(consoleView)) { + page.bringToTop(consoleView); } if (consoleView instanceof IConsoleView) { if (BuildConsole.getCurrentPage() == null) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java index a0bc8421da1..57ba6e1321a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitioner.java @@ -242,6 +242,7 @@ public class BuildConsolePartitioner // notify all streams with data we are about to update update.getStreamsNeedingNotifcation().forEach(this::warnOfContentChange); + fManager.showConsole(update.hasProblemsAdded()); /* * The order of these statements matters, the setting the contents of @@ -306,7 +307,6 @@ public class BuildConsolePartitioner if (stream != null) { ConsolePlugin.getDefault().getConsoleManager().warnOfContentChange(stream.getConsole()); } - fManager.showConsole(); } public IDocument getDocument() { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitionerEditData.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitionerEditData.java index d28550bcf5c..eac79240c3b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitionerEditData.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/buildconsole/BuildConsolePartitionerEditData.java @@ -55,6 +55,12 @@ public class BuildConsolePartitionerEditData { * All the streams that have been written to since the last update. */ List getStreamsNeedingNotifcation(); + + /** + * True if partitions with problem markers have been added since the last + * update. + */ + boolean hasProblemsAdded(); } /** @@ -95,6 +101,12 @@ public class BuildConsolePartitionerEditData { * Set of streams that have been updated since the last UI update. */ private Set fEditStreams = new HashSet<>(); + + /** + * True if partitions with problem markers have been added since the last UI + * update. + */ + private boolean fEditProblemsAdded = false; public BuildConsolePartitionerEditData(int maxLines) { @@ -151,6 +163,9 @@ public class BuildConsolePartitionerEditData { } else { partitionType = BuildConsolePartition.ERROR_PARTITION_TYPE; } + if (marker != null) { + fEditProblemsAdded = true; + } if (fEditPartitions.isEmpty()) { fEditPartitions.add(new BuildConsolePartition(stream, fEditStringBuilder.length(), text.length(), partitionType, marker, newlines)); @@ -300,6 +315,7 @@ public class BuildConsolePartitionerEditData { */ public UpdateUIData getUpdate() { boolean clearDocumentMarkerManager; + boolean problemsAdded; long newOffset; String newConents; List newPartitions; @@ -313,6 +329,8 @@ public class BuildConsolePartitionerEditData { fClearDocumentMarkerManager = false; streamsNeedingNotifcation = new ArrayList<>(fEditStreams); fEditStreams.clear(); + problemsAdded = fEditProblemsAdded; + fEditProblemsAdded = false; } return new UpdateUIData() { @@ -341,6 +359,11 @@ public class BuildConsolePartitionerEditData { public long getOffset() { return newOffset; } + + @Override + public boolean hasProblemsAdded() { + return problemsAdded; + } }; }