mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 15:05:36 +02:00
Bug 378302 - Only bring build console to top on problem output.
When the "Bring console to top when building (if present)" was enabled (which it is by default as of bug 447703), the console would come to the top on every line of output, i.e. constantly during a busy build. That made it impossible to reach other views in the same part, in particular the Progress view in order to stop the build. Instead, only bring the console to the top at the start of the build and when output arrives that is associated with a problem marker (error, warning, info). Change-Id: Iabda4858b443c330e9209c27ea3635b0485c7d98 Signed-off-by: Christian Walther <walther@indel.ch>
This commit is contained in:
parent
0c11499211
commit
bacbb7b3c7
4 changed files with 32 additions and 10 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -55,6 +55,12 @@ public class BuildConsolePartitionerEditData {
|
|||
* All the streams that have been written to since the last update.
|
||||
*/
|
||||
List<IBuildConsoleStreamDecorator> 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<IBuildConsoleStreamDecorator> 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<ITypedRegion> 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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue