Search in sources :

Example 1 with XSDSearchQuery

use of org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery in project webtools.sourceediting by eclipse.

the class FindReferencesAction method run.

public void run() {
    String pattern = "";
    XSDNamedComponent component = getXSDNamedComponent();
    IFile file = getCurrentFile();
    if (file != null && component != null) {
        QualifiedName metaName = determineMetaName(component);
        QualifiedName elementQName = new QualifiedName(component.getTargetNamespace(), component.getName());
        SearchScope scope = new WorkspaceSearchScope();
        String scopeDescription = "Workspace";
        XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription);
        NewSearchUI.activateSearchResultView();
        NewSearchUI.runQueryInBackground(searchQuery);
    }
}
Also used : XSDNamedComponent(org.eclipse.xsd.XSDNamedComponent) IFile(org.eclipse.core.resources.IFile) QualifiedName(org.eclipse.wst.common.core.search.pattern.QualifiedName) SearchScope(org.eclipse.wst.common.core.search.scope.SearchScope) WorkspaceSearchScope(org.eclipse.wst.common.core.search.scope.WorkspaceSearchScope) WorkspaceSearchScope(org.eclipse.wst.common.core.search.scope.WorkspaceSearchScope) XSDSearchQuery(org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery)

Example 2 with XSDSearchQuery

use of org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery in project webtools.sourceediting by eclipse.

the class FindReferencesInProjectAction method run.

public void run() {
    String pattern = "";
    XSDNamedComponent component = getXSDNamedComponent();
    IFile file = getCurrentFile();
    if (file != null && component != null) {
        QualifiedName metaName = determineMetaName(component);
        QualifiedName elementQName = new QualifiedName(component.getTargetNamespace(), component.getName());
        IPath fullPath = file.getFullPath();
        ProjectSearchScope scope = new ProjectSearchScope(fullPath);
        String scopeDescription = "Project";
        XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription);
        NewSearchUI.activateSearchResultView();
        NewSearchUI.runQueryInBackground(searchQuery);
    }
}
Also used : XSDNamedComponent(org.eclipse.xsd.XSDNamedComponent) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) QualifiedName(org.eclipse.wst.common.core.search.pattern.QualifiedName) ProjectSearchScope(org.eclipse.wst.common.core.search.scope.ProjectSearchScope) XSDSearchQuery(org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery)

Example 3 with XSDSearchQuery

use of org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery in project webtools.sourceediting by eclipse.

the class FindReferencesInWorkingSetAction method run.

public void run() {
    IWorkingSet[] workingSets = queryWorkingSets();
    if (workingSets == null || workingSets.length == 0)
        // The user chooses nothing, no point to continue.
        return;
    String pattern = "";
    XSDNamedComponent component = getXSDNamedComponent();
    IFile file = getCurrentFile();
    if (file != null && component != null) {
        QualifiedName metaName = determineMetaName(component);
        QualifiedName elementQName = new QualifiedName(component.getTargetNamespace(), component.getName());
        // Create a scope from the selected working sets
        WorkingSetSearchScope scope = new WorkingSetSearchScope();
        for (int i = 0; i < workingSets.length; i++) {
            IAdaptable[] elements = workingSets[i].getElements();
            scope.addAWorkingSetToScope(elements);
        }
        String scopeDescription = "Working Set";
        XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription);
        NewSearchUI.activateSearchResultView();
        NewSearchUI.runQueryInBackground(searchQuery);
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) XSDNamedComponent(org.eclipse.xsd.XSDNamedComponent) IFile(org.eclipse.core.resources.IFile) WorkingSetSearchScope(org.eclipse.wst.common.core.search.scope.WorkingSetSearchScope) QualifiedName(org.eclipse.wst.common.core.search.pattern.QualifiedName) IWorkingSet(org.eclipse.ui.IWorkingSet) XSDSearchQuery(org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery)

Aggregations

IFile (org.eclipse.core.resources.IFile)3 QualifiedName (org.eclipse.wst.common.core.search.pattern.QualifiedName)3 XSDSearchQuery (org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery)3 XSDNamedComponent (org.eclipse.xsd.XSDNamedComponent)3 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 IPath (org.eclipse.core.runtime.IPath)1 IWorkingSet (org.eclipse.ui.IWorkingSet)1 ProjectSearchScope (org.eclipse.wst.common.core.search.scope.ProjectSearchScope)1 SearchScope (org.eclipse.wst.common.core.search.scope.SearchScope)1 WorkingSetSearchScope (org.eclipse.wst.common.core.search.scope.WorkingSetSearchScope)1 WorkspaceSearchScope (org.eclipse.wst.common.core.search.scope.WorkspaceSearchScope)1