private boolean isActiveMatchFilter() { AbstractTextSearchResult input= fPage.getInput(); if (input != null) { MatchFilter[] activeMatchFilters= input.getActiveMatchFilters(); for (int i= 0; i < activeMatchFilters.length; i++) { if (fFilter.equals(activeMatchFilters[i])) { return true; } } } return false; }
private boolean isActiveMatchFilter() { AbstractTextSearchResult input= fPage.getInput(); if (input != null) { MatchFilter[] activeMatchFilters= input.getActiveMatchFilters(); for (MatchFilter activeMatchFilter : activeMatchFilters) { if (fFilter.equals(activeMatchFilter)) { return true; } } } return false; }
private void updateFilterStateForAllMatches() { boolean disableFiltering= getActiveMatchFilters() == null; ArrayList changed= new ArrayList(); Object[] elements= getElements(); for (int i= 0; i < elements.length; i++) { Match[] matches= getMatches(elements[i]); for (int k= 0; k < matches.length; k++) { if (disableFiltering || updateFilterState(matches[k])) { changed.add(matches[k]); } } } Match[] allChanges= (Match[]) changed.toArray(new Match[changed.size()]); fireChange(new FilterUpdateEvent(this, allChanges, getActiveMatchFilters())); }
private void updateFilterStateForAllMatches() { boolean disableFiltering = getActiveMatchFilters() == null; ArrayList changed = new ArrayList(); Object[] elements = getElements(); for (int i = 0; i < elements.length; i++) { Match[] matches = getMatches(elements[i]); for (int k = 0; k < matches.length; k++) { if (disableFiltering || updateFilterState(matches[k])) { changed.add(matches[k]); } } } Match[] allChanges = (Match[]) changed.toArray(new Match[changed.size()]); fireChange(new FilterUpdateEvent(this, allChanges, getActiveMatchFilters())); }
private void updateFilterStateForAllMatches() { boolean disableFiltering= getActiveMatchFilters() == null; ArrayList<Match> changed= new ArrayList<>(); Object[] elements= getElements(); for (Object element : elements) { Match[] matches= getMatches(element); for (Match match : matches) { if (disableFiltering || updateFilterState(match)) { changed.add(match); } } } Match[] allChanges= changed.toArray(new Match[changed.size()]); fireChange(new FilterUpdateEvent(this, allChanges, getActiveMatchFilters())); }
public void run() { AbstractTextSearchResult input= fPage.getInput(); if (input == null) { return; } ArrayList newFilters= new ArrayList(); MatchFilter[] activeMatchFilters= input.getActiveMatchFilters(); if (activeMatchFilters == null) { return; } for (int i= 0; i < activeMatchFilters.length; i++) { if (!activeMatchFilters[i].equals(fFilter)) { newFilters.add(activeMatchFilters[i]); } } boolean newState= isChecked(); if (newState) { newFilters.add(fFilter); } input.setActiveMatchFilters((MatchFilter[]) newFilters.toArray(new MatchFilter[newFilters.size()])); }
@Override public void run() { AbstractTextSearchResult input= fPage.getInput(); if (input == null) { return; } ArrayList<MatchFilter> newFilters= new ArrayList<>(); MatchFilter[] activeMatchFilters= input.getActiveMatchFilters(); if (activeMatchFilters == null) { return; } for (int i= 0; i < activeMatchFilters.length; i++) { if (!activeMatchFilters[i].equals(fFilter)) { newFilters.add(activeMatchFilters[i]); } } boolean newState= isChecked(); if (newState) { newFilters.add(fFilter); } input.setActiveMatchFilters(newFilters.toArray(new MatchFilter[newFilters.size()])); }
@Override public String getLabel() { String label= super.getLabel(); AbstractTextSearchResult input= getInput(); if (input != null && input.getActiveMatchFilters() != null && input.getActiveMatchFilters().length > 0) { if (isQueryRunning()) { String message= SearchMessages.JavaSearchResultPage_filtered_message; return Messages.format(message, new Object[] { label }); } else { int filteredOut= input.getMatchCount() - getFilteredMatchCount(); String message= SearchMessages.JavaSearchResultPage_filteredWithCount_message; return Messages.format(message, new Object[] { label, String.valueOf(filteredOut) }); } } return label; }
public String getLabel() { String label= super.getLabel(); AbstractTextSearchResult input= getInput(); if (input != null && input.getActiveMatchFilters() != null && input.getActiveMatchFilters().length > 0) { if (isQueryRunning()) { String message= SearchMessages.JavaSearchResultPage_filtered_message; return Messages.format(message, new Object[] { label }); } else { int filteredOut= input.getMatchCount() - getFilteredMatchCount(); String message= SearchMessages.JavaSearchResultPage_filteredWithCount_message; return Messages.format(message, new Object[] { label, String.valueOf(filteredOut) }); } } return label; }
@Override public String getLabel() { String label= super.getLabel(); AbstractTextSearchResult input= getInput(); if (input != null && input.getActiveMatchFilters() != null && input.getActiveMatchFilters().length > 0) { if (isQueryRunning()) { String message= SearchMessages.JavaSearchResultPage_filtered_message; return Messages.format(message, new Object[] { label }); } else { int filteredOut= input.getMatchCount() - getFilteredMatchCount(); String message= SearchMessages.JavaSearchResultPage_filteredWithCount_message; return Messages.format(message, new Object[] { label, String.valueOf(filteredOut) }); } } return label; }
private boolean updateFilterState(Match match) { MatchFilter[] matchFilters = getActiveMatchFilters(); if (matchFilters == null) { return false; // do nothing, no change } boolean oldState = match.isFiltered(); for (int i = 0; i < matchFilters.length; i++) { if (matchFilters[i].filters(match)) { match.setFiltered(true); return !oldState; } } match.setFiltered(false); return oldState; }
private boolean updateFilterState(Match match) { MatchFilter[] matchFilters= getActiveMatchFilters(); if (matchFilters == null) { return false; // do nothing, no change } boolean oldState= match.isFiltered(); for (MatchFilter matchFilter : matchFilters) { if (matchFilter.filters(match)) { match.setFiltered(true); return !oldState; } } match.setFiltered(false); return oldState; }
private boolean updateFilterState(Match match) { MatchFilter[] matchFilters= getActiveMatchFilters(); if (matchFilters == null) { return false; // do nothing, no change } boolean oldState= match.isFiltered(); for (int i= 0; i < matchFilters.length; i++) { if (matchFilters[i].filters(match)) { match.setFiltered(true); return !oldState; } } match.setFiltered(false); return oldState; }
return EMPTY_MATCH_ARRAY; Match[] matches= result.getMatches(element); if (result.getActiveMatchFilters() == null) // default behaviour: filter state not used, all matches shown return matches;
return EMPTY_MATCH_ARRAY; Match[] matches= result.getMatches(element); if (result.getActiveMatchFilters() == null) // default behaviour: filter state not used, all matches shown return matches;
/** * Returns the number of matches that are currently displayed for the given * element. If {@link AbstractTextSearchResult#getActiveMatchFilters()} is not null, only matches * are returned that are not filtered by the match filters. * Any action operating on the visible matches in the * search result page should use this method to get the match count for a * search result (instead of asking the search result directly). * * @param element * The element to get the matches for * @return The number of matches displayed for the given element. If the * current input of this page is <code>null</code>, 0 is * returned * @see AbstractTextSearchResult#getMatchCount(Object) */ public int getDisplayedMatchCount(Object element) { AbstractTextSearchResult result= getInput(); if (result == null) return 0; if (result.getActiveMatchFilters() == null) // default behaviour: filter state not used, all matches shown return result.getMatchCount(element); int count= 0; Match[] matches= result.getMatches(element); for (int i= 0; i < matches.length; i++) { if (!matches[i].isFiltered()) count++; } return count; }
/** * Returns the number of matches that are currently displayed for the given * element. If {@link AbstractTextSearchResult#getActiveMatchFilters()} is not null, only matches * are returned that are not filtered by the match filters. * Any action operating on the visible matches in the * search result page should use this method to get the match count for a * search result (instead of asking the search result directly). * * @param element * The element to get the matches for * @return The number of matches displayed for the given element. If the * current input of this page is <code>null</code>, 0 is * returned * @see AbstractTextSearchResult#getMatchCount(Object) */ public int getDisplayedMatchCount(Object element) { AbstractTextSearchResult result= getInput(); if (result == null) return 0; if (result.getActiveMatchFilters() == null) // default behaviour: filter state not used, all matches shown return result.getMatchCount(element); int count= 0; Match[] matches= result.getMatches(element); for (int i= 0; i < matches.length; i++) { if (!matches[i].isFiltered()) count++; } return count; }
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())); } } }
@Override 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(Integer.valueOf(dialog.getLimit())); } } }