请您指教如何使用
org.eclipse.swt.ole.win32.OleFrame
在非 UI 线程中?如果在非 UI 线程中完成,则创建一个“OleFrame”。我确实知道 UI 和非 UI 线程之间的区别。我想要实现的是org.eclipse.swt.ole.win32.OleAutomation
在`IRunnableWithProgress
添加
for(;mShell.getDisplay().readAndDispatch(););
(mShell
在构造函数中给出)在每个 OLE 调用之后有一点帮助,但还不够......
任何帮助将不胜感激。
OutlookHelper outlook = new OutlookHelper(mShell, mModel.getEmailToAddresses(), "Feedback report", emailInfo.body, attachment);
new ProgressMonitorDialog(mShell).run(true, false, outlook);
.
public class OutlookHelper implements IRunnableWithProgress {
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Sending...", IProgressMonitor.UNKNOWN);
send(monitor);
monitor.done();
}
private void send(IProgressMonitor monitor) throws InterruptedException {
monitor.subTask("Creating OLE frame");
// Will block UI thread here ...
final OleFrame frame = new OleFrame(mShell, SWT.NONE);
monitor.subTask("Starting Outlook application");
// Will block UI thread here ...
OleClientSite site = new OleClientSite(frame, SWT.NONE, "Outlook.Application");
...
}
}