01: /*******************************************************************************
02: * Copyright (c) 2005, 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.ui.internal.handlers;
11:
12: import org.eclipse.core.commands.AbstractHandler;
13: import org.eclipse.core.commands.ExecutionEvent;
14: import org.eclipse.ui.PlatformUI;
15: import org.eclipse.ui.help.IWorkbenchHelpSystem;
16:
17: /**
18: * Displays the help resource specified in the <code>href</code> command
19: * parameter or simply displays the help bookshelf if no parameter was passed.
20: *
21: * @since 3.2
22: */
23: public final class DisplayHelpHandler extends AbstractHandler {
24:
25: /**
26: * The identifier of the command parameter for the URI to oepn.
27: */
28: private static final String PARAM_ID_HREF = "href"; //$NON-NLS-1$
29:
30: public final Object execute(final ExecutionEvent event) {
31: final IWorkbenchHelpSystem helpSystem = PlatformUI
32: .getWorkbench().getHelpSystem();
33: final String href = event.getParameter(PARAM_ID_HREF);
34:
35: if (href == null) {
36: helpSystem.displayHelp();
37: } else {
38: helpSystem.displayHelpResource(href);
39: }
40:
41: return null;
42: }
43: }
|