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