Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Undo for changes in property tab does not work
Undo for changes in property tab does not work [message #201977] Thu, 14 August 2008 12:57 Go to next message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 47
Registered: July 2009
Member
Dear Community,

I am trying to use the undo function, when modifying elements via the
properties view.
However, these changes do not seem be executed via the operationhistory,
which means, <undo> does not work at all.

I tried to override the update-method in the generated XXXPropertySection
as follows:
@Override
public void update(Notification notification, EObject element) {
super.update(notification, element);
TransactionalEditingDomain domain =
TransactionUtil.getEditingDomain(element);
SetRequest request = new SetRequest(domain,element,
(EStructuralFeature)notification.getFeature(),notification.g etNewValue());
SetValueCommand cmd = new SetValueCommand(request);
try {
ActionManager.getDefault().getOperationHistory().execute(cmd , null,
null);
}
catch (ExecutionException e) {
e.printStackTrace();
}
}

This approach works nicely - the setting and unsetting works, but the
console shows the following error-message:
Cannot activate read/write transaction in read-only transaction context
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.acquire(TransactionalEditingDomainImpl.java:537)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.activate(TransactionalEditingDomainImpl.java:469)
at
org.eclipse.emf.transaction.impl.TransactionImpl.start(Trans actionImpl.java:184)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.startTransaction(TransactionalEditingDomainImpl.java:385 )
at
org.eclipse.emf.workspace.AbstractEMFOperation.createTransac tion(AbstractEMFOperation.java:489)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:154)
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:511)
... 139 more

I don't know how to make the transaction read-write or use another
approach to get the undo-funtion working for modifications via the
property-tabs.
Modifications via the diagram work fine. However, not all features can be
changed via the diagram.
This issue occurs for the Core-Tab (domain model features) as well as view
features in the Appearance-Tab.
Is there any registering required?


Any help or hint is very much appreciated.

TIA
Thomas
Re: Undo for changes in property tab does not work [message #202093 is a reply to message #201977] Fri, 15 August 2008 13:37 Go to previous messageGo to next message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 47
Registered: July 2009
Member
Replacing the GMF-SetValueCommand-stuff to the EMF-command as follows:

@Override
public void update(Notification notification, EObject element) {
super.update(notification, element);
TransactionalEditingDomain domain =
TransactionUtil.getEditingDomain(element);
SetCommand cmd = (SetCommand)SetCommand.create(domain, element,
EStructuralFeature) notification.getFeature(),
notification.getNewValue());
domain.getCommandStack().execute(cmd);
}

seems to do the trick in the generated XXPropertySection.

However, was it the intention to provide the generated PropertySections
and stardard hooked (via plugin.xml) sections without the history
mechanism?

If so, clients would still have to subclass and modify the standard:
- ConnectionAppearancePropertySection
- ShapeColorAndFontPropertySection
- DiagramColorsAndFontsPropertySection
- RulerGridPropertySection
- generated XXXPropertySection
to allow undo/redo when setting properties via the properties view.
Changing theses properties from the diagram context menu works like a
charme ;-)

I'd be glad for some response.

