use of org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport in project webtools.sourceediting by eclipse.
the class JSPSearchQuery method doQuery.
protected IStatus doQuery(IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS;
try {
JSPSearchSupport support = JSPSearchSupport.getInstance();
// index the file
SearchDocument delegate = support.addJspFile(getFile());
String scopePath = delegate.getPath();
JSPSearchScope singleFileScope = new JSPSearchScope(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()), monitor);
} 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.jst.jsp.core.internal.java.search.JSPSearchSupport in project webtools.sourceediting by eclipse.
the class JSPPackageRenameChange method createChangesFor.
/**
* @deprecated
*/
public static Change[] createChangesFor(IPackageFragment pkg, String newName) {
JSPSearchSupport support = JSPSearchSupport.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 JSPSearchScope(), requestor);
return requestor.getChanges();
}
use of org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport in project webtools.sourceediting by eclipse.
the class JSPRenameParticipant method createChangesFor.
/**
* @param element the {@link IJavaElement} to create new changes for
* @param newName the new name of the given {@link IJavaElement}
*
* @return any newly created {@link Change}s. It is important to note
* that while no NEW {@link Change}s maybe returned it is possible that
* new {@link TextEdit}s will still added to existing {@link Change}s.
*/
protected Change[] createChangesFor(IJavaElement element, String newName, IProgressMonitor monitor) {
Change[] changes;
BasicRefactorSearchRequestor requestor = getSearchRequestor(element, newName);
if (requestor != null) {
JSPSearchSupport support = JSPSearchSupport.getInstance();
support.searchRunnable(element, new JSPSearchScope(), requestor, monitor);
changes = requestor.getChanges(this);
} else {
changes = new Change[0];
}
return changes;
}
use of org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport in project webtools.sourceediting by eclipse.
the class JSPTypeRenameChange method createChangesFor.
/**
* @deprecated
*/
public static Change[] createChangesFor(IType type, String newName) {
JSPSearchSupport support = JSPSearchSupport.getInstance();
// should be handled by JSPIndexManager
// https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=3036
// support.indexWorkspaceAndWait();
JSPTypeRenameRequestor requestor = new JSPTypeRenameRequestor(type, newName);
support.searchRunnable(type, new JSPSearchScope(), requestor);
return requestor.getChanges();
}
use of org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport in project webtools.sourceediting by eclipse.
the class BasicRefactorSearchRequestor method getChanges.
/**
* <p>This function is not safe because it does not check for existing {@link Change}s that
* new {@link Change}s created by this method may conflict with. These conflicts can
* cause indeterminate results when applied to documents. Long story short, don't
* use this method any more.</p>
*
* @return all JSP changes for the search matches for the given Type, they may conflict
* with already existing {@link Change}s
*
* @see #getChanges(RefactoringParticipant)
*
* @deprecated
*/
public Change[] getChanges() {
JSPSearchSupport support = JSPSearchSupport.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 JavaSearchDocumentDelegate) {
JavaSearchDocumentDelegate javaDelegate = (JavaSearchDocumentDelegate) delegate;
changes.add(createChange(javaDelegate, javaDelegate.getJspTranslation().getJspEdit(javaEdit)));
}
}
return (Change[]) changes.toArray(new Change[changes.size()]);
}
Aggregations