1 11 12 package org.eclipse.search2.internal.ui.text2; 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.core.runtime.OperationCanceledException; 16 17 import org.eclipse.jface.window.Window; 18 19 import org.eclipse.ui.IWorkbenchPage; 20 import org.eclipse.ui.IWorkingSet; 21 import org.eclipse.ui.IWorkingSetManager; 22 import org.eclipse.ui.PlatformUI; 23 import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog; 24 25 import org.eclipse.search.ui.ISearchQuery; 26 import org.eclipse.search.ui.text.TextSearchQueryProvider; 27 28 import org.eclipse.search2.internal.ui.SearchMessages; 29 30 public class FindInWorkingSetActionDelegate extends FindInRecentScopeActionDelegate { 31 32 public FindInWorkingSetActionDelegate() { 33 super(SearchMessages.FindInWorkingSetActionDelegate_text); 34 setActionDefinitionId("org.eclipse.search.ui.performTextSearchWorkingSet"); } 36 37 protected ISearchQuery createQuery(TextSearchQueryProvider provider, String searchForString) throws CoreException { 38 IWorkbenchPage page= getWorkbenchPage(); 39 if (page != null) { 40 IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager(); 41 IWorkingSetSelectionDialog dialog= manager.createWorkingSetSelectionDialog(page.getWorkbenchWindow().getShell(), true); 42 if (dialog.open() == Window.OK) { 43 IWorkingSet[] workingSets= dialog.getSelection(); 44 if (workingSets != null) { 45 return provider.createQuery(searchForString, workingSets); 46 } 47 } 48 } 49 throw new OperationCanceledException(); 50 } 51 } 52 | Popular Tags |