errorMarker.setAlignment(SWT.CENTER);
important.setWidth(18);
important.setResizable(false);
important.setText("!");
important.setAlignment(SWT.CENTER);
final TableLayout tableLayout = new TableLayout() {
// Javadoc inherited
public void layout(Composite c, boolean flush) {
super.layout(c, flush);
// Ensure we are laying out a table.
if (c instanceof Table) {
int tableWidth = c.getClientArea().width;
// The image columns are fixed at 18, leaving the rest of
// the space to be shared between the (resizable) property
// column and the (static) value column. We should try to
// honour the size set for the property column where we
// can.
int accountedWidth = 36 + property.getWidth();
// If the final column fits in the available space, trim it
// to fit the table. Otherwise give it a small fixed size.
if ((accountedWidth + 18) < tableWidth) {
value.setWidth(tableWidth - accountedWidth);
} else {
value.setWidth(18);
int propertyWidth = tableWidth - (3 * 18);
property.setWidth((propertyWidth > 18) ? propertyWidth : 18);
}
}
}
};
tableLayout.addColumnData(new ColumnWeightData(1, 18, true));
tableLayout.addColumnData(new ColumnWeightData(1, 18, false));
tableLayout.addColumnData(new ColumnWeightData(0, 18, false));
tableLayout.addColumnData(new ColumnWeightData(0, 18, false));
ControlListener columnResizeListener = new ControlAdapter() {
// Javadoc inherited
public void controlResized(ControlEvent event) {
tableLayout.layout(table, true);
}
};
TreeListener treeExpansionListener = new TreeListener() {
private void treeChanged() {
tableLayout.layout(table, true);
}
// Javadoc inherited
public void treeCollapsed(TreeEvent event) {
treeChanged();
}
// Javadoc inherited
public void treeExpanded(TreeEvent event) {
treeChanged();
}
};
treeViewer = new TableTreeViewer(tree);
treeViewer.setLabelProvider(new RuleTreeLabelProvider());
treeViewer.setContentProvider(contentProvider);
new DiagnosticsToolTipper(new TableItemContainer(table),
new DiagnosticsToolTipper.ItemMapper() {
public Proxy dataFromItem(Item item) {
Proxy proxy = null;
if (item instanceof TableItem) {
Object tableTreeItem = item.getData("TableTreeItemID");
if (tableTreeItem instanceof Item) {
Object proxyObject = ((Item) tableTreeItem).getData();
if (proxyObject instanceof Proxy && ((Proxy) proxyObject).getModelObject() instanceof PropertyValue) {
proxy = (Proxy) proxyObject;
}
}
}
return proxy;
}
});
table.setLayout(tableLayout);
property.addControlListener(columnResizeListener);
tree.addTreeListener(treeExpansionListener);
tableLayout.layout(table, true);
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
Proxy proxy = (Proxy) selection.getFirstElement();