use of org.eclipse.jdt.core.search.SearchDocument in project che by eclipse.
the class IndexManager method addBinary.
/**
* Trigger addition of a resource to an index
* Note: the actual operation is performed in background
*/
public void addBinary(IFile resource, IPath containerPath) {
// if (JavaCore.getPlugin() == null) return;
SearchParticipant participant = SearchEngine.getDefaultSearchParticipant();
SearchDocument document = participant.getDocument(resource.getFullPath().toString());
IndexLocation indexLocation = computeIndexLocation(containerPath);
scheduleDocumentIndexing(document, containerPath, indexLocation, participant);
}
use of org.eclipse.jdt.core.search.SearchDocument in project webtools.sourceediting by eclipse.
the class BasicJSPSearchRequestor method acceptSearchMatch.
/**
* Maps java search coordinates to corresponding JSP coordinates.
* Adds the matches to the Search Results view.
* @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch)
*/
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (JSPSearchSupport.getInstance().isCanceled())
return;
String matchDocumentPath = match.getResource().getFullPath().toString();
SearchDocument searchDoc = JSPSearchSupport.getInstance().getSearchDocument(matchDocumentPath);
if (searchDoc != null && searchDoc instanceof JavaSearchDocumentDelegate) {
JavaSearchDocumentDelegate javaSearchDoc = (JavaSearchDocumentDelegate) searchDoc;
int jspStart = javaSearchDoc.getJspOffset(match.getOffset());
int jspEnd = javaSearchDoc.getJspOffset(match.getOffset() + match.getLength());
JSPTranslation trans = javaSearchDoc.getJspTranslation();
String jspText = trans.getJspText();
String javaText = javaSearchDoc.getJavaText();
if (DEBUG)
displayDebugInfo(match, jspStart, jspEnd, jspText, javaText);
if (jspStart > -1 && jspEnd > -1)
addSearchMatch(new Document(trans.getJspText()), javaSearchDoc.getFile(), jspStart, jspEnd, jspText);
}
}
use of org.eclipse.jdt.core.search.SearchDocument in project webtools.sourceediting by eclipse.
the class BasicRefactorSearchRequestor method acceptSearchMatch.
/**
* @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch)
*/
public void acceptSearchMatch(SearchMatch javaMatch) throws CoreException {
String matchDocumentPath = javaMatch.getResource().getFullPath().toString();
SearchDocument searchDoc = JSPSearchSupport.getInstance().getSearchDocument(matchDocumentPath);
if (searchDoc != null && searchDoc instanceof JavaSearchDocumentDelegate) {
String renameText = getRenameText((JavaSearchDocumentDelegate) searchDoc, javaMatch);
// if rename text is null then don't create an edit for it
if (renameText != null) {
// add it for the correct document
addJavaEdit(searchDoc.getPath(), new ReplaceEdit(javaMatch.getOffset(), javaMatch.getLength(), renameText));
}
}
}
use of org.eclipse.jdt.core.search.SearchDocument in project webtools.sourceediting by eclipse.
the class JSPSearchTests method testIndexWorkspace.
public void testIndexWorkspace() {
JSPSearchSupport support = JSPSearchSupport.getInstance();
SearchDocument doc = JSPSearchSupport.getInstance().getSearchDocument("/judo/searchTestJSP.java");
assertNotNull("couldn't retrieve:'/judo/searchTestJSP.java'", doc);
doc = support.getSearchDocument("/judo/searchTestJSP2.java");
assertNotNull("couldn't retrieve:'/judo/searchTestJSP2.java'", doc);
doc = support.getSearchDocument("/judo/searchTestJSP3.java");
assertNotNull("couldn't retrieve:'/judo/searchTestJSP3.java'", doc);
}
use of org.eclipse.jdt.core.search.SearchDocument in project webtools.sourceediting by eclipse.
the class JSPSearchSupport method getSearchDocument.
/**
* Centralized place to access JSPSearchDocuments (used by
* JSPSearchParticipant and JSPSearchRequestor)
*
* @param searchDocPath
* @param doc
* @return the JSPSearchDocument or null if one is not found
*/
public SearchDocument getSearchDocument(String searchDocPath) {
SearchDocument delegate = null;
IFile f = fileForCUPath(searchDocPath);
if (f != null) {
delegate = createSearchDocument(f);
} else {
// handle failure case... (file deleted maybe?)
}
return delegate;
}
Aggregations