Saving Editor in a AbstractCustomFeature = UI Deadlock [message #909722] |
Fri, 07 September 2012 16:39 |
Dennis Melzer Messages: 244 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 16: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 08:57 |
Dennis Melzer Messages: 244 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 09:14] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02990 seconds