KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > handlers > DisplayHelpHandler


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 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  *******************************************************************************/

11 package org.eclipse.ui.internal.handlers;
12
13 import org.eclipse.core.commands.AbstractHandler;
14 import org.eclipse.core.commands.ExecutionEvent;
15 import org.eclipse.ui.PlatformUI;
16 import org.eclipse.ui.help.IWorkbenchHelpSystem;
17
18 /**
19  * Displays the help resource specified in the <code>href</code> command
20  * parameter or simply displays the help bookshelf if no parameter was passed.
21  *
22  * @since 3.2
23  */

24 public final class DisplayHelpHandler extends AbstractHandler {
25
26     /**
27      * The identifier of the command parameter for the URI to oepn.
28      */

29     private static final String JavaDoc PARAM_ID_HREF = "href"; //$NON-NLS-1$
30

31     public final Object JavaDoc execute(final ExecutionEvent event) {
32         final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench()
33                 .getHelpSystem();
34         final String JavaDoc href = event.getParameter(PARAM_ID_HREF);
35
36         if (href == null) {
37             helpSystem.displayHelp();
38         } else {
39             helpSystem.displayHelpResource(href);
40         }
41
42         return null;
43     }
44 }
45
Popular Tags