boolean (Object element, String pattern) { Object userObject = ((DefaultMutableTreeNode)((TreePath)element).getLastPathComponent()).getUserObject(); if (userObject instanceof ItemElement) { String str = getElementText(element); if (str == null) { return false; } if (!hasCapitals(pattern)) { // be case-sensitive only if user types capitals str = StringUtil.toLowerCase(str); } if (pattern.contains(File.separator)) { return compare(str,pattern); } final StringTokenizer tokenizer = new StringTokenizer(str, File.separator); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); if (compare(token,pattern)) { return true; } } return false; } else { return super.isMatchingElement(element, pattern); } }