/** * Note: this is internal API and should not be called from clients outside * of the search plug-in. * <p> * Removes the currently selected match. Does nothing if no match is * selected. * </p> */ public void internalRemoveSelected() { AbstractTextSearchResult result = getInput(); if (result == null) return; StructuredViewer viewer = getViewer(); IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); HashSet set = new HashSet(); if (viewer instanceof TreeViewer) { ITreeContentProvider cp = (ITreeContentProvider) viewer.getContentProvider(); collectAllMatchesBelow(result, set, cp, selection.toArray()); } else { collectAllMatches(set, selection.toArray()); } Match[] matches = new Match[set.size()]; set.toArray(matches); result.removeMatches(matches); }
/** * Note: this is internal API and should not be called from clients outside * of the search plug-in. * <p> * Removes the currently selected match. Does nothing if no match is * selected. * </p> * * @noreference This method is not intended to be referenced by clients. */ public void internalRemoveSelected() { AbstractTextSearchResult result = getInput(); if (result == null) return; StructuredViewer viewer = getViewer(); IStructuredSelection selection = viewer.getStructuredSelection(); HashSet<Match> set = new HashSet<>(); if (viewer instanceof TreeViewer) { ITreeContentProvider cp = (ITreeContentProvider) viewer.getContentProvider(); collectAllMatchesBelow(result, set, cp, selection.toArray()); } else { collectAllMatches(set, selection.toArray()); } navigateNext(true); Match[] matches = new Match[set.size()]; set.toArray(matches); result.removeMatches(matches); }