Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF databinding and undo in a FormEditor
EMF databinding and undo in a FormEditor [message #422552] Tue, 09 September 2008 08:37 Go to next message
Eclipse UserFriend
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 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
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">&lt; http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_an_Eclips e_Forms_editor_with_widgets_for_your_properties&gt;</a>.
The editor uses a basic
org.eclipse.emf.edit.ui.action.EditingDomainActionBarContrib utor. I
also &nbsp;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>
&nbsp;&nbsp;&nbsp; commandStack.addCommandStackListener<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (new CommandStackListener()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; public void commandStackChanged(final EventObject event)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; getContainer().getDisplay().asyncExec<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (new Runnable()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; public void run()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; firePropertyChange(IEditorPart.PROP_DIRTY);<br>
<br>
<br>
And editingDomainActionBarContributor responds to it because it listens
for property changes:<br>
<blockquote>&nbsp; public void propertyChanged(Object source, int id)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; update();<br>
&nbsp; }<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/
Previous Topic:Re: [Announce] UFacekit component proposal
Next Topic:Teneo - Use Spring data source definition for HbSessionDataStore
Goto Forum:
  


Current Time: Fri Apr 26 23:32:18 GMT 2024

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

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

Back to the top