/* * (non-Javadoc) * * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#createToolbarContributions(org.eclipse.jface.viewers.TreeViewer) */ public IContributionItem[] createToolbarContributions(TreeViewer viewer) { Assert.isTrue( getContentProvider(viewer) instanceof DTDTreeContentProvider, "invalid content provider on viewer"); //$NON-NLS-1$ IContributionItem[] items = super.createToolbarContributions(viewer); SortAction sortAction = new SortAction(viewer, DTDUIPlugin.getDefault().getPreferenceStore(), OUTLINE_SORT_PREF); OrderAction orderAction = new OrderAction( viewer, (DTDTreeContentProvider) getContentProvider(viewer), DTDUIPlugin.getDefault().getPreferenceStore(), OUTLINE_ORDER_PREF); IContributionItem sortItem = new PropertyChangeUpdateActionContributionItem(sortAction); IContributionItem orderItem = new PropertyChangeUpdateActionContributionItem(orderAction); if (items == null) { items = new IContributionItem[2]; items[0] = sortItem; items[1] = orderItem; } else { IContributionItem[] combinedItems = new IContributionItem[items.length + 2]; combinedItems[0] = sortItem; combinedItems[1] = orderItem; System.arraycopy(items, 0, combinedItems, 2, items.length); items = combinedItems; } return items; }
/* * (non-Javadoc) * * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getPreferenceStore() */ protected IPreferenceStore getPreferenceStore() { return DTDUIPlugin.getDefault().getPreferenceStore(); }