mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 10:30:44 +01:00
Change Editor status message only from EDT
This adapter invokes all status changes on the EDT instead of worker thread of the Runner. Modifying AWT components from the worker threads may introduce strange bugs and in this case caused UI changes to run out of order, hiding runtime exceptions under problems displayed when cursor moves to the offending line.
This commit is contained in:
48
app/src/processing/app/RunnerListenerEdtAdapter.java
Normal file
48
app/src/processing/app/RunnerListenerEdtAdapter.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package processing.app;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
|
||||
public class RunnerListenerEdtAdapter implements RunnerListener {
|
||||
|
||||
private RunnerListener wrapped;
|
||||
|
||||
public RunnerListenerEdtAdapter(RunnerListener wrapped) {
|
||||
this.wrapped = wrapped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void statusError(String message) {
|
||||
EventQueue.invokeLater(() -> wrapped.statusError(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void statusError(Exception exception) {
|
||||
EventQueue.invokeLater(() -> wrapped.statusError(exception));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void statusNotice(String message) {
|
||||
EventQueue.invokeLater(() -> wrapped.statusNotice(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startIndeterminate() {
|
||||
EventQueue.invokeLater(() -> wrapped.startIndeterminate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopIndeterminate() {
|
||||
EventQueue.invokeLater(() -> wrapped.stopIndeterminate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void statusHalt() {
|
||||
EventQueue.invokeLater(() -> wrapped.statusHalt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHalted() {
|
||||
return wrapped.isHalted();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user