use of org.eclipse.search.ui.text.IFileMatchAdapter in project eclipse.platform.text by eclipse.
the class PositionTracker method getTrackedFileBuffer.
private ITextFileBuffer getTrackedFileBuffer(AbstractTextSearchResult result, Object element) {
IFileMatchAdapter adapter = result.getFileMatchAdapter();
if (adapter == null)
return null;
IFile file = adapter.getFile(element);
if (file == null)
return null;
if (!file.exists())
return null;
return FileBuffers.getTextFileBufferManager().getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
}
use of org.eclipse.search.ui.text.IFileMatchAdapter in project eclipse.platform.text by eclipse.
the class PositionTracker method bufferCreated.
// IFileBufferListener implementation ---------------------------------------------------------------------
@Override
public void bufferCreated(IFileBuffer buffer) {
final int[] trackCount = new int[1];
if (!(buffer instanceof ITextFileBuffer))
return;
IPath location = buffer.getLocation();
if (location == null)
return;
IFile file = FileBuffers.getWorkspaceFileAtLocation(location);
if (file == null)
return;
ISearchQuery[] queries = NewSearchUI.getQueries();
for (ISearchQuery query : queries) {
ISearchResult result = query.getSearchResult();
if (result instanceof AbstractTextSearchResult) {
AbstractTextSearchResult textResult = (AbstractTextSearchResult) result;
IFileMatchAdapter adapter = textResult.getFileMatchAdapter();
if (adapter != null) {
Match[] matches = adapter.computeContainedMatches(textResult, file);
for (Match match : matches) {
trackCount[0]++;
trackPosition((AbstractTextSearchResult) result, (ITextFileBuffer) buffer, match);
}
}
}
}
}
Aggregations