Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] IProgressMonitor and Saveable
[CDO] IProgressMonitor and Saveable [message #1059274] Thu, 16 May 2013 12:55 Go to next message
Eclipse UserFriend
Hi CDO Team,

In our application, on which we use CDO, we begin to use
IProgressMonitor, especially with
CDOTransaction.commit(IProgressMonitor). Sometimes we call the following
code snippet :

try {
new
ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell()).run(true,
true, new IRunnableWithProgress() {

@Override
public void run(IProgressMonitor monitor) throws
InvocationTargetException, InterruptedException {
try {
cdoTransaction.commit(monitor);
} catch (CommitException e) {
e.printStackTrace();
}
}
});
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

With that the CDO server notify correctly the progress monitor on the
client through org.eclipse.net4j.signal.RequestWithMonitoring$1 .

But in the case of saving through a IEditorPart, it is a Saveable which
is used. Concretely it is
org.eclipse.ui.Saveable.doSave(org.eclipse.core.runtime.IProgressMonitor) which
is called by org.eclipse.jface.window.ApplicationWindow.run() with a
org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor. But this
EventLoopProgressMonitor when called by RequestWithMonitoring$ throws a
"org.eclipse.swt.SWTException: Invalid thread access" because of call to
EventLoopProgressMonitor.runEventLoop().
It is not a CDO bug but rather a Eclipse UI bug. I have not found
workaround to this issue. Does anyone have a idea of workaround/fix?

Best Regards.
Re: [CDO] IProgressMonitor and Saveable [message #1059276 is a reply to message #1059274] Thu, 16 May 2013 17:37 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 16.05.2013 14:55, schrieb news.eclipse.org:
> Hi CDO Team,
>
> In our application, on which we use CDO, we begin to use IProgressMonitor, especially with
> CDOTransaction.commit(IProgressMonitor). Sometimes we call the following code snippet :
>
> try {
> new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell()).run(true, true, new
> IRunnableWithProgress() {
>
> @Override
> public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
> try {
> cdoTransaction.commit(monitor);
> } catch (CommitException e) {
> e.printStackTrace();
> }
> }
> });
> } catch (InvocationTargetException e) {
> e.printStackTrace();
> } catch (InterruptedException e) {
> e.printStackTrace();
> }
> }
>
> With that the CDO server notify correctly the progress monitor on the client through
> org.eclipse.net4j.signal.RequestWithMonitoring$1 .
>
> But in the case of saving through a IEditorPart, it is a Saveable which is used. Concretely it is
> org.eclipse.ui.Saveable.doSave(org.eclipse.core.runtime.IProgressMonitor) which is called by
> org.eclipse.jface.window.ApplicationWindow.run() with a org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor. But
> this EventLoopProgressMonitor when called by RequestWithMonitoring$ throws a "org.eclipse.swt.SWTException: Invalid
> thread access" because of call to EventLoopProgressMonitor.runEventLoop().
> It is not a CDO bug but rather a Eclipse UI bug. I have not found workaround to this issue. Does anyone have a idea of
> workaround/fix?
I would expect that a "runner", e.g., ApplicationWindow.run(), does generally not restrict a runnable to a particular
thread to display the progress correctly. Have you asked the JFace team about this?

On the other hand I could imagine that org.eclipse.net4j.signal.RequestWithMonitoring could be enhanced such that all
IProgressMonitor calls are made on the thread that calls RequestWithConfirmation.send(), which is currently not the case
because the progress signals from the server arrive on a different (signal-specific) thread.

This would be a huge effort and I would first like to see the reasinging of the Platform team regarding why this
restriction is inherent to org.eclipse.ui.Saveable.doSave() and not
org.eclipse.jface.dialogs.ProgressMonitorDialog.run(). Please point me to a respective bugzilla/forum discussion.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:[Teneo][Hibernate] Hints on general usage or lifecycle
Next Topic:EMF Languge Pack do not work
Goto Forum:
  


Current Time: Thu Apr 18 23:30:35 GMT 2024

Powered by FUDForum. Page generated in 0.02191 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top