Skip to content

Commit e78984c

Browse files
committed
Implement filter-based table viewer via the new FilterTable class
This moves the viewer-agnostic components of the FilterTree widget into an AbstractFilteredStructuredViewer base class, which is then used to implement the FilterTable widget. The base class has been moved to org.eclipse.jface.text together with the TextMatcher, to allow it to be used together with both an E3 and E4 workbench. For the AbstractFilteredStructuredViewer, following methods have been added to support this abstraction: - isShowFilterControls() - isQuickSelectionMode() - init(int) For the FilteredTree, following fields and methods have been marked as for-removal: - filterToolBar - clearButtonControl - updateToolbar(boolean) To avoid code-duplication as a result of bug 260664, the code of clearText() has been moved to a separate doClearText() method, so that the same code can be invoked inside the listeners, without having to worry about clearText() being overridden by subclasses. This change adds a dependency from org.eclipse.jface.text to org.eclipse.ui.workbench.
1 parent 3eaaeb6 commit e78984c

File tree

20 files changed

+1678
-4
lines changed

20 files changed

+1678
-4
lines changed

bundles/org.eclipse.e4.ui.dialogs/src/org/eclipse/e4/ui/dialogs/filteredtree/FilteredTable.java

Lines changed: 478 additions & 0 deletions
Large diffs are not rendered by default.

bundles/org.eclipse.e4.ui.dialogs/src/org/eclipse/e4/ui/dialogs/filteredtree/PatternFilter.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,12 @@ public boolean isElementVisible(Viewer viewer, Object element) {
274274
* text
275275
*/
276276
protected boolean isParentMatch(Viewer viewer, Object element) {
277-
Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer)
278-
.getContentProvider()).getChildren(element);
277+
if (viewer instanceof AbstractTreeViewer
278+
&& ((AbstractTreeViewer) viewer).getContentProvider() instanceof ITreeContentProvider) {
279+
Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer).getContentProvider())
280+
.getChildren(element);
279281

280-
if ((children != null) && (children.length > 0)) {
281-
return isAnyVisible(viewer, element, children);
282+
return children != null && children.length > 0 && isAnyVisible(viewer, element, children);
282283
}
283284
return false;
284285
}

0 commit comments

Comments
 (0)