Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to define a predefined sequence attributes?
How to define a predefined sequence attributes? [message #1199059] Wed, 20 November 2013 17:05 Go to next message
Tarcísio Couto is currently offline Tarcísio CoutoFriend
Messages: 29
Registered: May 2013
Junior Member
Hello,

my doubt is:

I have a node called Variant. Variant has a set of attributes like name and id for example.

What I want is every time that I insert a Variant the attributes can be inserted automatically, for example.

I inserted the first Variant, so the attributes will be..

Name: Variant 1
Id: 1

The Second Variant

Name: Variant 2
Id: 2

and So on..

Can someone help me?
Re: How to define a predefined sequence attributes? [message #1199133 is a reply to message #1199059] Wed, 20 November 2013 17:52 Go to previous messageGo to next message
Tarcísio Couto is currently offline Tarcísio CoutoFriend
Messages: 29
Registered: May 2013
Junior Member
I tried the following:

NFRSoftgoalImpl nfrsoftgoal = (NFRSoftgoalImpl ) ((NodeImpl) NFRSoftgoalEditPart.this.getModel()).getElement();
int id = sequence_soft.getAndIncrement();
nfrsoftgoal.setId(String.valueOf(id));
nfrsoftgoal.setNFRSoftgoalPriority(BigInteger.valueOf(id));
nfrsoftgoal.setName("NFRSoftgoal" + id);

but, the following error happened: java.lang.IllegalStateException: Cannot modify resource set without a write transaction

I don't know how to solve this problem....
Re: How to define a predefined sequence attributes? [message #1199266 is a reply to message #1199133] Wed, 20 November 2013 19:25 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
You need to do this inside a command on the command stack of the editing domain.

Tarcísio Couto wrote on Wed, 20 November 2013 18:52
I tried the following:

NFRSoftgoalImpl nfrsoftgoal = (NFRSoftgoalImpl ) ((NodeImpl) NFRSoftgoalEditPart.this.getModel()).getElement();
int id = sequence_soft.getAndIncrement();
nfrsoftgoal.setId(String.valueOf(id));
nfrsoftgoal.setNFRSoftgoalPriority(BigInteger.valueOf(id));
nfrsoftgoal.setName("NFRSoftgoal" + id);

but, the following error happened: java.lang.IllegalStateException: Cannot modify resource set without a write transaction

I don't know how to solve this problem....

Re: How to define a predefined sequence attributes? [message #1200792 is a reply to message #1199059] Thu, 21 November 2013 12:14 Go to previous messageGo to next message
Tarcísio Couto is currently offline Tarcísio CoutoFriend
Messages: 29
Registered: May 2013
Junior Member
How? Please, give me an example.
Re: How to define a predefined sequence attributes? [message #1200907 is a reply to message #1199059] Thu, 21 November 2013 13:27 Go to previous messageGo to next message
Tarcísio Couto is currently offline Tarcísio CoutoFriend
Messages: 29
Registered: May 2013
Junior Member
Please, give me an example.
Re: How to define a predefined sequence attributes? [message #1200967 is a reply to message #1200907] Thu, 21 November 2013 14:03 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

http://help.eclipse.org/helios/topic/org.eclipse.emf.transaction.doc/references/overview/creating.html


HTH,

Christian


On 2013-11-21 13:27:46 +0000, Tarcísio Couto said:

> Please, give me an example.
Previous Topic:Compare two arraylist of EMF objects
Next Topic:Attribute Generation Error
Goto Forum:
  


Current Time: Fri Mar 29 14:28:28 GMT 2024

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

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

Back to the top