更新时间:2022-11-09 16:26:35
使用 Display.asyncExec 或 Display.syncExec,取决于您的需要.
Use Display.asyncExec or Display.syncExec, depending on your needs.
例如,另一个线程可能会调用此方法来安全地更新标签:
For example, another thread might call this method to safely update a label:
private static void doUpdate(final Display display, final Label target,
final String value) {
display.asyncExec(new Runnable() {
@Override
public void run() {
if (!target.isDisposed()) {
target.setText(value);
target.getParent().layout();
}
}
});
}