Bug 519391: Only redraw the changed lines

When a line is double-clicked, or the highlight error is otherwise
changed, the redrawing of the highlighting was done by redrawing
the entire build console document. This was slow on very large
documents. Instead only redraw the line losing the highlight (if
any) and the line gaining the highlight.

In addition, as we only change the foreground colour to highlight,
avoid redrawing the background.

Change-Id: I5e652449715a588cb8702e0100a472d1f566e2a8
This commit is contained in:
Jonah Graham 2018-05-24 21:05:56 +01:00
parent d462ce74ff
commit ab02462cdc
2 changed files with 16 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2017 QNX Software Systems and others.
* Copyright (c) 2002, 2018 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -584,6 +584,9 @@ public class BuildConsolePage extends Page
if (console == null) return;
if (console instanceof BuildConsolePartitioner) {
BuildConsolePartitioner par = (BuildConsolePartitioner)console;
BuildConsolePartition oldPartition = par.fDocumentMarkerManager.getCurrentPartition();
// Move to specified line in the model (BuildConsolePartitioner)
if ( position == POSITION_NEXT ) {
par.fDocumentMarkerManager.moveToNextError();
@ -597,6 +600,9 @@ public class BuildConsolePage extends Page
return;
}
}
if (oldPartition != null) {
getViewer().deselectPartition(par, oldPartition);
}
showError(par, position > 0 || fShowErrorAction.isChecked() );
}
}

View file

@ -183,6 +183,14 @@ public class BuildConsoleViewer extends TextViewer
event.styles = styles;
}
public void deselectPartition(BuildConsolePartitioner partitioner, BuildConsolePartition p) {
StyledText st = getTextWidget();
if (st != null) {
// Deselect line
st.redrawRange(p.getOffset(), p.getLength(), false);
}
}
public void selectPartition(BuildConsolePartitioner partitioner, BuildConsolePartition p) {
StyledText st = getTextWidget();
if (st != null) {
@ -202,7 +210,7 @@ public class BuildConsoleViewer extends TextViewer
}
// Select line
st.redrawRange(0, partitioner.getDocument().getLength(), true);
st.redrawRange(p.getOffset(), p.getLength(), false);
} catch (BadLocationException e) {
CUIPlugin.log(e);