use of eu.esdihumboldt.hale.ui.common.graph.content.ReverseCellGraphContentProvider in project hale by halestudio.
the class TypeCellSelectionDialog method setupViewer.
/**
* @see eu.esdihumboldt.hale.ui.util.selector.AbstractViewerSelectionDialog#setupViewer(org.eclipse.jface.viewers.StructuredViewer,
* java.lang.Object)
*/
@Override
protected void setupViewer(final GraphViewer viewer, Cell initialSelection) {
// content and label provider
viewer.setContentProvider(new ReverseCellGraphContentProvider());
viewer.setLabelProvider(new GraphLabelProvider(viewer, HaleUI.getServiceProvider()));
// layout
final TreeLayoutAlgorithm layout = new TreeLayoutAlgorithm(TreeLayoutAlgorithm.RIGHT_LEFT);
viewer.getControl().addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
int width = viewer.getControl().getSize().x;
layout.setNodeSpace(new Dimension((width - 10) / 3, 30));
}
});
viewer.setLayoutAlgorithm(layout, true);
viewer.applyLayout();
// input and selection
AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
viewer.setInput(as.getAlignment().getTypeCells());
if (initialSelection != null)
viewer.setSelection(new StructuredSelection(initialSelection));
}
Aggregations