Search in sources :

Example 1 with AdapterFactoryStatuslineProvider

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);
}
Also used : AdapterFactoryTreeEditor(org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor) ComposedAdapterFactory(org.eclipse.emf.edit.provider.ComposedAdapterFactory) AdapterFactoryContentProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) CollapseAllHandler(org.eclipse.ui.handlers.CollapseAllHandler) AdapterFactoryStatuslineProvider(org.eclipse.ecf.internal.discovery.ui.statusline.AdapterFactoryStatuslineProvider) EList(org.eclipse.emf.common.util.EList) IHandlerService(org.eclipse.ui.handlers.IHandlerService) LocalSelectionTransfer(org.eclipse.jface.util.LocalSelectionTransfer)

Aggregations

AdapterFactoryStatuslineProvider (org.eclipse.ecf.internal.discovery.ui.statusline.AdapterFactoryStatuslineProvider)1 EList (org.eclipse.emf.common.util.EList)1 ComposedAdapterFactory (org.eclipse.emf.edit.provider.ComposedAdapterFactory)1 AdapterFactoryTreeEditor (org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor)1 AdapterFactoryContentProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider)1 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)1 LocalSelectionTransfer (org.eclipse.jface.util.LocalSelectionTransfer)1 CollapseAllHandler (org.eclipse.ui.handlers.CollapseAllHandler)1 IHandlerService (org.eclipse.ui.handlers.IHandlerService)1