バックグラウンドで操作を実行している場合、プロセスが完了するまでカーソルをビジーに設定しています。プロセスが完了するまで、現在のディスプレイ/ダイアログ/シェルをグレー表示して無効にする方法はありますか? 何かが機能していて、待つ必要があることをユーザーに視覚的に知らせたい.
編集
plotButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
getShell().setEnabled(!getShell().getEnabled());
getShell().setCursor(new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT));
recursiveSetEnabled(getShell(), getShell().getEnabled());
startPrinterListOperation(); <== This is method that runs operation
}
});
プリンター操作を実行するメソッド。
private void startPrinterListOperation() {
listOp = new AplotPrinterListOperation(appReg.getString("aplot.message.GETPRINTERLIST"), session);
listOp.addOperationListener(new MyOperationListener(this) {
public void endOperationImpl() {
try {
printers.clear();
printers.addAll((ArrayList<PrinterProfile>) listOp.getPrinters());
Display.getDefault().asyncExec(new Runnable() {
public void run() {
showAplotPlotterDialog(); <== When operation returns - opens selection dialog
}
});
}
finally {
listOp.removeOperationListener(this);
listOp = null;
}
}
});
session.queueOperation(listOp);
} // end startPrinterListOperation()
showAplotPlotterDialog() (別のクラス) は、ネットワーク プリンターのダイアログを開き、ボタンを押すと、選択したプリンターにジョブを送信します。その操作が終了すると、Plotter Dialog が閉じます - これでそのメソッドは終了です - baseDialog がメイン GUI です
finally {
plotOp.removeOperationListener(this);
plotOp = null;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
baseDialog.removeAllTableRows();
baseDialog.plotRequestCompleted = true;
baseDialog.setResultsButtonVisibility();
getShell().close();
}
});
}