use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope 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;
}
use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope in project webtools.sourceediting by eclipse.
the class JsQueryParticipant method search.
/**
* @see org.eclipse.wst.jsdt.ui.search.IQueryParticipant#search(org.eclipse.wst.jsdt.ui.search.ISearchRequestor,
* org.eclipse.wst.jsdt.ui.search.QuerySpecification,
* org.eclipse.core.runtime.IProgressMonitor)
*/
public void search(ISearchRequestor requestor, QuerySpecification querySpecification, IProgressMonitor monitor) throws CoreException {
// do search based on the particular Java query
if (querySpecification instanceof ElementQuerySpecification) {
// element search (eg. from global find references in Java file)
ElementQuerySpecification elementQuery = (ElementQuerySpecification) querySpecification;
IJavaScriptElement element = elementQuery.getElement();
if (JsQueryParticipant.DEBUG) {
// $NON-NLS-1$
System.out.println("JSP Query Participant searching on ELEMENT: " + element);
}
SearchRequestor jspRequestor = new JsSearchRequestor(requestor);
// pa_TODO need to adapt JavaSearchScope to a JSPSearchScope
JsSearchSupport.getInstance().search(element, new JsSearchScope(), jspRequestor);
} else if (querySpecification instanceof PatternQuerySpecification) {
// pattern search (eg. from Java search page)
PatternQuerySpecification patternQuery = (PatternQuerySpecification) querySpecification;
String pattern = patternQuery.getPattern();
if (JsQueryParticipant.DEBUG) {
// $NON-NLS-1$
System.out.println("JSP Query Participant searching on PATTERN: " + pattern);
}
SearchRequestor jspRequestor = new JsSearchRequestor(requestor);
JsSearchSupport.getInstance().search(pattern, new JsSearchScope(), patternQuery.getSearchFor(), patternQuery.getLimitTo(), SearchPattern.R_PATTERN_MATCH, false, jspRequestor);
}
}
use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope 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();
}
use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope 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();
}
use of org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchScope 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();
}
Aggregations