|
Re: EMF Undo/Redo Menu Items Not Updating Automatically with Databinding [message #1718371 is a reply to message #1718362] |
Wed, 23 December 2015 06:09 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Jim,
A generated editor has a command stack listener:
commandStack.addCommandStackListener
(new CommandStackListener()
{
public void commandStackChanged(final EventObject event)
{
getContainer().getDisplay().asyncExec
(new Runnable()
{
public void run()
{
firePropertyChange(IEditorPart.PROP_DIRTY);
// Try to select the affected objects.
//
Command mostRecentCommand =
((CommandStack)event.getSource()).getMostRecentCommand();
if (mostRecentCommand != null)
{
setSelectionToViewer(mostRecentCommand.getAffectedObjects());
}
for (Iterator<PropertySheetPage> i =
propertySheetPages.iterator(); i.hasNext(); )
{
PropertySheetPage propertySheetPage = i.next();
if (propertySheetPage.getControl().isDisposed())
{
i.remove();
}
else
{
propertySheetPage.refresh();
}
}
}
});
}
});
So when a command is executed, the dirty state of the editor is checked
and the selection is updated (which updates all the actions). I'm not
sure what's going on with this logic in your specific case, but that's
the place to look... It's
org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor.update() that
updates the undo action and
org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor.propertyChanged(Object,
int) would normally trigger this. Likely there is some issue with the
editor not being considered active when your property editor is active...
On 23/12/2015 12:03 AM, Jim Boone wrote:
> Hi,
>
> I am having an issue that some out there knows the answer to
> intuitively but I am not yet at that level of expertise :blush:
> I am basically creating a forms based property editor for ecore
> models. I want to use all of the built-in functionality of ecore, but
> simply create a custom property editing interface for my users. I have
> copied the stock EcoreEditor class into my project and replaced the
> table property editor with a forms-based tabbed editor. I am using EMF
> databinding to bind the UI with the Ecore model. Everything is
> working great, the editing domain is being used, the command stack
> contains my updates, etc. The problem is, when I change a property
> value in one of my SWT text fields and fire the binding update event,
> the model is updated but the menu Edit->Undo command does not change
> to Edit->Undo Set until I click on the tree viewer. It looks like the
> undo/redo menu items then refresh and I am able to take advantage of
> undo/redo. The question is, what do I need to do to force the menu
> update and why does it work fine with the stock ecore properties editor?
> I have been struggling with this issue for hours and have finally
> decided to throw in the towel. Any advice is welcome. Thanks!
>
> --Jim
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03347 seconds