public void run() { Shell shell = fPage.getSite().getShell(); AbstractTextSearchResult input = fPage.getInput(); if (input == null) { return; } MatchFilter[] allFilters = input.getAllMatchFilters(); MatchFilter[] checkedFilters = input.getActiveMatchFilters(); Integer limit = fPage.getElementLimit(); boolean enableMatchFilterConfiguration = checkedFilters != null; boolean enableLimitConfiguration = limit != null; int elementLimit = limit != null ? limit.intValue() : -1; MatchFilterSelectionDialog dialog = new MatchFilterSelectionDialog( shell, enableMatchFilterConfiguration, allFilters, checkedFilters, enableLimitConfiguration, elementLimit); if (dialog.open() == Window.OK) { if (enableMatchFilterConfiguration) { input.setActiveMatchFilters(dialog.getMatchFilters()); } if (enableLimitConfiguration) { fPage.setElementLimit(new Integer(dialog.getLimit())); } } }
public String getText(Object element) { if (!(element instanceof IResource)) return null; IResource resource = (IResource) element; String text = null; if (!resource.exists()) text = SearchMessages.FileLabelProvider_removed_resource_label; else { IPath path = resource.getFullPath().removeLastSegments(1); if (path.getDevice() == null) path = path.makeRelative(); if (fOrder == SHOW_LABEL || fOrder == SHOW_LABEL_PATH) { text = fLabelProvider.getText(resource); if (path != null && fOrder == SHOW_LABEL_PATH) { fArgs[0] = text; fArgs[1] = path.toString(); text = MessageFormat.format(fgSeparatorFormat, fArgs); } } else { if (path != null) text = path.toString(); else text = ""; // $NON-NLS-1$ if (fOrder == SHOW_PATH_LABEL) { fArgs[0] = text; fArgs[1] = fLabelProvider.getText(resource); text = MessageFormat.format(fgSeparatorFormat, fArgs); } } } int matchCount = 0; AbstractTextSearchResult result = fPage.getInput(); if (result != null) matchCount = result.getMatchCount(element); if (matchCount <= 1) return text; String format = SearchMessages.FileLabelProvider_count_format; return MessageFormat.format(format, new Object[] {text, new Integer(matchCount)}); }