Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Attribute Generation Error
Attribute Generation Error [message #1201415] Thu, 21 November 2013 13:38
Eclipse UserFriend
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: Fri Jul 04 16:43:33 EDT 2025

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

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

Back to the top