use of org.eclipse.ecf.internal.discovery.ui.statusline.AdapterFactoryStatuslineProvider in project ecf by eclipse.
the class DiscoveryView method createPartControl.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
* .Composite)
*/
public void createPartControl(Composite parent) {
ComposedAdapterFactory adapterFactory = DiscoveryEditingDomainProvider.eINSTANCE.getAdapterFactory();
// create the viewer
setSelectionViewer(new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL));
getSelectionViewer().setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
getSelectionViewer().setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
getSelectionViewer().setComparator(new ViewerComparator());
getSelectionViewer().setFilters(getViewerFilters());
getSelectionViewer().setUseHashlookup(true);
getSite().setSelectionProvider(getSelectionViewer());
// populate the viewer with the model if available
EList resources = DiscoveryEditingDomainProvider.eINSTANCE.getEditingDomain().getResourceSet().getResources();
if (resources != null) {
getSelectionViewer().setInput(resources.get(0));
getSelectionViewer().setSelection(new StructuredSelection(resources.get(0)), true);
}
new AdapterFactoryTreeEditor(getSelectionViewer().getTree(), adapterFactory);
getSelectionViewer().addPostSelectionChangedListener(new AdapterFactoryStatuslineProvider(adapterFactory, getViewSite().getActionBars().getStatusLineManager()));
drillDownAdapter = new DrillDownAdapter(getSelectionViewer());
createContextMenuFor(getSelectionViewer());
hookContextMenu();
contributeToActionBars();
// add collapse handler
IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
collapseHandler = new CollapseAllHandler(getSelectionViewer());
handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, collapseHandler);
// add DND support
Transfer[] supportedTransfers = { LocalSelectionTransfer.getTransfer() };
getSelectionViewer().addDragSupport(DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_MOVE, supportedTransfers, new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) {
LocalSelectionTransfer.getTransfer().setSelection(getSelectionViewer().getSelection());
}
});
// $NON-NLS-1$
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.ecf.discovery.ui.ServiceView");
getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(this);
}
Aggregations