1 11 package org.eclipse.jdt.internal.ui.search; 12 13 import org.eclipse.jdt.internal.ui.JavaPlugin; 14 import org.eclipse.jface.action.IAction; 15 import org.eclipse.jface.viewers.ISelection; 16 import org.eclipse.search.ui.NewSearchUI; 17 import org.eclipse.swt.widgets.Shell; 18 import org.eclipse.ui.IWorkbenchWindow; 19 import org.eclipse.ui.IWorkbenchWindowActionDelegate; 20 21 24 public class OpenJavaSearchPageAction implements IWorkbenchWindowActionDelegate { 25 26 private static final String JAVA_SEARCH_PAGE_ID= "org.eclipse.jdt.ui.JavaSearchPage"; 28 private IWorkbenchWindow fWindow; 29 30 public OpenJavaSearchPageAction() { 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 beep(); 40 JavaPlugin.logErrorMessage("Could not open the search dialog - for some reason the window handle was null"); return; 42 } 43 NewSearchUI.openSearchDialog(fWindow, JAVA_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 protected void beep() { 55 Shell shell= JavaPlugin.getActiveWorkbenchShell(); 56 if (shell != null && shell.getDisplay() != null) 57 shell.getDisplay().beep(); 58 } 59 } 60 | Popular Tags |