//name
Composite nameComposite = new Composite(composite, SWT.NONE);
nameComposite.setLayout( new RowLayout(SWT.HORIZONTAL));
Label nameLabel = new Label(nameComposite, SWT.NONE);
nameLabel.setText("name:");
nameLabel.setLayoutData( new RowData(labelWidth, labelHeight));
for (Element element : elementsToCompare){
EmbeddedLink link = new EmbeddedLink(nameComposite, SWT.NONE, false);
String attributeValue = accessLayer.getAttributeValue(element, "name");
link.setText(attributeValue!=null? attributeValue : "");
link.setLayoutData( new RowData(linkWidth, linkHeight));
link.setTarget(element);
}
//attributes
for (EAttribute eAttribute : attributesToCompare ){
Composite attributeComposite = new Composite(composite, SWT.NONE);
attributeComposite.setLayout( new RowLayout(SWT.HORIZONTAL));
if (eAttribute.getName() != "name"){
Label label = new Label(attributeComposite, SWT.NONE);
label.setText(eAttribute.getName()+":");
label.setLayoutData( new RowData(labelWidth, labelHeight));
int maxLength = 0;
for (Element element : elementsToCompare){
String attributeValue = accessLayer.getAttributeValue(element, eAttribute.getName());
maxLength = Math.max(maxLength, (attributeValue!=null? attributeValue : "").length());
}
for (Element element : elementsToCompare){
Text text = new Text(attributeComposite, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI| SWT.WRAP);
String attributeValue = accessLayer.getAttributeValue(element, eAttribute.getName());
text.setText(attributeValue!=null? attributeValue : "");
text.setLayoutData( new RowData(textboxWidth, textboxHeight));
text.setToolTipText("the "+eAttribute.getName() +" of the element " + accessLayer.getAttributeValue(element, "name"));
}
}
}
///parent Preconditions
Composite parentPreconditionsComposite = new Composite(composite, SWT.NONE);
parentPreconditionsComposite.setLayout( new RowLayout(SWT.HORIZONTAL));
Label parentPreconditionLabel = new Label(parentPreconditionsComposite, SWT.NONE);
parentPreconditionLabel.setLayoutData( new RowData(labelWidth, labelHeight));
parentPreconditionLabel.setText("foreign preconditions:");
for (Element element : elementsToCompare){
Text text = new Text(parentPreconditionsComposite, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI| SWT.WRAP);
String precoditionString = PreconditionFinder.getRequirementsFromParent(element, cacheManager);
text.setText(precoditionString!=null && precoditionString!=""? precoditionString : "none");
text.setLayoutData( new RowData(textboxWidth, textboxHeight));
text.setToolTipText("foreign preconditions of the element " + accessLayer.getAttributeValue(element, "name"));
}
///Preconditions
Composite preconditionsComposite = new Composite(composite, SWT.NONE);
preconditionsComposite.setLayout( new RowLayout(SWT.HORIZONTAL));
Label preconditionLabel = new Label(preconditionsComposite, SWT.NONE);
preconditionLabel.setLayoutData( new RowData(labelWidth, labelHeight ));
preconditionLabel.setText("own preconditions:");
for (Element element : elementsToCompare){
Text text = new Text(preconditionsComposite, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI| SWT.WRAP);
String precoditionString = PreconditionFinder.formatConditionString(((ConstrainedElement)element).getPrecondition());
text.setText(precoditionString!=null && precoditionString!=""? precoditionString : "none");
text.setLayoutData( new RowData(textboxHeight, textboxWidth));
text.setToolTipText("own preconditions of the element " + accessLayer.getAttributeValue(element, "name"));
}
////////////