1 /******************************************************************************* 2 * Copyright (c) 2000, 2015 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.ui.internal.browser.macosx; 15 16 import java.io.*; 17 import java.net.URL; 18 19 import org.eclipse.ui.browser.AbstractWebBrowser; 20 import org.eclipse.ui.internal.browser.WebBrowserUIPlugin; 21 22 public class DefaultBrowser extends AbstractWebBrowser { 23 DefaultBrowser(String id)24 public DefaultBrowser(String id) { 25 super(id); 26 } 27 28 /** 29 * @see org.eclipse.help.browser.IBrowser#displayURL(String) 30 */ 31 @Override openURL(URL url2)32 public void openURL(URL url2) { 33 String url = url2.toExternalForm(); 34 /* 35 * Code from Marc-Antoine Parent 36 */ 37 try { 38 Runtime.getRuntime().exec(new String[] { "/usr/bin/osascript", //$NON-NLS-1$ 39 "-e", //$NON-NLS-1$ 40 "open location \"" + url + "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ 41 } catch (IOException ioe) { 42 WebBrowserUIPlugin.logError("Launching \"osascript\" has failed.", ioe); //$NON-NLS-1$ 43 } 44 } 45 } 46