Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Attribute Generation Error
Attribute Generation Error [message #1201416] Thu, 21 November 2013 18:39
Tarcísio Couto is currently offline Tarcísio CoutoFriend
Messages: 29
Registered: May 2013
Junior Member
Hello guys, I have the following piece of code that generate the attributes id and name for my softgoal node.

/**
* @generated NOT
*/
private void createAttributes(){

// start the transaction
ResourceSet resourceSet = new ResourceSetImpl();
ChangeRecorder recorder = new ChangeRecorder(resourceSet);

try
{
// perform arbitrary manipulation
NFRSoftgoalImpl nfrsoftgoal = (NFRSoftgoalImpl) ((NodeImpl) NFRSoftgoalEditPart.this.getModel()).getElement();
if(nfrsoftgoal.getId() == null){
int id = sequence_soft.getAndIncrement();
nfrsoftgoal.setId(String.valueOf(id));
nfrsoftgoal.setNFRSoftgoalPriority(BigInteger.valueOf(id));
nfrsoftgoal.setName("NFRSoftgoal" + id);
}else{
fFigureNFRSoftgoalLabelFigure.setText("NFRSoftgoal"
+ nfrsoftgoal.getId());
}
}
catch(Exception e)
{
// error, rollback all changes
System.out.println("Um erro aconteceu - Softgoal.");
recorder.endRecording().apply();
}
}

When I replicated the code for my other node called Variation, it works fine... but when I close the diagram and open again, the softgoals are at the same place BUT the variation nodes are in another place, it appears at the top of the diagram.... Can someone help me?

The code for Variant node

/**
* @generated NOT
*/
private void createAttributes(){

// start the transaction
ResourceSet resourceSet = new ResourceSetImpl();
ChangeRecorder recorder = new ChangeRecorder(resourceSet);

try
{
// perform arbitrary manipulation
VariantImpl variant = (VariantImpl) ((NodeImpl) VariantEditPart.this.getModel()).getElement();
if (variant.getId() == null) {
int id = sequence_var.getAndIncrement();
variant.setId(String.valueOf(id));
variant.setName("Variant" + id);
} else {
fFigureVariantLabelFigure.setText("Variant" + variant.getId());
}
}
catch(Exception e)
{
// error, rollback all changes
System.out.println("Um erro aconteceu - Variant.");
recorder.endRecording().apply();
}
}
Previous Topic:How to define a predefined sequence attributes?
Next Topic:[Xcore] Maven plugin for generating classes?
Goto Forum:
  


Current Time: Sat Aug 24 22:41:06 GMT 2019

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

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

Back to the top