use of org.obeonetwork.tools.linker.ui.view.util.ViewpointSelectionListener in project InformationSystem by ObeoNetwork.
the class EObjectLinksView method createPartControl.
/**
* This is a callback that will allow us
* to create the viewer and initialize it.
*/
public void createPartControl(Composite parent) {
Composite viewContainer = new Composite(parent, SWT.NONE);
viewContainer.setLayout(new GridLayout());
eobjectLabel = new Label(viewContainer, SWT.NONE);
eobjectLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite tableContainer = new Composite(viewContainer, SWT.NONE);
tableContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
TableColumnLayout layout = new TableColumnLayout();
tableContainer.setLayout(layout);
viewer = new TableViewer(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
addColumns();
contentProvider = createContentProvider();
viewer.setContentProvider(contentProvider);
List<ViewerFilter> filters = createFilters();
if (filters.size() > 0) {
for (ViewerFilter viewerFilter : filters) {
viewer.addFilter(viewerFilter);
}
}
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
for (ViewListener listener : listeners) {
listener.fireSelectionChanged(getSelectedEntries());
}
}
});
ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE);
listener = new ViewpointSelectionListener() {
/**
* {@inheritDoc}
* @see org.obeonetwork.tools.linker.ui.view.util.ViewpointSelectionListener#eObjectSelected(org.eclipse.emf.ecore.EObject)
*/
@Override
protected void eObjectSelected(EObject selectedEObject) {
update(selectedEObject);
}
};
getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(listener);
makeActions();
fillLocalActionBar();
fillLocalPullDown();
hookDoubleClickAction();
}
Aggregations