int count = 0;
while (failuresIter.hasNext()) {
if (++count > 100) {
break;
}
EOModelVerificationFailure failure = failuresIter.next();
Label iconLabel = new Label(failuresComposite, SWT.NONE);
iconLabel.setBackground(failuresComposite.getBackground());
if (failure.isWarning()) {
iconLabel.setImage(composite.getDisplay().getSystemImage(SWT.ICON_WARNING));
} else {
iconLabel.setImage(composite.getDisplay().getSystemImage(SWT.ICON_ERROR));
}
GridData iconLabelData = new GridData();
iconLabelData.verticalIndent = 3;
iconLabelData.verticalAlignment = SWT.BEGINNING;
iconLabelData.horizontalIndent = 3;
iconLabel.setLayoutData(iconLabelData);
Composite groupFailureComposite = new Composite(failuresComposite, SWT.NONE);
groupFailureComposite.setBackground(failuresComposite.getBackground());
groupFailureComposite.setLayout(new GridLayout(1, true));
GridData groupFailureLabelData = new GridData(GridData.FILL_HORIZONTAL);
//groupFailureLabelData.verticalIndent = 3;
// failureLabelData.verticalAlignment = SWT.BEGINNING;
groupFailureLabelData.horizontalIndent = 3;
groupFailureComposite.setLayoutData(groupFailureLabelData);
Label failedObjectLabel = new Label(groupFailureComposite, SWT.NONE);
failedObjectLabel.setBackground(failuresComposite.getBackground());
EOModelObject failedObject = failure.getFailedObject();
if (failedObject != null) {
failedObjectLabel.setText(failedObject.getFullyQualifiedName());
}
else {
failedObjectLabel.setText("General Failure");
}
failedObjectLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
failedObjectLabel.setForeground(failuresComposite.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
failedObjectLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
StyledText failureLabel = new StyledText(groupFailureComposite, SWT.WRAP);
failureLabel.setEditable(false);
failureLabel.setWordWrap(true);
failureLabel.setEnabled(false);
String failureMessage = failure.getMessage();
failureLabel.setText(failureMessage);
GridData failureLabelData = new GridData(GridData.FILL_HORIZONTAL);
//failureLabelData.verticalIndent = 3;
// failureLabelData.verticalAlignment = SWT.BEGINNING;
//failureLabelData.horizontalIndent = 3;
failureLabel.setLayoutData(failureLabelData);
if (_editor != null && failure.getFailedObject() != null) {
Button showButton = new Button(failuresComposite, SWT.PUSH);
showButton.setText("Show");
GridData showButtonData = new GridData();
showButtonData.verticalAlignment = SWT.CENTER;
showButtonData.horizontalIndent = 3;
showButton.setLayoutData(showButtonData);
showButton.setData(failure);
showButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
EOModelVerificationFailure selectedFailure = (EOModelVerificationFailure) ((Widget) e.getSource()).getData();
if (selectedFailure != null && _editor != null && selectedFailure.getFailedObject() != null) {
_editor.getContentOutlinePage().showModelGroup();
_editor.setSelection(new StructuredSelection(selectedFailure.getFailedObject()));
EOModelErrorDialog.this.close();
}
}
});
}