~ubuntu-branches/ubuntu/wily/geotranz/wily

« back to all changes in this revision

Viewing changes to .pc/003-name-browser-settings.patch/GEOTRANS3/java_gui/geotrans3/utility/StartBrowser.java

  • Committer: Bazaar Package Importer
  • Author(s): Roberto Lumbreras
  • Date: 2011-03-06 21:06:09 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110306210609-tsvzx88vdmpgc7u4
Tags: 3.1-1
* New upstream version.
* Added debian/make-orig-tar-bz2 to repackage the upstream .tgz easily.
* Dropped 005-openjdk-forms.patch, it didn't work well in all systems.
* Renamed libgeotranz3 to libgeotranz3.1 because of ABI changes.
* Added symbols64 file for alpha, s390 and 64bit architectures.
  (Closes: #609504)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// CLASSIFICATION: UNCLASSIFIED
2
 
 
3
 
/*
4
 
 * StartBrowser.java
5
 
 *
6
 
 * Created on June 14, 2001, 9:02 AM
7
 
 */
8
 
 
9
 
package geotrans3.utility;
10
 
 
11
 
 
12
 
import geotrans3.misc.StringHandler;
13
 
 
14
 
 
15
 
/**
16
 
 *
17
 
 * @author  amyc
18
 
 * @version 
19
 
 */
20
 
public class StartBrowser extends Object {
21
 
 
22
 
    /** Creates new StartBrowser */
23
 
    public StartBrowser() {
24
 
    }
25
 
 
26
 
     // The url must start with either "http://" or 
27
 
     //"file://". 
28
 
      
29
 
    public static void displayURL(java.awt.Component parent, String url) 
30
 
    { 
31
 
        boolean windows = isWindowsPlatform(); 
32
 
        String browserCommand = null; 
33
 
        StringHandler stringHandler = new StringHandler();
34
 
        try 
35
 
        { 
36
 
            if (windows) 
37
 
            { 
38
 
                // browserCommand = 'rundll32 url.dll,FileProtocolHandler http://...' 
39
 
                browserCommand = WIN_PATH + " " + WIN_FLAG + " " + url; 
40
 
                Process process = Runtime.getRuntime().exec(browserCommand); 
41
 
            } 
42
 
            else 
43
 
            { 
44
 
                // browserCommand = 'netscape http://www.javaworld.com' 
45
 
                browserCommand = UNIX_PATH + " " + url; 
46
 
                Process process = Runtime.getRuntime().exec(browserCommand); 
47
 
            } 
48
 
        } 
49
 
        catch(java.io.IOException x) 
50
 
        { 
51
 
            // couldn't start browser 
52
 
            stringHandler.displayErrorMsg(parent, "Could not invoke browser, command=" + browserCommand);
53
 
        } 
54
 
    } 
55
 
 
56
 
    //Determine if operating system is windows
57
 
    public static boolean isWindowsPlatform() 
58
 
    { 
59
 
        String os = System.getProperty("os.name"); 
60
 
 
61
 
        if ( os != null && os.startsWith(WIN_ID)) 
62
 
            return true; 
63
 
        else 
64
 
            return false; 
65
 
    } 
66
 
 
67
 
    // Used to identify the windows platform. 
68
 
    private static final String WIN_ID = "Windows"; 
69
 
 
70
 
    // Default browser under windows. 
71
 
    private static final String WIN_PATH = "rundll32"; 
72
 
 
73
 
    // Flag to display a url. 
74
 
    private static final String WIN_FLAG = "url.dll,FileProtocolHandler"; 
75
 
 
76
 
    // Default browser under unix. 
77
 
    private static final String UNIX_PATH = "netscape"; 
78
 
   
79
 
}
80
 
 
81
 
// CLASSIFICATION: UNCLASSIFIED