KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > ui > internal > browser > SystemBrowserAdapter


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.ui.internal.browser;
12
13 import org.eclipse.help.browser.*;
14 import org.eclipse.help.ui.internal.*;
15 import org.eclipse.help.ui.internal.util.*;
16 import org.eclipse.osgi.util.NLS;
17 import org.eclipse.swt.program.*;
18
19 /**
20  * Implmentation of IBrowser interface, using org.eclipse.swt.Program
21  */

22 public class SystemBrowserAdapter implements IBrowser {
23     String JavaDoc[] cmdarray;
24
25     /**
26      * Adapter constructor.
27      */

28     public SystemBrowserAdapter() {
29     }
30
31     /*
32      * @see IBrowser#close()
33      */

34     public void close() {
35     }
36
37     /*
38      * @see IBrowser#displayURL(String)
39      */

40     public void displayURL(String JavaDoc url) {
41         // if (Constants.WS_WIN32.equalsIgnoreCase(Platform.getOS())) {
42
if (!Program.launch(url)) {
43             HelpUIPlugin
44                     .logError(
45                             "Browser adapter for System Browser failed. The system has no program registered for file " //$NON-NLS-1$
46
+ url
47                                     + ". Change the file association or choose a different help web browser in the preferences.", //$NON-NLS-1$
48
null);
49             ErrorUtil.displayErrorDialog(NLS.bind(Messages.SystemBrowser_noProgramForURL, url));
50         }
51         // } else {
52
// Program b = Program.findProgram("html");
53
// if (b == null || !b.execute(url)) {
54
// ErrorUtil.displayErrorDialog(
55
// HelpUIResources.getString(
56
// "SystemBrowser.noProgramForHTML",
57
// url));
58
// }
59
// }
60
}
61
62     /*
63      * @see IBrowser#isCloseSupported()
64      */

65     public boolean isCloseSupported() {
66         return false;
67     }
68
69     /*
70      * @see IBrowser#isSetLocationSupported()
71      */

72     public boolean isSetLocationSupported() {
73         return false;
74     }
75
76     /*
77      * @see IBrowser#isSetSizeSupported()
78      */

79     public boolean isSetSizeSupported() {
80         return false;
81     }
82
83     /*
84      * @see IBrowser#setLocation(int, int)
85      */

86     public void setLocation(int x, int y) {
87     }
88
89     /*
90      * @see IBrowser#setSize(int, int)
91      */

92     public void setSize(int width, int height) {
93     }
94 }
95
Popular Tags