Search in sources :

Example 1 with CollapseAllHandler

use of org.eclipse.ui.handlers.CollapseAllHandler in project linuxtools by eclipse.

the class BrowserView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    PatternFilter filter = new PatternFilter();
    FilteredTree filteredTree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true);
    viewer = filteredTree.getViewer();
    viewer.setContentProvider(new ViewContentProvider());
    viewer.setLabelProvider(new ViewLabelProvider());
    IHandlerService handlerService = getSite().getService(IHandlerService.class);
    collapseHandler = new CollapseAllHandler(getViewer());
    handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, collapseHandler);
    refreshHandler = new RefreshHandler();
    handlerService.activateHandler(RefreshHandler.COMMAND_ID, refreshHandler);
}
Also used : PatternFilter(org.eclipse.ui.dialogs.PatternFilter) IHandlerService(org.eclipse.ui.handlers.IHandlerService) FilteredTree(org.eclipse.ui.dialogs.FilteredTree) CollapseAllHandler(org.eclipse.ui.handlers.CollapseAllHandler)

Example 2 with CollapseAllHandler

use of org.eclipse.ui.handlers.CollapseAllHandler in project polymap4-core by Polymap4.

the class CommonNavigatorActionGroup method makeActions.

/**
 */
private void makeActions() {
    FrameList frameList = commonViewer.getFrameList();
    backAction = new BackAction(frameList);
    forwardAction = new ForwardAction(frameList);
    upAction = new UpAction(frameList);
    frameList.addPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(FrameList.P_RESET)) {
                upAction.setEnabled(false);
                backAction.setEnabled(false);
                forwardAction.setEnabled(false);
            }
            commonNavigator.updateTitle();
            IActionBars actionBars = commonNavigator.getViewSite().getActionBars();
            updateToolBar(actionBars.getToolBarManager());
        }
    });
    IHandlerService service = (IHandlerService) commonNavigator.getSite().getService(IHandlerService.class);
    INavigatorViewerDescriptor viewerDescriptor = commonViewer.getNavigatorContentService().getViewerDescriptor();
    boolean hideLinkWithEditorAction = viewerDescriptor.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_LINK_WITH_EDITOR_ACTION);
    if (!hideLinkWithEditorAction) {
        toggleLinkingAction = new LinkEditorAction(commonNavigator, commonViewer, linkHelperService);
        // $NON-NLS-1$
        ImageDescriptor syncIcon = getImageDescriptor("elcl16/synced.gif");
        toggleLinkingAction.setImageDescriptor(syncIcon);
        toggleLinkingAction.setHoverImageDescriptor(syncIcon);
        service.activateHandler(toggleLinkingAction.getActionDefinitionId(), new ActionHandler(toggleLinkingAction));
    }
    boolean hideCollapseAllAction = viewerDescriptor.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_COLLAPSE_ALL_ACTION);
    if (!hideCollapseAllAction) {
        collapseAllAction = new CollapseAllAction(commonViewer);
        // $NON-NLS-1$
        ImageDescriptor collapseAllIcon = getImageDescriptor("elcl16/collapseall.gif");
        collapseAllAction.setImageDescriptor(collapseAllIcon);
        collapseAllAction.setHoverImageDescriptor(collapseAllIcon);
        collapseAllHandler = new CollapseAllHandler(commonViewer);
        service.activateHandler(CollapseAllHandler.COMMAND_ID, collapseAllHandler);
    }
    filterGroup = new FilterActionGroup(commonViewer);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) UpAction(org.eclipse.ui.internal.navigator.framelist.UpAction) FrameList(org.eclipse.ui.internal.navigator.framelist.FrameList) CollapseAllHandler(org.eclipse.ui.handlers.CollapseAllHandler) LinkEditorAction(org.eclipse.ui.internal.navigator.actions.LinkEditorAction) INavigatorViewerDescriptor(org.eclipse.ui.navigator.INavigatorViewerDescriptor) FilterActionGroup(org.eclipse.ui.internal.navigator.filters.FilterActionGroup) IHandlerService(org.eclipse.ui.handlers.IHandlerService) CollapseAllAction(org.eclipse.ui.internal.navigator.actions.CollapseAllAction) ForwardAction(org.eclipse.ui.internal.navigator.framelist.ForwardAction) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) BackAction(org.eclipse.ui.internal.navigator.framelist.BackAction) ActionHandler(org.eclipse.jface.commands.ActionHandler) IActionBars(org.eclipse.ui.IActionBars)

Example 3 with CollapseAllHandler

use of org.eclipse.ui.handlers.CollapseAllHandler 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

CollapseAllHandler (org.eclipse.ui.handlers.CollapseAllHandler)3 IHandlerService (org.eclipse.ui.handlers.IHandlerService)3 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 ActionHandler (org.eclipse.jface.commands.ActionHandler)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)1 LocalSelectionTransfer (org.eclipse.jface.util.LocalSelectionTransfer)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 IActionBars (org.eclipse.ui.IActionBars)1 FilteredTree (org.eclipse.ui.dialogs.FilteredTree)1 PatternFilter (org.eclipse.ui.dialogs.PatternFilter)1 CollapseAllAction (org.eclipse.ui.internal.navigator.actions.CollapseAllAction)1 LinkEditorAction (org.eclipse.ui.internal.navigator.actions.LinkEditorAction)1 FilterActionGroup (org.eclipse.ui.internal.navigator.filters.FilterActionGroup)1 BackAction (org.eclipse.ui.internal.navigator.framelist.BackAction)1