Attribute Generation Error [message #1201416] |
Thu, 21 November 2013 13:39 |
Eclipse User |
|
|
|
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();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.31032 seconds