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);
}
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);
}
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);
}
Aggregations