EMF databinding and undo in a FormEditor [message #422552] |
Tue, 09 September 2008 08:37 |
Eclipse User |
|
|
|
Hi,
I have been struggling a lot to get undo working in my editor with 3
pages, 2 with forms and teh last with an XML editor. I have set up the
EMF databinding according to recipe
< http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_an_Eclips e_Forms_editor_with_widgets_for_your_properties>.
The editor uses a basic
org.eclipse.emf.edit.ui.action.EditingDomainActionBarContrib utor. I also
use (after tip in newsgroup) EMFEditObservables.
I have problems getting UNDO and REDO working. The command stack seems
to look fine, but the undo/redo are always disabled. Anyone with
pointers how to attack/debug the problem? How should the activation of
these menus be triggered and carried out when a command is executed?
Thanks,
/Ola
|
|
|
Re: EMF databinding and undo in a FormEditor [message #422561 is a reply to message #422552] |
Tue, 09 September 2008 12:56 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090605030307080401090001
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Ola,
Comments below.
Ola Spjuth wrote:
> Hi,
>
> I have been struggling a lot to get undo working in my editor with 3
> pages, 2 with forms and teh last with an XML editor. I have set up the
> EMF databinding according to recipe
> < http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_an_Eclips e_Forms_editor_with_widgets_for_your_properties>.
> The editor uses a basic
> org.eclipse.emf.edit.ui.action.EditingDomainActionBarContrib utor. I
> also use (after tip in newsgroup) EMFEditObservables.
>
> I have problems getting UNDO and REDO working. The command stack seems
> to look fine, but the undo/redo are always disabled.
Are the CommandStack's methods canUndo and canRedo being called?
> Anyone with pointers how to attack/debug the problem? How should the
> activation of these menus be triggered and carried out when a command
> is executed?
When the command stack does something, this fires a property change
commandStack.addCommandStackListener
(new CommandStackListener()
{
public void commandStackChanged(final EventObject event)
{
getContainer().getDisplay().asyncExec
(new Runnable()
{
public void run()
{
firePropertyChange(IEditorPart.PROP_DIRTY);
And editingDomainActionBarContributor responds to it because it listens
for property changes:
public void propertyChanged(Object source, int id)
{
update();
}
>
> Thanks,
>
> /Ola
--------------090605030307080401090001
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ola,<br>
<br>
Comments below.<br>
<br>
Ola Spjuth wrote:
<blockquote cite="mid:ga5ce5$mrd$1@build.eclipse.org" type="cite">Hi,
<br>
<br>
I have been struggling a lot to get undo working in my editor with 3
pages, 2 with forms and teh last with an XML editor. I have set up the
EMF databinding according to recipe
<a class="moz-txt-link-rfc2396E" href=" http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_an_Eclips e_Forms_editor_with_widgets_for_your_properties">< http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_an_Eclips e_Forms_editor_with_widgets_for_your_properties></a>.
The editor uses a basic
org.eclipse.emf.edit.ui.action.EditingDomainActionBarContrib utor. I
also use (after tip in newsgroup) EMFEditObservables.
<br>
<br>
I have problems getting UNDO and REDO working. The command stack seems
to look fine, but the undo/redo are always disabled. </blockquote>
Are the CommandStack's methods canUndo and canRedo being called?<br>
<br>
<blockquote cite="mid:ga5ce5$mrd$1@build.eclipse.org" type="cite">Anyone
with pointers how to attack/debug the problem? How should the
activation of these menus be triggered and carried out when a command
is executed?
<br>
</blockquote>
<br>
When the command stack does something, this fires a property change<br>
<br>
commandStack.addCommandStackListener<br>
(new CommandStackListener()<br>
{<br>
public void commandStackChanged(final EventObject event)<br>
{<br>
getContainer().getDisplay().asyncExec<br>
(new Runnable()<br>
{<br>
public void run()<br>
{<br>
firePropertyChange(IEditorPart.PROP_DIRTY);<br>
<br>
<br>
And editingDomainActionBarContributor responds to it because it listens
for property changes:<br>
<blockquote> public void propertyChanged(Object source, int id)<br>
{<br>
update();<br>
}<br>
</blockquote>
<blockquote cite="mid:ga5ce5$mrd$1@build.eclipse.org" type="cite"><br>
Thanks,
<br>
<br>
/Ola
<br>
</blockquote>
</body>
</html>
--------------090605030307080401090001--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.08044 seconds