Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Attribute Generation Error
Attribute Generation Error [message #1201415] Thu, 21 November 2013 18:38
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:Reducing 2 Palette Tools to 1 Tool
Next Topic:GMF empty outline view
Goto Forum:
  


Current Time: Sun Mar 07 15:54:41 GMT 2021

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

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

Back to the top