既然是SWTException,我就使用了辛夫特办法,但甚至我也无法从我的法典中解决SWTException问题。 建议。
public class SampleSwtAction implements IWorkbenchWindowActionDelegate {
private IWorkbenchWindow window;
public SampleSwtAction() {
}
public void run(IAction action) {
MessageDialog.openInformation(
window.getShell(),
"SampleSwt",
"Hello,Run swt application");
window.getShell().getDisplay().syncExec(
new Runnable() {
public void run(){
Display firstDisplay = new Display();
Shell firstShell = new Shell(firstDisplay);
firstShell.setText("Sample SWT application");
firstShell.setSize(200,100);
firstShell.open ();
while (!firstShell.isDisposed()) {
if (!firstDisplay.readAndDispatch())
firstDisplay.sleep ();
}
firstDisplay.dispose ();
}
});
}
public void selectionChanged(IAction action, ISelection selection) {
}
public void dispose() {
}
public void init(IWorkbenchWindow window) {
this.window = window;
}
}