use of org.eclipse.wst.jsdt.web.core.javascript.search.JSDTSearchDocumentDelegate in project webtools.sourceediting by eclipse.
the class BasicRefactorSearchRequestor method acceptSearchMatch.
/**
* @see org.eclipse.wst.jsdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.wst.jsdt.core.search.SearchMatch)
*/
public void acceptSearchMatch(SearchMatch javaMatch) throws CoreException {
String matchDocumentPath = javaMatch.getResource().getFullPath().toString();
SearchDocument searchDoc = JsSearchSupport.getInstance().getSearchDocument(matchDocumentPath);
if (searchDoc != null && searchDoc instanceof JSDTSearchDocumentDelegate) {
String renameText = getRenameText((JSDTSearchDocumentDelegate) searchDoc, javaMatch);
// add it for the correct document
addJavaEdit(searchDoc.getPath(), new ReplaceEdit(javaMatch.getOffset(), javaMatch.getLength(), renameText));
}
}
use of org.eclipse.wst.jsdt.web.core.javascript.search.JSDTSearchDocumentDelegate in project webtools.sourceediting by eclipse.
the class BasicJsSearchRequestor method acceptSearchMatch.
/**
* Maps java search coordinates to corresponding JSP coordinates. Adds the
* matches to the Search Results view.
*
* @see org.eclipse.wst.jsdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.wst.jsdt.core.search.SearchMatch)
*/
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (JsSearchSupport.getInstance().isCanceled()) {
return;
}
String matchDocumentPath = match.getResource().getFullPath().toString();
SearchDocument searchDoc = JsSearchSupport.getInstance().getSearchDocument(matchDocumentPath);
if (searchDoc != null && searchDoc instanceof JSDTSearchDocumentDelegate) {
JSDTSearchDocumentDelegate javaSearchDoc = (JSDTSearchDocumentDelegate) searchDoc;
int jspStart = match.getOffset();
int jspEnd = match.getOffset() + match.getLength();
IJsTranslation trans = javaSearchDoc.getJspTranslation();
String jspText = trans.getHtmlText();
String javaText = javaSearchDoc.getJavaText();
if (BasicJsSearchRequestor.DEBUG) {
displayDebugInfo(match, jspStart, jspEnd, jspText, javaText);
}
if (jspStart > -1 && jspEnd > -1) {
addSearchMatch(new Document(trans.getHtmlText()), javaSearchDoc.getFile(), jspStart, jspEnd, jspText);
}
}
}
use of org.eclipse.wst.jsdt.web.core.javascript.search.JSDTSearchDocumentDelegate in project webtools.sourceediting by eclipse.
the class BasicRefactorSearchRequestor method getChanges.
/**
* @return all JSP changes for the search matches for the given Type
*/
public Change[] getChanges() {
JsSearchSupport support = JsSearchSupport.getInstance();
List changes = new ArrayList();
Iterator keys = fSearchDocPath2JavaEditMap.keySet().iterator();
String searchDocPath = null;
SearchDocument delegate = null;
while (keys.hasNext()) {
// create on the fly
searchDocPath = (String) keys.next();
MultiTextEdit javaEdit = (MultiTextEdit) fSearchDocPath2JavaEditMap.get(searchDocPath);
delegate = support.getSearchDocument(searchDocPath);
if (delegate != null && delegate instanceof JSDTSearchDocumentDelegate) {
JSDTSearchDocumentDelegate javaDelegate = (JSDTSearchDocumentDelegate) delegate;
changes.add(createChange(javaDelegate, javaEdit));
}
}
return (Change[]) changes.toArray(new Change[changes.size()]);
}
Aggregations