1 19 20 package org.netbeans.modules.extbrowser; 21 22 import org.openide.awt.HtmlBrowser; 23 import org.openide.execution.NbProcessDescriptor; 24 import org.openide.util.NbBundle; 25 import org.openide.util.Utilities; 26 27 30 public class FirefoxBrowser extends ExtWebBrowser { 31 32 35 private static final long serialVersionUID = -3982770681461437966L; 36 37 38 public FirefoxBrowser() { 39 ddeServer = ExtWebBrowser.FIREFOX; 40 } 42 43 47 public static Boolean isHidden () { 48 String detectedPath = null; 49 if (Utilities.isWindows()) { 50 try { 51 detectedPath = NbDdeBrowserImpl.getBrowserPath(ExtWebBrowser.FIREFOX); } catch (NbBrowserException e) { 53 ExtWebBrowser.getEM().log("Cannot detect Firefox : " + e); } 55 if ((detectedPath != null) && (detectedPath.trim().length() > 0)) { 56 return Boolean.FALSE; 57 } 58 return Boolean.TRUE; 59 } 60 return (Utilities.isUnix() && !Utilities.isMac()) ? Boolean.FALSE : Boolean.TRUE; 61 } 62 63 66 public String getName () { 67 if (name == null) { 68 this.name = NbBundle.getMessage(FirefoxBrowser.class, "CTL_FirefoxBrowserName"); 69 } 70 return name; 71 } 72 73 78 public HtmlBrowser.Impl createHtmlBrowserImpl() { 79 ExtBrowserImpl impl = null; 80 81 if (Utilities.isWindows()) { 82 impl = new NbDdeBrowserImpl(this); 83 } else if (Utilities.isUnix() && !Utilities.isMac()) { 84 impl = new UnixBrowserImpl(this); 85 } else { 86 throw new UnsupportedOperationException (NbBundle.getMessage(FirefoxBrowser.class, "MSG_CannotUseBrowser")); 87 } 88 89 return impl; 90 } 91 92 97 protected NbProcessDescriptor defaultBrowserExecutable () { 98 99 String prg; 100 String params = ""; NbProcessDescriptor retValue; 102 103 if (Utilities.isWindows()) { 105 params += "{" + ExtWebBrowser.UnixBrowserFormat.TAG_URL + "}"; 106 try { 107 prg = NbDdeBrowserImpl.getBrowserPath(getDDEServer()); 108 return new NbProcessDescriptor (prg, params); 109 } catch (NbBrowserException e) { 110 prg = "C:\\Program Files\\Mozilla Firefox\\firefox.exe"; } catch (UnsatisfiedLinkError e) { 112 prg = "firefox.exe"; } 114 115 retValue = new NbProcessDescriptor (prg, params); 116 return retValue; 117 118 } else { 120 121 prg = "firefox"; if (Utilities.getOperatingSystem() == Utilities.OS_LINUX) { 123 java.io.File f = new java.io.File ("/usr/bin/firefox"); if (f.exists()) { 125 prg = f.getAbsolutePath(); 126 } 127 f = new java.io.File ("/usr/bin/mozilla-firefox"); if (f.exists()) { 129 prg = f.getAbsolutePath(); 130 } 131 f = new java.io.File ("/usr/local/firefox/firefox"); if (f.exists()) { 133 prg = f.getAbsolutePath(); 134 } 135 } else if (Utilities.getOperatingSystem() == Utilities.OS_SOLARIS) { 136 java.io.File f = new java.io.File ("/usr/sfw/lib/firefox/firefox"); if (f.exists()) { 138 prg = f.getAbsolutePath(); 139 } else { 140 f = new java.io.File ("/opt/csw/bin/firefox"); if (f.exists()) { 142 prg = f.getAbsolutePath(); 143 } 144 } 145 } 146 147 retValue = new NbProcessDescriptor( 148 prg, 149 "-remote \"openURL({" + ExtWebBrowser.UnixBrowserFormat.TAG_URL + "})\"", NbBundle.getMessage(FirefoxBrowser.class, "MSG_BrowserExecutorHint") 151 ); 152 } 153 return retValue; 154 } 155 156 } 157 | Popular Tags |