Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create Node Manually
Create Node Manually [message #193214] Wed, 18 June 2008 09:55 Go to next message
Eclipse UserFriend
Originally posted by: youchy.gmail.com

hi everyone!

I've another problem.
I've been reading a lot of "how to" create Node's, but everything I found
is to modify the EditPolicy's.

My problem is this:

I have like 2 models...


---------- ------
| My model |<- 1 ------------------ 1-* -->| Node |
---------- ------

The users use "MyModel" when they're working wth the software.
The problem is that many actions that the user can do over "MyModel" must
be reflected in its Node's.

in "MyModel" the user can set it as "deleted". Thats means that the object
is there, but the user can make any action over it, and ofc course, the
Node's of this object must be deleted(this is OK). The problem is when
the user set deleted to "false", thats means that the user can mkake
actions over this object, and of course the node's deleted previously must
be added another time in the diagrams.

my actions "save" as fields this XXXNodeImpl and the NodeImpl(View). I
created a Transactional command with the EditingDomain of the editor(the
diagram is opened). I can deleted the Nodes doing this...

((ScenarioNodeImpl) node.getElement()).setActivityScenario(null);


But I can't re-add the node to the diagram doing this...

ActivityScenarioImpl scenario = (ActivityScenarioImpl)
diagram.getElement();

node.setActivityScenario(scenario);

The error is the...
Error: Cannot modify resource set without a write transaction

When a Create the Request to create the command, i put the actual domain
of the editor opened.


Please help me!!!

if you don't undersatnd something, please answer me, because I know that
my english is SO BAD!! sorry :(

THNAKS a LOT!!
Re: Create Node Manually [message #193333 is a reply to message #193214] Wed, 18 June 2008 20:10 Go to previous message
Artun Subasi is currently offline Artun SubasiFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Carlos,

I assume the problem appears in the following line:
node.setActivityScenario(scenario)

Have you tried using SetCommand to set this feature? Here is an example
for how it works (names may differ):

SetRequest setRequest =
new SetRequest(node, ??Package.eINSTANCE.
getScenarioNode_ActivityScenario(), scenario);
SetValueCommand setCommand = new SetValueCommand(setRequest);
editingDomain.getCommandStack().execute(
new ICommandProxy(setCommand));

?? is the package name of your EMF data model.

Regards,
Artun

> hi everyone!
>
> I've another problem.
> I've been reading a lot of "how to" create Node's, but everything I
> found is to modify the EditPolicy's.
>
> My problem is this:
>
> I have like 2 models...
>
>
> ---------- ------
> | My model |<- 1 ------------------ 1-* -->| Node |
> ---------- ------
>
> The users use "MyModel" when they're working wth the software.
> The problem is that many actions that the user can do over "MyModel"
> must be reflected in its Node's.
>
> in "MyModel" the user can set it as "deleted". Thats means that the
> object is there, but the user can make any action over it, and ofc
> course, the Node's of this object must be deleted(this is OK). The
> problem is when the user set deleted to "false", thats means that the
> user can mkake actions over this object, and of course the node's
> deleted previously must be added another time in the diagrams.
> my actions "save" as fields this XXXNodeImpl and the NodeImpl(View). I
> created a Transactional command with the EditingDomain of the editor(the
> diagram is opened). I can deleted the Nodes doing this...
>
> ((ScenarioNodeImpl) node.getElement()).setActivityScenario(null);
>
>
> But I can't re-add the node to the diagram doing this...
>
> ActivityScenarioImpl scenario = (ActivityScenarioImpl)
> diagram.getElement();
>
> node.setActivityScenario(scenario);
>
> The error is the...
> Error: Cannot modify resource set without a write transaction
>
> When a Create the Request to create the command, i put the actual domain
> of the editor opened.
>
>
> Please help me!!!
>
> if you don't undersatnd something, please answer me, because I know that
> my english is SO BAD!! sorry :(
>
> THNAKS a LOT!!
>
Previous Topic:changing the color of note figure
Next Topic:Highlighting a list of model elements
Goto Forum:
  


Current Time: Tue Sep 24 04:32:09 GMT 2024

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

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

Back to the top