}
private void addRemoveConstraintAction(Composite composite,
final SingleFieldConstraint constraint,
final ConnectiveConstraint connConstraint) {
ImageHyperlink delLink = addImage( composite,
"icons/delete_item_small.gif" );
delLink.setToolTipText( "Remove this field constraint" );
delLink.addHyperlinkListener( new IHyperlinkListener() {
public void linkActivated(HyperlinkEvent e) {
MessageBox dialog = new MessageBox( Display.getCurrent().getActiveShell(),
SWT.YES | SWT.NO | SWT.ICON_WARNING );
dialog.setMessage( "Remove this item?" );
dialog.setText( "Remove this item?" );
if ( dialog.open() == SWT.YES ) {
ConnectiveConstraint[] connectives = constraint.connectives;
List nConnectives = new ArrayList();
for ( int i = 0; i < connectives.length; i++ ) {
if ( connectives[i] != connConstraint ) {
nConnectives.add( connectives[i] );
}
}
constraint.connectives = (ConnectiveConstraint[]) nConnectives.toArray( new ConnectiveConstraint[nConnectives.size()] );
getModeller().reloadLhs();
getModeller().setDirty( true );
}
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkExited(HyperlinkEvent e) {
}
} );
delLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END ) );
}