*/
@Override
protected void doBuild() {
super.doBuild();
final ListPartWithButtons constraintsListPart = new ListPartWithButtons(
bodyComposite, "constraints", false);
final Composite composite = constraintsListPart.getChildrenComposite();
constraintPartMap = new HashMap<Constraint, ConstraintPart>();
for (Constraint constraint : assignedConstraintsSet
.getAssignedConstraints()) {
addPart(constraint, composite, constraintPartMap);
}
assignedConstraintsSet
.addModelElementChangeListener(new ModelElementChangeListener() {
@Override
public void onRuntimeExceptionInListener(
RuntimeException exception) {
}
@Override
public void onChange(final Notification notification) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
if (notification.getEventType() == Notification.REMOVE) {
removePart((Constraint) notification
.getOldValue());
constraintsListPart.pack();
} else if (notification.getEventType() == Notification.ADD) {
addPart((Constraint) notification
.getNewValue(), composite,
constraintPartMap);
constraintsListPart.pack();
}
}
});
}
});
constraintsListPart.setNewButtonTooltip("create a new constraint using a wizard");
constraintsListPart .addNewButtonSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
NewConstraintWizard wizard = new NewConstraintWizard(
assignedConstraintsSet,
((Toolbox) assignedConstraintsSet.eContainer()
.eContainer().eContainer())
.getPropertiesCatalogue());
WizardDialog dialog = new WizardDialog(parentComposite
.getShell(), wizard);
dialog.create();
dialog.open();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
constraintsListPart.setDeleteAllButtonTooltip("delete all assigned constraints");
constraintsListPart.setDeleteAllButtonImage(PlatformUI.getWorkbench().getSharedImages()
.getImage(ISharedImages.IMG_TOOL_DELETE));
constraintsListPart.addDeleteButtonSelectionListener( new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
int messageBoxStyle = SWT.ICON_WARNING | SWT.YES | SWT.NO ;