TIA
Thomas
Re: Undo for changes in property tab does not work [message #202228 is a reply to message #202093] Mon, 18 August 2008 12:59 Go to previous messageGo to next message
Michael Haeberlen is currently offline Michael HaeberlenFriend
Messages: 52
Registered: July 2009
Member
Thomas,

Undo should definitively work without custom modifications, also for Properties view.
Did you do any custom code after diagram generation? I would recommend to undo the changes you did and search for the
reason why undo does not work.

Regards,
Michael

Thomas Beyer wrote:
> Replacing the GMF-SetValueCommand-stuff to the EMF-command as follows:
>
> @Override
> public void update(Notification notification, EObject element) {
> super.update(notification, element);
> TransactionalEditingDomain domain =
> TransactionUtil.getEditingDomain(element);
> SetCommand cmd = (SetCommand)SetCommand.create(domain, element,
> EStructuralFeature) notification.getFeature(),
> notification.getNewValue());
> domain.getCommandStack().execute(cmd);
> }
>
> seems to do the trick in the generated XXPropertySection.
>
> However, was it the intention to provide the generated PropertySections
> and stardard hooked (via plugin.xml) sections without the history
> mechanism?
>
> If so, clients would still have to subclass and modify the standard:
> - ConnectionAppearancePropertySection
> - ShapeColorAndFontPropertySection
> - DiagramColorsAndFontsPropertySection
> - RulerGridPropertySection
> - generated XXXPropertySection
> to allow undo/redo when setting properties via the properties view.
> Changing theses properties from the diagram context menu works like a
> charme ;-)
>
> I'd be glad for some response.
>
> TIA
> Thomas
>
Re: Undo for changes in property tab does not work [message #202264 is a reply to message #202228] Mon, 18 August 2008 16:04 Go to previous messageGo to next message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 47
Registered: July 2009
Member
Hi Michael,

thank you for your reply.
Yes, i have done qiet a lot of customization to the default generated
editor.
However, I came to the same assumption as you before my initial post.
So I regenerated the entire code from scratch and tested it without any
customizations at all to ensure, I didn't break any default mechanisms.

Still, I came to the same conclusion, that undo via the property-tabs does
not work for me.

Micheal, if you could please do me a favor and try the following:
Create any diagram content for your generated editor.
Restart the application and do nothing but changing any label's
appearance property (lets say set font to bold) via the property-section.
Nothing more, nothing less. (Application restart should only make sure,
the Operation history is clean)
Can you do an undo/redo for this font-change?

If so, the reason for my problem must be in my .gmfgraph or .gmfgen-model.

I just tried the GeoShape-example and it shows exactly the same behavior
as my generated code. No undo/redo-functionality from the properties view,
but from the editor-context menu.
So I guess, this is an GMF-issue.


Could I ask for some feedback from the any GMF-Team on this issue, please?


TIA
Thomas




Michael Haeberlen wrote:

> Thomas,

> Undo should definitively work without custom modifications, also for
Properties view.
> Did you do any custom code after diagram generation? I would recommend to
undo the changes you did and search for the
> reason why undo does not work.

> Regards,
> Michael

> Thomas Beyer wrote:
>> Replacing the GMF-SetValueCommand-stuff to the EMF-command as follows:
>>
>> @Override
>> public void update(Notification notification, EObject element) {
>> super.update(notification, element);
>> TransactionalEditingDomain domain =
>> TransactionUtil.getEditingDomain(element);
>> SetCommand cmd = (SetCommand)SetCommand.create(domain, element,
>> EStructuralFeature) notification.getFeature(),
>> notification.getNewValue());
>> domain.getCommandStack().execute(cmd);
>> }
>>
>> seems to do the trick in the generated XXPropertySection.
>>
>> However, was it the intention to provide the generated PropertySections
>> and stardard hooked (via plugin.xml) sections without the history
>> mechanism?
>>
>> If so, clients would still have to subclass and modify the standard:
>> - ConnectionAppearancePropertySection
>> - ShapeColorAndFontPropertySection
>> - DiagramColorsAndFontsPropertySection
>> - RulerGridPropertySection
>> - generated XXXPropertySection
>> to allow undo/redo when setting properties via the properties view.
>> Changing theses properties from the diagram context menu works like a
>> charme ;-)
>>
>> I'd be glad for some response.
>>
>> TIA
>> Thomas
>>
Re: Undo for changes in property tab does not work [message #202338 is a reply to message #202264] Tue, 19 August 2008 07:41 Go to previous messageGo to next message
Michael Haeberlen is currently offline Michael HaeberlenFriend
Messages: 52
Registered: July 2009
Member
Thomas,

undo/redo does work for generated editors and for GeoShape as well. I never had an issue with it.
I also doubt that is has to do with .gmfgen since it is a fundamental feature.

One thing I noticed: there is an "undo" action in the context menu of the properties view which seems to be always
greyed out (not sure what it is meant for). But this is *NOT* the global undo action you'd need. What you have to do is
go to the "Edit" menu item of your workbench window and there you see your "Undo ..." action in the first place.
Alternatively you can use CTRL+Z for undo and CTRL+Y for redo.

Regards, Michael

Thomas Beyer wrote:
> Hi Michael,
>
> thank you for your reply.
> Yes, i have done qiet a lot of customization to the default generated
> editor.
> However, I came to the same assumption as you before my initial post.
> So I regenerated the entire code from scratch and tested it without any
> customizations at all to ensure, I didn't break any default mechanisms.
>
> Still, I came to the same conclusion, that undo via the property-tabs
> does not work for me.
>
> Micheal, if you could please do me a favor and try the following:
> Create any diagram content for your generated editor.
> Restart the application and do nothing but changing any label's
> appearance property (lets say set font to bold) via the
> property-section. Nothing more, nothing less. (Application restart
> should only make sure, the Operation history is clean)
> Can you do an undo/redo for this font-change?
>
> If so, the reason for my problem must be in my .gmfgraph or .gmfgen-model.
>
> I just tried the GeoShape-example and it shows exactly the same behavior
> as my generated code. No undo/redo-functionality from the properties
> view, but from the editor-context menu.
> So I guess, this is an GMF-issue.
>
>
> Could I ask for some feedback from the any GMF-Team on this issue, please?
>
>
> TIA
> Thomas
>
>
>
>
> Michael Haeberlen wrote:
>
>> Thomas,
>
>> Undo should definitively work without custom modifications, also for
> Properties view.
>> Did you do any custom code after diagram generation? I would recommend to
> undo the changes you did and search for the
>> reason why undo does not work.
>
>> Regards,
>> Michael
>
>> Thomas Beyer wrote:
>>> Replacing the GMF-SetValueCommand-stuff to the EMF-command as follows:
>>>
>>> @Override
>>> public void update(Notification notification, EObject element) {
>>> super.update(notification, element);
>>> TransactionalEditingDomain domain =
>>> TransactionUtil.getEditingDomain(element);
>>> SetCommand cmd = (SetCommand)SetCommand.create(domain, element,
>>> EStructuralFeature) notification.getFeature(),
>>> notification.getNewValue());
>>> domain.getCommandStack().execute(cmd);
>>> }
>>>
>>> seems to do the trick in the generated XXPropertySection.
>>>
>>> However, was it the intention to provide the generated
>>> PropertySections and stardard hooked (via plugin.xml) sections
>>> without the history mechanism?
>>>
>>> If so, clients would still have to subclass and modify the standard:
>>> - ConnectionAppearancePropertySection
>>> - ShapeColorAndFontPropertySection
>>> - DiagramColorsAndFontsPropertySection
>>> - RulerGridPropertySection
>>> - generated XXXPropertySection
>>> to allow undo/redo when setting properties via the properties view.
>>> Changing theses properties from the diagram context menu works like a
>>> charme ;-)
>>>
>>> I'd be glad for some response.
>>>
>>> TIA
>>> Thomas
>>>
>
>
>
Re: Undo for changes in property tab does not work [message #202408 is a reply to message #201977] Tue, 19 August 2008 10:47 Go to previous messageGo to next message
Seweryn Niemiec is currently offline Seweryn NiemiecFriend
Messages: 80
Registered: July 2009
Member
Thomas Beyer wrote:
> Dear Community,
>
> I am trying to use the undo function, when modifying elements via the
> properties view.
> However, these changes do not seem be executed via the operationhistory,
> which means, <undo> does not work at all.

Cool, I'm not alone. I have the same problem. I'm using GMF version
2.1.0, what is your version?

Is here any user of GMF 2.1.0 who can undo changes made through the
Properties View?

I don't think that the lack of undo functionality is a result of custom
code modifications. The Mindmap example from eclipse.org CVS has the
same problem.

Greetings
Seweryn
Re: Undo for changes in property tab does not work [message #202415 is a reply to message #202408] Tue, 19 August 2008 11:05 Go to previous messageGo to next message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 47
Registered: July 2009
Member
Seweryn,


I was noticing this issue with the ganymede-package (GMF 2.1.0).
I upgraded to GMF 2.1.1 yesterday, because bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=243596
seemed to be related to the properties.
After testing with GMF 2.1.1, the problem still is present.

I am not really sure where to go from here.
Do we file a bug report, because the feature we want is supposed to be
covered by GMF, or do we file a feature request, because GMF never
intended to provide undo/redo via properties?


Regards,
Thomas


Seweryn Niemiec wrote:

> Thomas Beyer wrote:
>> Dear Community,
>>
>> I am trying to use the undo function, when modifying elements via the
>> properties view.
>> However, these changes do not seem be executed via the operationhistory,
>> which means, <undo> does not work at all.

> Cool, I'm not alone. I have the same problem. I'm using GMF version
> 2.1.0, what is your version?

> Is here any user of GMF 2.1.0 who can undo changes made through the
> Properties View?

> I don't think that the lack of undo functionality is a result of custom
> code modifications. The Mindmap example from eclipse.org CVS has the
> same problem.

> Greetings
> Seweryn
Re: Undo for changes in property tab does not work [message #202497 is a reply to message #202415] Tue, 19 August 2008 16:40 Go to previous messageGo to next message
Michael Haeberlen is currently offline Michael HaeberlenFriend
Messages: 52
Registered: July 2009
Member
I'm sorry, I had previously checked with GMF 2.0, where everything works fine. I could reporduce the problem with GMF
2.1. This is definitively a bug, IMO.

Regards, Michael

Thomas Beyer wrote:
> Seweryn,
>
>
> I was noticing this issue with the ganymede-package (GMF 2.1.0).
> I upgraded to GMF 2.1.1 yesterday, because bug
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=243596
> seemed to be related to the properties.
> After testing with GMF 2.1.1, the problem still is present.
>
> I am not really sure where to go from here.
> Do we file a bug report, because the feature we want is supposed to be
> covered by GMF, or do we file a feature request, because GMF never
> intended to provide undo/redo via properties?
>
>
> Regards, Thomas
>
>
> Seweryn Niemiec wrote:
>
>> Thomas Beyer wrote:
>>> Dear Community,
>>>
>>> I am trying to use the undo function, when modifying elements via the
>>> properties view.
>>> However, these changes do not seem be executed via the
>>> operationhistory, which means, <undo> does not work at all.
>
>> Cool, I'm not alone. I have the same problem. I'm using GMF version
>> 2.1.0, what is your version?
>
>> Is here any user of GMF 2.1.0 who can undo changes made through the
>> Properties View?
>
>> I don't think that the lack of undo functionality is a result of
>> custom code modifications. The Mindmap example from eclipse.org CVS
>> has the same problem.
>
>> Greetings
>> Seweryn
>
Re: Undo for changes in property tab does not work [message #202545 is a reply to message #202497] Wed, 20 August 2008 05:40 Go to previous message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 47
Registered: July 2009
Member
Just filed a bug report.
Please vote for:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244654


Regards
Thomas


Michael Haeberlen schrieb:
> I'm sorry, I had previously checked with GMF 2.0, where everything works
> fine. I could reporduce the problem with GMF 2.1. This is definitively a
> bug, IMO.
>
> Regards, Michael
>
> Thomas Beyer wrote:
>> Seweryn,
>>
>>
>> I was noticing this issue with the ganymede-package (GMF 2.1.0).
>> I upgraded to GMF 2.1.1 yesterday, because bug
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=243596
>> seemed to be related to the properties.
>> After testing with GMF 2.1.1, the problem still is present.
>>
>> I am not really sure where to go from here.
>> Do we file a bug report, because the feature we want is supposed to be
>> covered by GMF, or do we file a feature request, because GMF never
>> intended to provide undo/redo via properties?
>>
>>
>> Regards, Thomas
>>
>>
>> Seweryn Niemiec wrote:
>>
>>> Thomas Beyer wrote:
>>>> Dear Community,
>>>>
>>>> I am trying to use the undo function, when modifying elements via
>>>> the properties view.
>>>> However, these changes do not seem be executed via the
>>>> operationhistory, which means, <undo> does not work at all.
>>
>>> Cool, I'm not alone. I have the same problem. I'm using GMF version
>>> 2.1.0, what is your version?
>>
>>> Is here any user of GMF 2.1.0 who can undo changes made through the
>>> Properties View?
>>
>>> I don't think that the lack of undo functionality is a result of
>>> custom code modifications. The Mindmap example from eclipse.org CVS
>>> has the same problem.
>>
>>> Greetings
>>> Seweryn
>>
Previous Topic:How to remove Arrange All Action from Context Menu?.
Next Topic:Remove the Core option from properties view
Goto Forum:
  


Current Time: Thu Apr 25 08:53:02 GMT 2024

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

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

Back to the top