EMMA Coverage Report (generated Mon Sep 29 15:05:28 EDT 2008)
[all classes][org.eclipse.ui.internal.actions]

COVERAGE SUMMARY FOR SOURCE FILE [HelpSearchAction.java]

nameclass, %method, %block, %line, %
HelpSearchAction.java50%  (1/2)33%  (2/6)50%  (40/80)57%  (16/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class HelpSearchAction$10%   (0/1)0%   (0/2)0%   (0/13)0%   (0/4)
HelpSearchAction$1 (HelpSearchAction): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/7)0%   (0/2)
     
class HelpSearchAction100% (1/1)50%  (2/4)60%  (40/67)64%  (16/25)
HelpSearchAction (): void 0%   (0/1)0%   (0/5)0%   (0/2)
run (): void 0%   (0/1)0%   (0/11)0%   (0/4)
HelpSearchAction (IWorkbenchWindow): void 100% (1/1)77%  (36/47)82%  (14/17)
dispose (): void 100% (1/1)100% (4/4)100% (2/2)

1/*******************************************************************************
2 * Copyright (c) 2004, 2005 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *     IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.ui.internal.actions;
12 
13import org.eclipse.jface.action.Action;
14import org.eclipse.swt.custom.BusyIndicator;
15import org.eclipse.ui.IWorkbenchPreferenceConstants;
16import org.eclipse.ui.IWorkbenchWindow;
17import org.eclipse.ui.PlatformUI;
18import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
19import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
20import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
21import org.eclipse.ui.internal.WorkbenchImages;
22import org.eclipse.ui.internal.WorkbenchMessages;
23import org.eclipse.ui.internal.util.PrefUtil;
24 
25/**
26 * Action to open the help search.
27 * 
28 * @since 3.1
29 */
30public class HelpSearchAction extends Action implements IWorkbenchAction {
31    /**
32     * The workbench window; or <code>null</code> if this
33     * action has been <code>dispose</code>d.
34     */
35    private IWorkbenchWindow workbenchWindow;
36 
37    /**
38     * Zero-arg constructor to allow cheat sheets to reuse this action.
39     */
40    public HelpSearchAction() {
41        this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
42    }
43 
44    /**
45     * Constructor for use by ActionFactory.
46     * 
47     * @param window the window
48     */
49    public HelpSearchAction(IWorkbenchWindow window) {
50        if (window == null) {
51            throw new IllegalArgumentException();
52        }
53        this.workbenchWindow = window;
54        setActionDefinitionId("org.eclipse.ui.help.helpSearch"); //$NON-NLS-1$
55 
56        // support for allowing a product to override the text for the action
57        String overrideText = PrefUtil.getAPIPreferenceStore().getString(
58                IWorkbenchPreferenceConstants.HELP_SEARCH_ACTION_TEXT);
59        if ("".equals(overrideText)) { //$NON-NLS-1$
60            setText(WorkbenchMessages.HelpSearchAction_text); 
61            setToolTipText(WorkbenchMessages.HelpSearchAction_toolTip);
62        } else {
63            setText(overrideText);
64            setToolTipText(Action.removeMnemonics(overrideText));
65        }
66        setImageDescriptor(WorkbenchImages
67                .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_HELP_SEARCH));
68        window.getWorkbench().getHelpSystem().setHelp(this,
69                                IWorkbenchHelpContextIds.HELP_SEARCH_ACTION);
70    }
71 
72    /* (non-Javadoc)
73     * Method declared on IAction.
74     */
75    public void run() {
76        if (workbenchWindow == null) {
77            // action has been disposed
78            return;
79        }
80        //This may take a while, so use the busy indicator
81        BusyIndicator.showWhile(null, new Runnable() {
82            public void run() {
83                    workbenchWindow.getWorkbench().getHelpSystem().displaySearch();
84            }
85        });
86    }
87 
88    /* (non-Javadoc)
89     * Method declared on ActionFactory.IWorkbenchAction.
90     */
91    public void dispose() {
92        workbenchWindow = null;
93    }
94 
95}

[all classes][org.eclipse.ui.internal.actions]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov