public final void acceptSearchMatch(final SearchMatch match) throws CoreException { final SearchMatch accepted= fRequestor.acceptSearchMatch(match); if (accepted != null) { fCollectedMatches.add(accepted); final IResource resource= accepted.getResource(); if (!resource.equals(fLastResource)) { if (fBinary) { final IJavaElement element= JavaCore.create(resource);
public void acceptSearchMatch(SearchMatch match) throws CoreException { IJavaElement enclosingElement= (IJavaElement) match.getElement(); String resourceName= match.getResource().getName(); if ((enclosingElement instanceof IType) && (resourceName.equals(fCUName))) fFound= enclosingElement; } }
public final void acceptSearchMatch(final SearchMatch match) throws CoreException { final SearchMatch accepted= fRequestor.acceptSearchMatch(match); if (accepted != null) { final IResource resource= accepted.getResource(); if (!resource.equals(fLastResource)) { final IJavaElement element= JavaCore.create(resource); if (element instanceof ICompilationUnit) fCollectedUnits.add(element); } if (fInaccurate && accepted.getAccuracy() == SearchMatch.A_INACCURATE && !fInaccurateMatches.contains(accepted)) { fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_inaccurate_match, accepted.getResource().getName()), null, null, RefactoringStatusEntry.NO_CODE); fInaccurateMatches.add(accepted); } } }
@Override public final void acceptSearchMatch(final SearchMatch match) throws CoreException { final SearchMatch accepted= fRequestor.acceptSearchMatch(match); if (accepted != null) { final IResource resource= accepted.getResource(); if (!resource.equals(fLastResource)) { final IJavaElement element= JavaCore.create(resource); if (element instanceof ICompilationUnit) { fCollectedUnits.add((ICompilationUnit) element); } } if (fInaccurate && accepted.getAccuracy() == SearchMatch.A_INACCURATE && !fInaccurateMatches.contains(accepted)) { fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_inaccurate_match, BasicElementLabels.getResourceName(accepted.getResource())), null, null, RefactoringStatusEntry.NO_CODE); fInaccurateMatches.add(accepted); } } }
@Override public final void acceptSearchMatch(final SearchMatch match) throws CoreException { final SearchMatch accepted= fRequestor.acceptSearchMatch(match); if (accepted != null) { final IResource resource= accepted.getResource(); if (!resource.equals(fLastResource)) { final IJavaElement element= JavaCore.create(resource); if (element instanceof ICompilationUnit) fCollectedUnits.add((ICompilationUnit) element); } if (fInaccurate && accepted.getAccuracy() == SearchMatch.A_INACCURATE && !fInaccurateMatches.contains(accepted)) { fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_inaccurate_match, BasicElementLabels.getResourceName(accepted.getResource())), null, null, RefactoringStatusEntry.NO_CODE); fInaccurateMatches.add(accepted); } } }
@Override public final void acceptSearchMatch(final SearchMatch match) throws CoreException { final SearchMatch accepted= fRequestor.acceptSearchMatch(match); if (accepted != null) { final IResource resource= accepted.getResource(); if (!resource.equals(fLastResource)) { final IJavaElement element= JavaCore.create(resource); if (element instanceof ICompilationUnit) fCollectedUnits.add((ICompilationUnit) element); } if (fInaccurate && accepted.getAccuracy() == SearchMatch.A_INACCURATE && !fInaccurateMatches.contains(accepted)) { fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_inaccurate_match, BasicElementLabels.getResourceName(accepted.getResource())), null, null, RefactoringStatusEntry.NO_CODE); fInaccurateMatches.add(accepted); } } }
private int getLineNumber(SearchMatch match) throws BadLocationException, IOException, CoreException { IResource resource = match.getResource(); if (!(resource instanceof IFile)) { // Log Error return -1; } IFile file = (IFile) resource; int offset = match.getOffset(); byte[] bytes = new byte[offset]; int read = file.getContents().read(bytes, 0, offset); if (read != offset) { // Log error return -1; } String contents = new String(bytes); Document fileSource = new Document(contents); return fileSource.getLineOfOffset(offset) + 1; }
private static boolean existsInNewOccurrences(SearchMatch searchResult, SearchResultGroup[] newOccurrences, TextChangeManager manager) { SearchResultGroup newGroup= findOccurrenceGroup(searchResult.getResource(), newOccurrences); if (newGroup == null) return false; IRegion oldEditRange= getCorrespondingEditChangeRange(searchResult, manager); if (oldEditRange == null) return false; SearchMatch[] newSearchResults= newGroup.getSearchResults(); int oldRangeOffset = oldEditRange.getOffset(); for (int i= 0; i < newSearchResults.length; i++) { if (newSearchResults[i].getOffset() == oldRangeOffset) return true; } return false; }
private static boolean existsInNewOccurrences(SearchMatch searchResult, SearchResultGroup[] newOccurrences, TextChangeManager manager) { SearchResultGroup newGroup= findOccurrenceGroup(searchResult.getResource(), newOccurrences); if (newGroup == null) { return false; } IRegion oldEditRange= getCorrespondingEditChangeRange(searchResult, manager); if (oldEditRange == null) { return false; } SearchMatch[] newSearchResults= newGroup.getSearchResults(); int oldRangeOffset = oldEditRange.getOffset(); for (int i= 0; i < newSearchResults.length; i++) { if (newSearchResults[i].getOffset() == oldRangeOffset) { return true; } } return false; }
private static boolean existsInNewOccurrences(SearchMatch searchResult, SearchResultGroup[] newOccurrences, TextChangeManager manager) { SearchResultGroup newGroup= findOccurrenceGroup(searchResult.getResource(), newOccurrences); if (newGroup == null) return false; IRegion oldEditRange= getCorrespondingEditChangeRange(searchResult, manager); if (oldEditRange == null) return false; SearchMatch[] newSearchResults= newGroup.getSearchResults(); int oldRangeOffset = oldEditRange.getOffset(); for (int i= 0; i < newSearchResults.length; i++) { if (newSearchResults[i].getOffset() == oldRangeOffset) return true; } return false; }
private static boolean existsInNewOccurrences(SearchMatch searchResult, SearchResultGroup[] newOccurrences, TextChangeManager manager) { SearchResultGroup newGroup= findOccurrenceGroup(searchResult.getResource(), newOccurrences); if (newGroup == null) return false; IRegion oldEditRange= getCorrespondingEditChangeRange(searchResult, manager); if (oldEditRange == null) return false; SearchMatch[] newSearchResults= newGroup.getSearchResults(); int oldRangeOffset = oldEditRange.getOffset(); for (int i= 0; i < newSearchResults.length; i++) { if (newSearchResults[i].getOffset() == oldRangeOffset) return true; } return false; }
/** * @param match * @return the enclosing {@link ICompilationUnit} of the given match, or null iff none */ public static ICompilationUnit getCompilationUnit(SearchMatch match) { IJavaElement enclosingElement = getEnclosingJavaElement(match); if (enclosingElement != null){ if (enclosingElement instanceof ICompilationUnit) return (ICompilationUnit) enclosingElement; ICompilationUnit cu= (ICompilationUnit) enclosingElement.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) return cu; } IJavaElement jElement= JavaCore.create(match.getResource()); if (jElement != null && jElement.exists() && jElement.getElementType() == IJavaElement.COMPILATION_UNIT) return (ICompilationUnit) jElement; return null; }
/** * @param match the search match * @return the enclosing {@link ICompilationUnit} of the given match, or null iff none */ public static ICompilationUnit getCompilationUnit(SearchMatch match) { IJavaElement enclosingElement = getEnclosingJavaElement(match); if (enclosingElement != null){ if (enclosingElement instanceof ICompilationUnit) return (ICompilationUnit) enclosingElement; ICompilationUnit cu= (ICompilationUnit) enclosingElement.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) return cu; } IJavaElement jElement= JavaCore.create(match.getResource()); if (jElement != null && jElement.exists() && jElement.getElementType() == IJavaElement.COMPILATION_UNIT) return (ICompilationUnit) jElement; return null; }
/** * @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch) */ public void acceptSearchMatch(SearchMatch match) throws CoreException { this.resultCollector.accept( match.getResource(), match.getOffset(), match.getOffset() + match.getLength(), (IJavaElement) match.getElement(), match.getAccuracy() ); } /**
/** * @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch) */ public void acceptSearchMatch(SearchMatch match) throws CoreException { this.resultCollector.accept( match.getResource(), match.getOffset(), match.getOffset() + match.getLength(), (IJavaElement) match.getElement(), match.getAccuracy() ); } /**
/** * @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch) */ public void acceptSearchMatch(SearchMatch match) throws CoreException { this.resultCollector.accept( match.getResource(), match.getOffset(), match.getOffset() + match.getLength(), (IJavaElement) match.getElement(), match.getAccuracy() ); } /**
/** * @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch) */ public void acceptSearchMatch(SearchMatch match) throws CoreException { this.resultCollector.accept( match.getResource(), match.getOffset(), match.getOffset() + match.getLength(), (IJavaElement) match.getElement(), match.getAccuracy() ); } /**
/** * @param match the search match * @return the enclosing {@link ICompilationUnit} of the given match, or null iff none */ public static ICompilationUnit getCompilationUnit(SearchMatch match) { IJavaElement enclosingElement = getEnclosingJavaElement(match); if (enclosingElement != null){ if (enclosingElement instanceof ICompilationUnit) return (ICompilationUnit) enclosingElement; ICompilationUnit cu= (ICompilationUnit) enclosingElement.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) return cu; } IJavaElement jElement= JavaCore.create(match.getResource()); if (jElement != null && jElement.exists() && jElement.getElementType() == IJavaElement.COMPILATION_UNIT) return (ICompilationUnit) jElement; return null; }
/** * @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch) */ @Override public void acceptSearchMatch(SearchMatch match) throws CoreException { this.resultCollector.accept( match.getResource(), match.getOffset(), match.getOffset() + match.getLength(), (IJavaElement) match.getElement(), match.getAccuracy() ); } /**
/** * @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch) */ public void acceptSearchMatch(SearchMatch match) throws CoreException { this.resultCollector.accept( match.getResource(), match.getOffset(), match.getOffset() + match.getLength(), (IJavaElement) match.getElement(), match.getAccuracy() ); } /**