KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > browser > macosx > DefaultBrowser


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.browser.macosx;
12
13 import java.io.*;
14 import java.net.URL JavaDoc;
15
16 import org.eclipse.ui.browser.AbstractWebBrowser;
17 import org.eclipse.ui.internal.browser.WebBrowserUIPlugin;
18
19 public class DefaultBrowser extends AbstractWebBrowser {
20
21     public DefaultBrowser(String JavaDoc id) {
22         super(id);
23     }
24
25     /**
26      * @see org.eclipse.help.browser.IBrowser#displayURL(String)
27      */

28     public void openURL(URL JavaDoc url2) {
29         String JavaDoc url = url2.toExternalForm();
30         /*
31          * Code from Marc-Antoine Parent
32          */

33         try {
34             Runtime.getRuntime().exec(new String JavaDoc[] { "/usr/bin/osascript", //$NON-NLS-1$
35
"-e", //$NON-NLS-1$
36
"open location \"" + url + "\"" }); //$NON-NLS-1$ //$NON-NLS-2$
37
} catch (IOException ioe) {
38             WebBrowserUIPlugin.logError("Launching \"osascript\" has failed.", ioe); //$NON-NLS-1$
39
}
40     }
41 }
42
Popular Tags