1 11 package org.eclipse.search.internal.ui; 12 13 import org.eclipse.core.runtime.IStatus; 14 import org.eclipse.core.runtime.Status; 15 import org.eclipse.jface.action.IAction; 16 import org.eclipse.jface.viewers.ISelection; 17 import org.eclipse.search.ui.NewSearchUI; 18 import org.eclipse.ui.IWorkbenchWindow; 19 import org.eclipse.ui.IWorkbenchWindowActionDelegate; 20 21 24 public class OpenFileSearchPageAction implements IWorkbenchWindowActionDelegate { 25 26 private static final String TEXT_SEARCH_PAGE_ID= "org.eclipse.search.internal.ui.text.TextSearchPage"; 28 private IWorkbenchWindow fWindow; 29 30 public OpenFileSearchPageAction() { 31 } 32 33 public void init(IWorkbenchWindow window) { 34 fWindow= window; 35 } 36 37 public void run(IAction action) { 38 if (fWindow == null || fWindow.getActivePage() == null) { 39 SearchPlugin.beep(); 40 logErrorMessage("Could not open the search dialog - for some reason the window handle was null"); return; 42 } 43 NewSearchUI.openSearchDialog(fWindow, TEXT_SEARCH_PAGE_ID); 44 } 45 46 public void selectionChanged(IAction action, ISelection selection) { 47 } 49 50 public void dispose() { 51 fWindow= null; 52 } 53 54 public static void logErrorMessage(String message) { 55 IStatus status= new Status(IStatus.ERROR, NewSearchUI.PLUGIN_ID, IStatus.ERROR, message, null); 56 SearchPlugin.log(status); 57 } 58 } 59 | Popular Tags |