Search in sources :

Example 6 with ISearchResultViewPart

use of org.eclipse.search.ui.ISearchResultViewPart in project eclipse.platform.text by eclipse.

the class SearchResultPageTest method testBasicDisplay.

@Test
@Ignore
public void testBasicDisplay() throws Exception {
    NewSearchUI.runQueryInForeground(null, fQuery1);
    ISearchResultViewPart view = NewSearchUI.getSearchResultView();
    FileSearchPage page = (FileSearchPage) view.getActivePage();
    page.setLayout(AbstractTextSearchViewPage.FLAG_LAYOUT_TREE);
    checkViewerDisplay(page);
    page.setLayout(AbstractTextSearchViewPage.FLAG_LAYOUT_FLAT);
    checkViewerDisplay(page);
}
Also used : ISearchResultViewPart(org.eclipse.search.ui.ISearchResultViewPart) FileSearchPage(org.eclipse.search.internal.ui.text.FileSearchPage) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 7 with ISearchResultViewPart

use of org.eclipse.search.ui.ISearchResultViewPart in project mdw-designer by CenturyLinkCloud.

the class SearchPage method search.

public boolean search(List<WorkflowProject> scopedProjects) {
    try {
        SearchQuery searchQuery = createSearchQuery();
        ProgressMonitorDialog context = new MdwProgressMonitorDialog(getShell());
        NewSearchUI.runQueryInForeground(context, searchQuery);
        // this shouldn't be necessary according to the Eclipse API docs
        NewSearchUI.activateSearchResultView();
        ISearchResultViewPart part = NewSearchUI.getSearchResultView();
        part.updateLabel();
        SearchResultsPage page = (SearchResultsPage) part.getActivePage();
        page.setSearchQuery(searchQuery);
        page.setInput(searchQuery.getSearchResult(), null);
        return true;
    } catch (OperationCanceledException ex) {
        setMessage("Search cancelled", IMessageProvider.INFORMATION);
        return false;
    } catch (Exception ex) {
        PluginMessages.uiError(ex, getEntityTitle() + " Search");
        return false;
    }
}
Also used : ISearchResultViewPart(org.eclipse.search.ui.ISearchResultViewPart) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException)

Example 8 with ISearchResultViewPart

use of org.eclipse.search.ui.ISearchResultViewPart in project mdw-designer by CenturyLinkCloud.

the class ToolboxWrapper method searchReferences.

private void searchReferences(ActivityImpl activityImpl) {
    List<WorkflowProject> projects = new ArrayList<>();
    projects.add(getProject());
    Shell shell = MdwPlugin.getActiveWorkbenchWindow().getShell();
    ProcessSearchQuery searchQuery = new ProcessSearchQuery(projects, SearchQuery.SearchType.CONTAINING_ENTITY, "*", true, shell);
    searchQuery.setContainedEntityId(activityImpl.getId());
    searchQuery.setContainedEntityName(activityImpl.getImplClassName());
    try {
        ProgressMonitorDialog context = new MdwProgressMonitorDialog(shell);
        NewSearchUI.runQueryInForeground(context, searchQuery);
        // this shouldn't be necessary according to the Eclipse API docs
        NewSearchUI.activateSearchResultView();
        ISearchResultViewPart part = NewSearchUI.getSearchResultView();
        part.updateLabel();
        SearchResultsPage page = (SearchResultsPage) part.getActivePage();
        page.setSearchQuery(searchQuery);
        page.setInput(searchQuery.getSearchResult(), null);
    } catch (OperationCanceledException ex) {
        MessageDialog.openInformation(shell, "Search Cancelled", "Search for usages cancelled.");
    } catch (Exception ex) {
        PluginMessages.uiError(shell, ex, "Search for Usages", getProject());
    }
}
Also used : SearchResultsPage(com.centurylink.mdw.plugin.search.SearchResultsPage) Shell(org.eclipse.swt.widgets.Shell) ISearchResultViewPart(org.eclipse.search.ui.ISearchResultViewPart) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) MdwProgressMonitorDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) ArrayList(java.util.ArrayList) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) ProcessSearchQuery(com.centurylink.mdw.plugin.search.ProcessSearchQuery) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IOException(java.io.IOException)

Aggregations

ISearchResultViewPart (org.eclipse.search.ui.ISearchResultViewPart)8 MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)3 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)3 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)3 FileSearchPage (org.eclipse.search.internal.ui.text.FileSearchPage)3 Test (org.junit.Test)3 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2 ProcessSearchQuery (com.centurylink.mdw.plugin.search.ProcessSearchQuery)2 SearchResultsPage (com.centurylink.mdw.plugin.search.SearchResultsPage)2 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ArrayList (java.util.ArrayList)2 CoreException (org.eclipse.core.runtime.CoreException)2 Shell (org.eclipse.swt.widgets.Shell)2 PartInitException (org.eclipse.ui.PartInitException)2 Ignore (org.junit.Ignore)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 ConnectException (java.net.ConnectException)1 IStatus (org.eclipse.core.runtime.IStatus)1 AbstractTreeViewer (org.eclipse.jface.viewers.AbstractTreeViewer)1