01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.search;
11:
12: import org.eclipse.jface.action.IAction;
13: import org.eclipse.jface.viewers.ISelection;
14: import org.eclipse.pde.internal.ui.PDEPlugin;
15: import org.eclipse.search.ui.NewSearchUI;
16: import org.eclipse.swt.widgets.Shell;
17: import org.eclipse.ui.IWorkbenchWindow;
18: import org.eclipse.ui.IWorkbenchWindowActionDelegate;
19:
20: public class OpenPluginSearchPageAction implements
21: IWorkbenchWindowActionDelegate {
22:
23: private static final String PLUGIN_SEARCH_PAGE_ID = "org.eclipse.pde.internal.ui.search.SearchPage"; //$NON-NLS-1$
24: private IWorkbenchWindow fWindow;
25:
26: public void dispose() {
27: fWindow = null;
28: }
29:
30: public void init(IWorkbenchWindow window) {
31: fWindow = window;
32: }
33:
34: public void run(IAction action) {
35: if (fWindow == null || fWindow.getActivePage() == null) {
36: beep();
37: return;
38: }
39: NewSearchUI.openSearchDialog(fWindow, PLUGIN_SEARCH_PAGE_ID);
40: }
41:
42: public void selectionChanged(IAction action, ISelection selection) {
43: // do nothing since the action isn't selection dependent.
44: }
45:
46: protected void beep() {
47: Shell shell = PDEPlugin.getActiveWorkbenchShell();
48: if (shell != null && shell.getDisplay() != null)
49: shell.getDisplay().beep();
50: }
51:
52: }
|