mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 12:05:21 +02:00
Bug 519125: Expose console refresh rate as a preference
Change-Id: I342512ff52887bc34e17185c2aa9faa34893996a
This commit is contained in:
parent
167a605b57
commit
dd07cba37b
3 changed files with 42 additions and 17 deletions
|
@ -24,6 +24,9 @@ ConsolePreferencePage.consoleWrapLines.label=Wrap lines on the console
|
||||||
ConsolePreferencePage.consoleLines.label=Limit console output (number of lines):
|
ConsolePreferencePage.consoleLines.label=Limit console output (number of lines):
|
||||||
ConsolePreferencePage.consoleLines.tooltip=This is a fuzzy limit, optimized for best performance. The actual limit will be between this value and 2 times this value.
|
ConsolePreferencePage.consoleLines.tooltip=This is a fuzzy limit, optimized for best performance. The actual limit will be between this value and 2 times this value.
|
||||||
ConsolePreferencePage.consoleLines.errorMessage=Value must be an integer between 10 and 2147483647
|
ConsolePreferencePage.consoleLines.errorMessage=Value must be an integer between 10 and 2147483647
|
||||||
|
ConsolePreferencePage.consoleUpdateDelay.label=Delay updated between console updates (milliseconds):
|
||||||
|
ConsolePreferencePage.consoleUpdateDelay.tooltip=The number of milliseconds between each console view update to allow other operations to perform UI operations.
|
||||||
|
ConsolePreferencePage.consoleUpdateDelay.errorMessage=Value must be an integer between 0 and 2147483647
|
||||||
ConsolePreferencePage.tabWidth.label=Display tab width:
|
ConsolePreferencePage.tabWidth.label=Display tab width:
|
||||||
ConsolePreferencePage.tabWidth.errorMessage=Value must be an integer between 1 and 100
|
ConsolePreferencePage.tabWidth.errorMessage=Value must be an integer between 1 and 100
|
||||||
ConsolePreferencePage.colorSettings.label=Console text color settings
|
ConsolePreferencePage.colorSettings.label=Console text color settings
|
||||||
|
|
|
@ -102,6 +102,8 @@ public class BuildConsolePartitioner
|
||||||
*/
|
*/
|
||||||
private LogFile fLogFile = new LogFile();
|
private LogFile fLogFile = new LogFile();
|
||||||
|
|
||||||
|
private int fUpdateDelay = BuildConsolePreferencePage.DEFAULT_BUILDCONSOLE_UPDATE_DELAY_MS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a partitioner that is not associated with a specific project
|
* Construct a partitioner that is not associated with a specific project
|
||||||
*/
|
*/
|
||||||
|
@ -116,6 +118,7 @@ public class BuildConsolePartitioner
|
||||||
fDocument = new BuildConsoleDocument();
|
fDocument = new BuildConsoleDocument();
|
||||||
fDocument.setDocumentPartitioner(this);
|
fDocument.setDocumentPartitioner(this);
|
||||||
fDocumentMarkerManager = new DocumentMarkerManager(fDocument, this);
|
fDocumentMarkerManager = new DocumentMarkerManager(fDocument, this);
|
||||||
|
fUpdateDelay = BuildConsolePreferencePage.buildConsoleUpdateDelayMs();
|
||||||
connect(fDocument);
|
connect(fDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,27 +209,12 @@ public class BuildConsolePartitioner
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the UI after a short delay. The reason for a short delay is to try
|
* @see BuildConsolePreferencePage#DEFAULT_BUILDCONSOLE_UPDATE_DELAY_MS
|
||||||
* and reduce the "frame rate" of the build console updates, this reduces
|
|
||||||
* the total load on the main thread. User's won't be able to tell that
|
|
||||||
* there is an extra delay.
|
|
||||||
*
|
|
||||||
* A too short time has little effect and a too long time starts to be
|
|
||||||
* visible to the user. With my experiments to get under 50% CPU utilization
|
|
||||||
* on the main thread requires at least 35 msec delay between updates. 250
|
|
||||||
* msec leads to visible delay to user and ~20% utilization. And finally the
|
|
||||||
* chosen value, 75 msec leads to ~35% utilization and no user visible
|
|
||||||
* delay.
|
|
||||||
*/
|
|
||||||
private static final int UDPATE_DELAY_MS = 75;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see #UDPATE_DELAY_MS
|
|
||||||
*/
|
*/
|
||||||
private void scheduleUpdate() {
|
private void scheduleUpdate() {
|
||||||
Display display = CUIPlugin.getStandardDisplay();
|
Display display = CUIPlugin.getStandardDisplay();
|
||||||
if (display != null) {
|
if (display != null) {
|
||||||
display.timerExec(UDPATE_DELAY_MS, this::updateUI);
|
display.timerExec(fUpdateDelay, this::updateUI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,6 +423,9 @@ public class BuildConsolePartitioner
|
||||||
if (event.getProperty() == BuildConsolePreferencePage.PREF_BUILDCONSOLE_LINES) {
|
if (event.getProperty() == BuildConsolePreferencePage.PREF_BUILDCONSOLE_LINES) {
|
||||||
setDocumentSize(BuildConsolePreferencePage.buildConsoleLines());
|
setDocumentSize(BuildConsolePreferencePage.buildConsoleLines());
|
||||||
}
|
}
|
||||||
|
if (event.getProperty() == BuildConsolePreferencePage.PREF_BUILDCONSOLE_UPDATE_DELAY_MS) {
|
||||||
|
fUpdateDelay = BuildConsolePreferencePage.buildConsoleUpdateDelayMs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
||||||
|
|
||||||
public static final String PREF_BUILDCONSOLE_TAB_WIDTH = "buildConsoleTabWith"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_TAB_WIDTH = "buildConsoleTabWith"; //$NON-NLS-1$
|
||||||
public static final String PREF_BUILDCONSOLE_LINES = "buildConsoleLines"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_LINES = "buildConsoleLines"; //$NON-NLS-1$
|
||||||
|
public static final String PREF_BUILDCONSOLE_UPDATE_DELAY_MS = "buildConsoleUpdateDelayMs"; //$NON-NLS-1$
|
||||||
public static final String PREF_BUILDCONSOLE_INFO_COLOR = "buildConsoleInfoStreamColor"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_INFO_COLOR = "buildConsoleInfoStreamColor"; //$NON-NLS-1$
|
||||||
public static final String PREF_BUILDCONSOLE_OUTPUT_COLOR = "buildConsoleOutputStreamColor"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_OUTPUT_COLOR = "buildConsoleOutputStreamColor"; //$NON-NLS-1$
|
||||||
public static final String PREF_BUILDCONSOLE_ERROR_COLOR = "buildConsoleErrorStreamColor"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_ERROR_COLOR = "buildConsoleErrorStreamColor"; //$NON-NLS-1$
|
||||||
|
@ -51,6 +52,22 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
||||||
public static final String PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR = "buildConsoleProblemInfoBackgroundColor"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR = "buildConsoleProblemInfoBackgroundColor"; //$NON-NLS-1$
|
||||||
public static final String PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR = "buildConsoleProblemHighlightedColor"; //$NON-NLS-1$
|
public static final String PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR = "buildConsoleProblemHighlightedColor"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the UI after a short delay. The reason for a short delay is to try
|
||||||
|
* and reduce the "frame rate" of the build console updates, this reduces
|
||||||
|
* the total load on the main thread. User's won't be able to tell that
|
||||||
|
* there is an extra delay.
|
||||||
|
*
|
||||||
|
* A too short time has little effect and a too long time starts to be
|
||||||
|
* visible to the user. With my experiments to get under 50% CPU utilization
|
||||||
|
* on the main thread requires at least 35 msec delay between updates. 250
|
||||||
|
* msec leads to visible delay to user and ~20% utilization. And finally the
|
||||||
|
* chosen value, 75 msec leads to ~35% utilization and no user visible
|
||||||
|
* delay.
|
||||||
|
*/
|
||||||
|
public static final int DEFAULT_BUILDCONSOLE_UPDATE_DELAY_MS = 75;
|
||||||
|
|
||||||
|
|
||||||
public BuildConsolePreferencePage() {
|
public BuildConsolePreferencePage() {
|
||||||
super(GRID);
|
super(GRID);
|
||||||
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
||||||
|
@ -87,6 +104,14 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
||||||
buildCount.setValidRange(10, Integer.MAX_VALUE);
|
buildCount.setValidRange(10, Integer.MAX_VALUE);
|
||||||
addField(buildCount);
|
addField(buildCount);
|
||||||
|
|
||||||
|
IntegerFieldEditor updateDelay = new IntegerFieldEditor(PREF_BUILDCONSOLE_UPDATE_DELAY_MS,
|
||||||
|
CUIPlugin.getResourceString("ConsolePreferencePage.consoleUpdateDelay.label"), parent); //$NON-NLS-1$
|
||||||
|
updateDelay.getLabelControl(parent).setToolTipText(CUIPlugin.getResourceString("ConsolePreferencePage.consoleUpdateDelay.tooltip")); //$NON-NLS-1$
|
||||||
|
updateDelay.getTextControl(parent).setToolTipText(CUIPlugin.getResourceString("ConsolePreferencePage.consoleUpdateDelay.tooltip")); //$NON-NLS-1$
|
||||||
|
updateDelay.setErrorMessage(CUIPlugin.getResourceString("ConsolePreferencePage.consoleUpdateDelay.errorMessage")); //$NON-NLS-1$
|
||||||
|
updateDelay.setValidRange(0, Integer.MAX_VALUE);
|
||||||
|
addField(updateDelay);
|
||||||
|
|
||||||
IntegerFieldEditor tabSize = new IntegerFieldEditor(PREF_BUILDCONSOLE_TAB_WIDTH,
|
IntegerFieldEditor tabSize = new IntegerFieldEditor(PREF_BUILDCONSOLE_TAB_WIDTH,
|
||||||
CUIPlugin.getResourceString("ConsolePreferencePage.tabWidth.label"), parent); //$NON-NLS-1$
|
CUIPlugin.getResourceString("ConsolePreferencePage.tabWidth.label"), parent); //$NON-NLS-1$
|
||||||
addField(tabSize);
|
addField(tabSize);
|
||||||
|
@ -155,6 +180,10 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
||||||
public static int buildConsoleLines() {
|
public static int buildConsoleLines() {
|
||||||
return CUIPlugin.getDefault().getPreferenceStore().getInt(PREF_BUILDCONSOLE_LINES);
|
return CUIPlugin.getDefault().getPreferenceStore().getInt(PREF_BUILDCONSOLE_LINES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int buildConsoleUpdateDelayMs() {
|
||||||
|
return CUIPlugin.getDefault().getPreferenceStore().getInt(PREF_BUILDCONSOLE_UPDATE_DELAY_MS);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IWorkbench workbench) {
|
public void init(IWorkbench workbench) {
|
||||||
|
@ -171,6 +200,8 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
|
||||||
prefs.setDefault(PREF_BUILDCONSOLE_WRAP_LINES, false);
|
prefs.setDefault(PREF_BUILDCONSOLE_WRAP_LINES, false);
|
||||||
if(!prefs.contains(PREF_BUILDCONSOLE_LINES))
|
if(!prefs.contains(PREF_BUILDCONSOLE_LINES))
|
||||||
prefs.setDefault(PREF_BUILDCONSOLE_LINES, 500);
|
prefs.setDefault(PREF_BUILDCONSOLE_LINES, 500);
|
||||||
|
if(!prefs.contains(PREF_BUILDCONSOLE_UPDATE_DELAY_MS))
|
||||||
|
prefs.setDefault(PREF_BUILDCONSOLE_UPDATE_DELAY_MS, DEFAULT_BUILDCONSOLE_UPDATE_DELAY_MS);
|
||||||
if(!prefs.contains(PREF_BUILDCONSOLE_TAB_WIDTH))
|
if(!prefs.contains(PREF_BUILDCONSOLE_TAB_WIDTH))
|
||||||
prefs.setDefault(PREF_BUILDCONSOLE_TAB_WIDTH, 4);
|
prefs.setDefault(PREF_BUILDCONSOLE_TAB_WIDTH, 4);
|
||||||
if(!prefs.contains(PREF_BUILDCONSOLE_OUTPUT_COLOR))
|
if(!prefs.contains(PREF_BUILDCONSOLE_OUTPUT_COLOR))
|
||||||
|
|
Loading…
Add table
Reference in a new issue