use of org.eclipse.jface.viewers.ColumnWeightData in project bndtools by bndtools.
the class BundleTree method createInfoViewer.
private void createInfoViewer(Composite container) {
infoViewerComposite = new Composite(container, SWT.NONE);
infoViewerComposite.setLayoutData(createFillGridData());
TreeColumnLayout layout = new TreeColumnLayout();
infoViewerComposite.setLayout(layout);
infoViewer = new TreeViewer(infoViewerComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
infoViewer.setUseHashlookup(true);
infoViewer.getTree().setHeaderVisible(true);
TreeViewerColumn treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE);
TreeColumn treeColumn = treeViewerColumn.getColumn();
layout.setColumnData(treeColumn, new ColumnWeightData(450, 180, true));
treeColumn.setText(Messages.bundleAndPackageName);
treeViewerColumn.setLabelProvider(new InfoLabelProvider());
treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE);
treeColumn = treeViewerColumn.getColumn();
layout.setColumnData(treeColumn, new ColumnWeightData(80, 80, true));
treeColumn.setText(Messages.version2);
treeViewerColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof Baseline) {
return ((Baseline) element).getOlderVersion().getWithoutQualifier().toString();
}
if (element instanceof Info) {
return ((Info) element).olderVersion.toString();
}
//$NON-NLS-1$
return "";
}
});
treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE);
treeColumn = treeViewerColumn.getColumn();
layout.setColumnData(treeColumn, new ColumnWeightData(80, 80, true));
treeColumn.setText(Messages.newVersion);
treeViewerColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof Baseline) {
return ((Baseline) element).getSuggestedVersion().toString();
}
if (element instanceof Info) {
//$NON-NLS-1$
return ((Info) element).suggestedVersion != null ? ((Info) element).suggestedVersion.toString() : "";
}
//$NON-NLS-1$
return "";
}
});
treeViewerColumn.setEditingSupport(new InlineComboEditingSupport(infoViewer));
infoViewer.setContentProvider(infoTreeViewerProvider);
infoViewer.setAutoExpandLevel(2);
}
Aggregations