Search in sources :

Example 1 with JsSearchSupport

use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport in project webtools.sourceediting by eclipse.

the class JsSearchQuery method doQuery.

protected IStatus doQuery() {
    IStatus status = Status.OK_STATUS;
    try {
        JsSearchSupport support = JsSearchSupport.getInstance();
        // index the file
        SearchDocument delegate = support.addJspFile(getFile());
        String scopePath = delegate.getPath();
        JsSearchScope singleFileScope = new JsSearchScope(new String[] { getFile().getFullPath().toString(), scopePath });
        // perform a searchs
        // by passing in this jsp search query, requstor can add matches
        // support.searchRunnable(getJavaElement(), singleFileScope, new
        // JSPSingleFileSearchRequestor(getInstance()));
        support.searchRunnable(getJavaElement(), singleFileScope, new JsSingleFileSearchRequestor(getInstance()));
    } catch (Exception e) {
        // $NON-NLS-1$	//$NON-NLS-2$
        status = new Status(IStatus.ERROR, "org.eclipse.wst.sse.ui", IStatus.OK, "", null);
    }
    return status;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) JsSearchScope(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope) IStatus(org.eclipse.core.runtime.IStatus) JsSearchSupport(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport) SearchDocument(org.eclipse.wst.jsdt.core.search.SearchDocument)

Example 2 with JsSearchSupport

use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport in project webtools.sourceediting by eclipse.

the class JSPTypeMoveChange method createChangesFor.

public static Change[] createChangesFor(IType type, String newName) {
    JsSearchSupport support = JsSearchSupport.getInstance();
    // should be handled by JSPIndexManager
    // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=3036
    // support.indexWorkspaceAndWait();
    JSPTypeMoveRequestor requestor = new JSPTypeMoveRequestor(type, newName);
    support.searchRunnable(type, new JsSearchScope(), requestor);
    return requestor.getChanges();
}
Also used : JsSearchScope(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope) JsSearchSupport(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport)

Example 3 with JsSearchSupport

use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport 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)

Example 4 with JsSearchSupport

use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport in project webtools.sourceediting by eclipse.

the class JSPMethodRenameChange method createChangesFor.

public static Change[] createChangesFor(IFunction method, String newName) {
    JsSearchSupport support = JsSearchSupport.getInstance();
    // should be handled by JSPIndexManager
    // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=3036
    // support.indexWorkspaceAndWait();
    BasicRefactorSearchRequestor requestor = new JSPMethodRenameRequestor(method, newName);
    support.searchRunnable(method, new JsSearchScope(), requestor);
    return requestor.getChanges();
}
Also used : JsSearchScope(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope) JsSearchSupport(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport)

Example 5 with JsSearchSupport

use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport in project webtools.sourceediting by eclipse.

the class JSPPackageRenameChange method createChangesFor.

public static Change[] createChangesFor(IPackageFragment pkg, String newName) {
    JsSearchSupport support = JsSearchSupport.getInstance();
    // should be handled by JSPIndexManager
    // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=3036
    // support.indexWorkspaceAndWait();
    BasicRefactorSearchRequestor requestor = new JSPPackageRenameRequestor(pkg, newName);
    support.searchRunnable(pkg, new JsSearchScope(), requestor);
    return requestor.getChanges();
}
Also used : JsSearchScope(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope) JsSearchSupport(org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport)

Aggregations

JsSearchSupport (org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport)6 JsSearchScope (org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope)5 SearchDocument (org.eclipse.wst.jsdt.core.search.SearchDocument)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Change (org.eclipse.ltk.core.refactoring.Change)1 DocumentChange (org.eclipse.ltk.core.refactoring.DocumentChange)1 MultiTextEdit (org.eclipse.text.edits.MultiTextEdit)1 JSDTSearchDocumentDelegate (org.eclipse.wst.jsdt.web.core.javascript.search.JSDTSearchDocumentDelegate)1