@Override protected void updateTreeFont(Font dialogFont) { if (hasAtMostOnePage()) { Composite composite = getTreeViewer().getTree(); applyDialogFont(composite, dialogFont); composite.layout(true); } else { applyDialogFont(filteredTree, dialogFont); filteredTree.layout(true); } }
@Override protected TreeViewer createTreeViewer(Composite parent) { int styleBits = SWT.SINGLE; TreeViewer tree; if (!hasAtMostOnePage()) { filteredTree = new PreferenceFilteredTree(parent, styleBits, new PreferencePatternFilter()); filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); tree = filteredTree.getViewer(); } else tree = new TreeViewer(parent, styleBits); setContentAndLabelProviders(tree); tree.setInput(getPreferenceManager()); tree.addFilter(new CapabilityFilter()); tree.addSelectionChangedListener(event -> handleTreeSelectionChanged(event)); super.addListeners(tree); return tree; }
@Override protected void selectSavedItem() { getTreeViewer().setInput(getPreferenceManager()); super.selectSavedItem(); if (getTreeViewer().getTree().getItemCount() > 1) { // unfortunately super will force focus to the list but we want the // type ahead combo to get it. Text filterText = filteredTree.getFilterControl(); if (filterText != null) { filterText.setFocus(); } } }
/** * Show only the supplied ids. * * @param filteredIds */ public void showOnly(String[] filteredIds) { if (!hasAtMostOnePage()) { filteredTree.addFilter(new PreferenceNodeFilter(filteredIds)); } }