Search in sources :

Example 1 with ProcessSearchQuery

use of com.centurylink.mdw.plugin.search.ProcessSearchQuery in project mdw-designer by CenturyLinkCloud.

the class WorkflowElementActionHandler method findCallers.

public void findCallers(WorkflowElement element) {
    WorkflowProcess processVersion = (WorkflowProcess) element;
    List<WorkflowProject> projects = new ArrayList<WorkflowProject>();
    projects.add(processVersion.getProject());
    Shell shell = MdwPlugin.getActiveWorkbenchWindow().getShell();
    ProcessSearchQuery searchQuery = new ProcessSearchQuery(projects, SearchQuery.SearchType.INVOKING_ENTITY, "*", true, shell);
    searchQuery.setInvokedEntityId(processVersion.getId());
    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 callers cancelled.");
    } catch (Exception ex) {
        PluginMessages.uiError(shell, ex, "Search for Callers", processVersion.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) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) ProcessSearchQuery(com.centurylink.mdw.plugin.search.ProcessSearchQuery) CoreException(org.eclipse.core.runtime.CoreException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ConnectException(java.net.ConnectException) IOException(java.io.IOException)

Example 2 with ProcessSearchQuery

use of com.centurylink.mdw.plugin.search.ProcessSearchQuery 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

MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)2 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 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 ISearchResultViewPart (org.eclipse.search.ui.ISearchResultViewPart)2 Shell (org.eclipse.swt.widgets.Shell)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 ConnectException (java.net.ConnectException)1 CoreException (org.eclipse.core.runtime.CoreException)1 PartInitException (org.eclipse.ui.PartInitException)1