| Saving Editor in a AbstractCustomFeature = UI Deadlock [message #909722] |
Fri, 07 September 2012 12:39  |
Sir Wayne Messages: 170 Registered: July 2009 |
Senior Member |
|
|
Hello community,
if i save a editor in a custom feature i will get a ui deadlock. A ProgressMonitor is still running and never end. The feature is execute by a ContextButtonEntry. The Deadlock occurs in the in org.eclipse.emf.transaction.util.Lock.class row 357.
Is it my fault or a bug?
public class MyCustomFeature extends AbstractCustomFeature
{
public MyCustomFeature(IFeatureProvider fp)
{
super(fp);
}
@Override
public void execute(ICustomContext context)
{
//My Editor (GrapthitEditor) Deadlock in org.eclipse.emf.transaction.util.Lock.class 357
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().doSave(new NullProgressMonitor());
}
}
EDIT:
The UI Deadlock occurs in OrderedLock row 175
try {
success = semaphore.acquire(delay);
} catch (InterruptedException e) {
if (DEBUG)
System.out.println("[" + currentThread + "] Operation interrupted while waiting... :-|"); //$NON-NLS-1$ //$NON-NLS-2$
//remember the interrupt to throw it later
currentThread.interrupt();
}
Thanks
[Updated on: Fri, 07 September 2012 12:47] Report message to a moderator
|
|
|
|
| Re: Saving Editor in a AbstractCustomFeature = UI Deadlock [message #910708 is a reply to message #910685] |
Mon, 10 September 2012 04:57   |
Sir Wayne Messages: 170 Registered: July 2009 |
Senior Member |
|
|
Yes i can explain the problem, what i need is a subtransaction.
We have a Feature which can only execute if the editor is not dirty.
If the editor is dirty, the user get a save dialog (yes/no/cancel dialog) and should save the editor.
Do you have a idea, how could i handle this in a feature? Asynchron doesn't work, because we have to wait until the editor is saved.
EDIT: But the Add and Create Feature do the same. You can call in AbstractCreateFeature the addGraphicalRepresentation method. The addGraphicalRepresentation create a new Command (AbstractAddShapeFeature) and execute
it. So it's a command (create) in a command (add)
Example AbstractCreateFeature.
@Override
public Object[] create(ICreateContext context)
{
//create stuff
....
// do the add and execute a new add command
addGraphicalRepresentation(context, eObject);
return ...
[Updated on: Mon, 10 September 2012 05:14] Report message to a moderator
|
|
|
|
| Re: Saving Editor in a AbstractCustomFeature = UI Deadlock [message #910770 is a reply to message #910750] |
Mon, 10 September 2012 07:21  |
Sir Wayne Messages: 170 Registered: July 2009 |
Senior Member |
|
|
Michael Wenz wrote on Mon, 10 September 2012 06:29I see. Inside your feature you could check if the editor is saved, if yes
simply execute the operataion. If no, asynchronously trigger the saving of
the editor and end the feature. In the runnable where you save the editor,
you can simply retrigger your feature again (probably again asynchronously)
via DiagramEditor.executeFeature().
I haven't tried that but it should work.
Thanks works =)
|
|
|
Powered by
FUDForum. Page generated in 0.01590 seconds