How to save editor [message #632336] |
Tue, 12 October 2010 15:24 |
Jan Krakora Messages: 477 Registered: December 2009 Location: Prague |
Senior Member |
|
|
Hi guys,
my editor works with a model object which itself represents some data from a database.
I would like to save the changed model to the database, thus I override the doSave method in my editor. First I would like to open the ProgressMonitorDialog with the progress bar, then I woul like to show the busy indicator and do few things.
public void doSave(IProgressMonitor monitor) {
final ProgressMonitorDialog pd = new ProgressMonitorDialog(RcpUtils.getWorkbenchShell());
final IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Saving to the database...", IProgressMonitor.UNKNOWN);
// This sleep represents saving to the database at this moment
Thread.sleep(5000);
monitor.done();
}
};
try {
pd.run(true, false, runnable);
} catch (Exception e) {
e.printStackTrace();
}
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
// This sleep represents an action with other editor
Thread.sleep(2000);
setDirty(false);
}
});
}
The problem is, that busy indicator doesn't work properly. There in no busy indicator and all the UI is frozen. What do I wrong?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03135 seconds