f150a6e06a2229449c628a982c9ceba1c51193c2
[taxeditor.git] / taxeditor-application / src / main / java / eu / etaxonomy / taxeditor / OpenExternalHelpHandler.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor;
12
13 import java.net.MalformedURLException;
14 import java.net.URL;
15
16 import org.apache.log4j.Logger;
17 import org.eclipse.core.commands.AbstractHandler;
18 import org.eclipse.core.commands.ExecutionEvent;
19 import org.eclipse.core.commands.ExecutionException;
20 import org.eclipse.ui.PartInitException;
21 import org.eclipse.ui.PlatformUI;
22 import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
23
24 /**
25 * @author p.ciardelli
26 * @created 04.09.2009
27 * @version 1.0
28 */
29 public class OpenExternalHelpHandler extends AbstractHandler {
30 private static final Logger logger = Logger.getLogger(OpenExternalHelpHandler.class);
31
32 /* (non-Javadoc)
33 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
34 */
35 public Object execute(ExecutionEvent event) throws ExecutionException {
36 String url = "http://wp5.e-taxonomy.eu/download/taxeditor/stable/EDITTaxonomicEditor-UserManual.pdf";
37
38 try {
39 PlatformUI.getWorkbench().getBrowserSupport().createBrowser
40 (IWorkbenchBrowserSupport.AS_EXTERNAL, "aCustomId", "url", "url").openURL(new URL(url));
41 } catch (PartInitException e) {
42 logger.error(e);
43 throw new RuntimeException(e);
44 } catch (MalformedURLException e) {
45 logger.error(e);
46 throw new RuntimeException(e);
47 }
48
49 return null;
50 }
51 }