KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > browser > macosx > DefaultBrowserAdapter


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.help.internal.browser.macosx;
12
13 import java.io.*;
14
15 import org.eclipse.help.browser.*;
16 import org.eclipse.help.internal.base.*;
17
18 public class DefaultBrowserAdapter implements IBrowser {
19
20     private static DefaultBrowserAdapter fgInstance;
21
22     static DefaultBrowserAdapter getInstance() {
23         if (fgInstance == null)
24             fgInstance = new DefaultBrowserAdapter();
25         return fgInstance;
26     }
27
28     /**
29      * @see org.eclipse.help.browser.IBrowser#close()
30      */

31     public void close() {
32     }
33
34     /**
35      * @see org.eclipse.help.browser.IBrowser#displayURL(String)
36      */

37     public void displayURL(String JavaDoc url) {
38         /*
39          * Code from Marc-Antoine Parent
40          */

41         try {
42             Runtime.getRuntime().exec(new String JavaDoc[] { "/usr/bin/osascript", //$NON-NLS-1$
43
"-e", //$NON-NLS-1$
44
"open location \"" + url + "\"" }); //$NON-NLS-1$ //$NON-NLS-2$
45
} catch (IOException ioe) {
46             HelpBasePlugin.logError("Launching \"osascript\" has failed.", ioe); //$NON-NLS-1$
47
}
48     }
49
50     /**
51      * @see org.eclipse.help.browser.IBrowser#isCloseSupported()
52      */

53     public boolean isCloseSupported() {
54         return false;
55     }
56
57     /**
58      * @see org.eclipse.help.browser.IBrowser#isSetLocationSupported()
59      */

60     public boolean isSetLocationSupported() {
61         return false;
62     }
63
64     /**
65      * @see org.eclipse.help.browser.IBrowser#isSetSizeSupported()
66      */

67     public boolean isSetSizeSupported() {
68         return false;
69     }
70
71     /**
72      * @see org.eclipse.help.browser.IBrowser#setLocation(int, int)
73      */

74     public void setLocation(int x, int y) {
75     }
76
77     /**
78      * @see org.eclipse.help.browser.IBrowser#setSize(int, int)
79      */

80     public void setSize(int width, int height) {
81     }
82 }
83
Popular Tags