Search in sources :

Example 6 with SearchDocument

use of org.eclipse.wst.jsdt.core.search.SearchDocument 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()]);
}
Also used : JSDTSearchDocumentDelegate(org.eclipse.wst.jsdt.web.core.javascript.search.JSDTSearchDocumentDelegate) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) JsSearchSupport(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport) ArrayList(java.util.ArrayList) List(java.util.List) Change(org.eclipse.ltk.core.refactoring.Change) DocumentChange(org.eclipse.ltk.core.refactoring.DocumentChange) MultiTextEdit(org.eclipse.text.edits.MultiTextEdit) SearchDocument(org.eclipse.wst.jsdt.core.search.SearchDocument)

Aggregations

SearchDocument (org.eclipse.wst.jsdt.core.search.SearchDocument)6 JSDTSearchDocumentDelegate (org.eclipse.wst.jsdt.web.core.javascript.search.JSDTSearchDocumentDelegate)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 JsSearchSupport (org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport)2 Iterator (java.util.Iterator)1 IFile (org.eclipse.core.resources.IFile)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Document (org.eclipse.jface.text.Document)1 IDocument (org.eclipse.jface.text.IDocument)1 Change (org.eclipse.ltk.core.refactoring.Change)1 DocumentChange (org.eclipse.ltk.core.refactoring.DocumentChange)1 MultiTextEdit (org.eclipse.text.edits.MultiTextEdit)1 ReplaceEdit (org.eclipse.text.edits.ReplaceEdit)1 IJsTranslation (org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation)1 JsSearchScope (org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope)1