use of eu.esdihumboldt.hale.ui.util.viewer.PostSelectionSupport in project hale by halestudio.
the class AbstractMappingView method createViewControl.
@Override
public void createViewControl(Composite parent) {
viewer = new GraphViewer(parent, SWT.BORDER);
viewer.setContentProvider(createContentProvider());
// viewer.setContentProvider(new CellRelationshipContentProvider());
// viewer.setContentProvider(new NestedCellRelationshipContentProvider());
viewer.setLabelProvider(createLabelProvider(viewer));
viewer.setInput(null);
LayoutAlgorithm layout = createLayout();
viewer.setLayoutAlgorithm(layout, true);
viewer.applyLayout();
fillToolBar();
// set selection provider
selectionFacade = new SelectionProviderFacade();
selectionFacade.setSelectionProvider(getViewer());
getSite().setSelectionProvider(new PostSelectionSupport(selectionFacade));
viewer.getControl().addKeyListener(new KeyListener() {
@Override
public void keyReleased(KeyEvent e) {
if (e.keyCode == 'a' && (e.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
// XXX even though getSelection returns the current state, a
// selection update is not triggered by the control
// -> force selection change event after Ctrl+A
ISelection sel = viewer.getSelection();
selectionFacade.setSelection(sel);
}
}
@Override
public void keyPressed(KeyEvent e) {
// nothing to do
}
});
// create context menu
new ViewerMenu(getSite(), getViewer()) {
/**
* @see eu.esdihumboldt.hale.ui.util.ViewContextMenu#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
*/
@Override
public void menuAboutToShow(IMenuManager manager) {
super.menuAboutToShow(manager);
AbstractMappingView.this.menuAboutToShow(manager);
}
};
}
Aggregations