मैं ऑपरेशन शुरू करते समय कर्सर को बदलने की कोशिश कर रहा हूं। मैं कर्सर ऑपरेशन समाप्त होने तक व्यस्त दिखाना चाहता हूं। मेरे पास ऑपरेशन लिस्टर के लिए एक अलग वर्ग है। मुझे यकीन नहीं है कि कर्सर को कैसे असाइन किया जाए? AplotBaseDialog वर्ग सेएसडब्ल्यूटी - एक व्यस्त कर्सर दिखा रहा है
कॉल
listOp.addOperationListener(new MyOperationListener(this) {
etc....
}
अलग वर्ग
public abstract class MyOperationListener implements InterfaceAIFOperationListener {
Cursor busyCursor = null;
AplotBaseDialog w = null;
public MyOperationListener(AplotBaseDialog win) {
**Should this not be getCurrent?**
busyCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT);
w = win;
} // end constructor
public void startOperation(String startMessage) {
** should this be getting a Shell form the AplotBaseDialog? **
w.???.setCursor(busyCursor);
} // end startOperation()
public void endOperation() {
try {
endOperationImpl();
}
finally {
w.???.setCursor(null);
}
} // end endOperation()
abstract protected void endOperationImpl();
} // end class MyOperationListener
संपादित
plotButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
BusyIndicator.showWhile(Display.getDefault(), new Runnable(){
public void run(){
startPrinterListOperation();
}
});
}
});
संपादित
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();
}
});
}
finally {
listOp.removeOperationListener(this);
listOp = null;
}
}
});
session.queueOperation(listOp);
} // end startPrinterListOperation()
मैंने मूल रूप से उपरोक्त लाइनों को अपनी ऑपरेशन विधि में जोड़ा क्योंकि यह संवाद शुरू होने से ठीक पहले शुरू हुआ और ऐसा लगता है। मैं वास्तव में चाहता हूं कि मैं यह पता लगा सकता हूं कि इसे अमूर्त ऑपरेशन क्लास में कैसे काम किया जाए। लेकिन ऐसा लगता है कि यह वही प्रभाव है। - धन्यवाद – jkteater