|
|
|
Re: read-only transaction context problem [message #484916 is a reply to message #484667] |
Wed, 09 September 2009 16:43 |
Eclipse User |
|
|
|
Originally posted by: news.sascha.gessler.googlemail.com
Hi Hauke,
> I want to set an attribute of the EMF model from some arbitrary method
> (not an Edit Policy).
usually a good way to go are RecordingCommands. A RecordingCommand records
the changes made by a subclass's direct manipulation of objects via the
metamodel's API. This simplifies the programming model for complex
commands and should be suitable for your application case.
> However, the following code results in a
> java.lang.IllegalStateException: Cannot activate read/write transaction
> in read-only transaction context
Please note that the constructor of a RecordingCommand needs an
TransactionalEditingDomain (which can be acquired from many GMF elements,
for example by IGraphicalEditPart.getEditingDomain()).The editing domain
also provides access to the command stack that should be used to execute
the command.
Executing your RecordingCommand on this CommandStack should provide you
with an valid read/write transaction.
Cheers,
sas
|
|
|
Re: read-only transaction context problem [message #486478 is a reply to message #484916] |
Thu, 17 September 2009 19:08 |
Hauke Fuhrmann Messages: 333 Registered: July 2009 |
Senior Member |
|
|
Sascha, thanks for your answer. However, it is not exactly working. See
below.
Sascha Geßler schrieb:
>> However, the following code results in a
>> java.lang.IllegalStateException: Cannot activate read/write
>> transaction in read-only transaction context
>
> Please note that the constructor of a RecordingCommand needs an
> TransactionalEditingDomain (which can be acquired from many GMF
> elements, for example by IGraphicalEditPart.getEditingDomain()).The
> editing domain also provides access to the command stack that should be
> used to execute the command.
>
> Executing your RecordingCommand on this CommandStack should provide you
> with an valid read/write transaction.
Whatever command I use, the problem is always the same. I tried a
SetCommand, a RecordingCommand or a custom command.
The problem is, that in my situation, the CommandStack I get from the
corresponding EObject is in a read-only state, i.e. the EditingDomain
has an active read-only transaction. So my write command triggers that
exception.
The thing is, that I want to tell the CommandStack then to execute the
command *after* the read-only transaction has been run through... How
can I do that? There must be a way...
Hauke
|
|
|
|
Powered by
FUDForum. Page generated in 0.26487 seconds