/******************************************************************************* * Copyright (c) 2003, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ /* * Created on Jul 11, 2003 */ package org.eclipse.cdt.internal.ui.search; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.search.ui.NewSearchUI; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; /** * @author bgheorgh */ public class OpenCSearchPageAction implements IWorkbenchWindowActionDelegate { private IWorkbenchWindow fWindow; public OpenCSearchPageAction() { super(); // TODO Auto-generated constructor stub } @Override public void init(IWorkbenchWindow window) { fWindow= window; } @Override public void run(IAction action) { if (fWindow == null || fWindow.getActivePage() == null) { beep(); return; } NewSearchUI.openSearchDialog(fWindow, CSearchPage.EXTENSION_ID); } @Override public void selectionChanged(IAction action, ISelection selection) { // do nothing since the action isn't selection dependent. } @Override public void dispose() { fWindow= null; } protected void beep() { Shell shell= CUIPlugin.getActiveWorkbenchShell(); if (shell != null && shell.getDisplay() != null) shell.getDisplay().beep(); } }