1 11 package org.eclipse.ui.internal.dialogs; 12 13 import org.eclipse.jface.viewers.Viewer; 14 import org.eclipse.ui.dialogs.PatternFilter; 15 import org.eclipse.ui.views.IViewCategory; 16 import org.eclipse.ui.views.IViewDescriptor; 17 18 25 public class ViewPatternFilter extends PatternFilter { 26 27 31 public ViewPatternFilter() { 32 super(); 33 } 34 35 39 public boolean isElementSelectable(Object element) { 40 return element instanceof IViewDescriptor; 41 } 42 43 46 protected boolean isLeafMatch(Viewer viewer, Object element) { 47 if (element instanceof IViewCategory) { 48 return false; 49 } 50 51 String text = null; 52 if (element instanceof IViewDescriptor) { 53 IViewDescriptor desc = (IViewDescriptor) element; 54 text = desc.getLabel(); 55 if (wordMatches(text)) { 56 return true; 57 } 58 } 59 60 return false; 61 } 62 } 63 | Popular Tags |