1 11 package org.eclipse.help.ui.browser; 12 13 import java.util.Hashtable ; 14 15 import org.eclipse.core.runtime.*; 16 import org.eclipse.help.browser.*; 17 import org.eclipse.help.internal.browser.*; 18 import org.eclipse.help.ui.internal.*; 19 import org.eclipse.help.ui.internal.util.*; 20 import org.eclipse.jface.action.*; 21 import org.eclipse.jface.viewers.*; 22 import org.eclipse.ui.*; 23 24 46 public class LaunchURL implements IWorkbenchWindowActionDelegate, 47 IExecutableExtension { 48 private String url; 49 50 53 public void dispose() { 54 } 55 56 59 public void init(IWorkbenchWindow window) { 60 } 61 62 66 public void setInitializationData(IConfigurationElement config, 67 String propertyName, Object data) throws CoreException { 68 if (data != null && data instanceof Hashtable ) { 69 url = (String ) ((Hashtable ) data).get("url"); } 71 if (url == null || url.length() == 0) 72 url = config.getAttribute("url"); } 74 75 78 public void run(IAction action) { 79 if (url == null || "".equals(url)) { return; 81 } 82 IBrowser browser = BrowserManager.getInstance().createBrowser(true); 83 try { 84 browser.displayURL(url); 85 } catch (Exception e) { 86 HelpUIPlugin.logError("Exception occurred when opening URL: " + url + ".", e); ErrorUtil.displayErrorDialog(Messages.LaunchURL_exception); 89 } 90 } 91 92 95 public void selectionChanged(IAction action, ISelection selection) { 96 } 97 98 } 99 | Popular Tags |