Skip to content

Commit

Permalink
IllegalStateException: call to beginTask() missing in the Help view
Browse files Browse the repository at this point in the history
This patch fixes following warning reported to the error log while
navigating between help topics in the Help view after
eclipse-platform/eclipse.platform.ui#1077:

java.lang.IllegalStateException: call to beginTask() missing
	at org.eclipse.jface.action.StatusLineManager$1.worked(StatusLineManager.java:221)
	at org.eclipse.help.ui.internal.views.BrowserPart$2.changed(BrowserPart.java:148)
	at org.eclipse.swt.browser.WebKit.lambda$15(WebKit.java:2492)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)

To avoid errors reported by the different monitor instances returned by
`IStatusLineManager.getProgressMonitor()`, browser listener has to keep
a single local monitor instance.

See eclipse-platform/eclipse.platform.ui#1398
  • Loading branch information
iloveeclipse committed Dec 12, 2023
1 parent 8a75d7c commit 610d57f
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,24 @@ public void changed(LocationEvent event) {
}
});
browser.addProgressListener(new ProgressListener() {
IProgressMonitor monitor;

@Override
public void changed(ProgressEvent e) {
if (e.current == e.total)
return;
IStatusLineManager slm = BrowserPart.this.parent
.getStatusLineManager();
IProgressMonitor monitor = slm != null ? slm
.getProgressMonitor() : null;

if (lastProgress == -1) {
lastProgress = 0;
IStatusLineManager slm = BrowserPart.this.parent.getStatusLineManager();
monitor = slm != null ? slm.getProgressMonitor() : null;
if (monitor != null) {
monitor.beginTask("", e.total); //$NON-NLS-1$
slm.setCancelEnabled(true);
}
} else if (monitor != null && monitor.isCanceled()) {
browser.stop();
monitor = null;
return;
}
if (monitor != null)
Expand All @@ -151,13 +152,13 @@ public void changed(ProgressEvent e) {

@Override
public void completed(ProgressEvent e) {
IStatusLineManager slm = BrowserPart.this.parent
.getStatusLineManager();
IProgressMonitor monitor = slm != null ? slm
.getProgressMonitor() : null;
if (monitor != null) {
slm.setCancelEnabled(false);
IStatusLineManager slm = BrowserPart.this.parent.getStatusLineManager();
if (slm != null) {
slm.setCancelEnabled(false);
}
monitor.done();
monitor = null;
}
lastProgress = -1;
if (fontScalePercentage != 100) {
Expand Down

0 comments on commit 610d57f

Please sign in to comment.