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 MozillaBrowser extends ExtWebBrowser { 31 32 35 private static final long serialVersionUID = -3982770681461437966L; 36 37 38 public MozillaBrowser() { 39 ddeServer = ExtWebBrowser.MOZILLA; 40 } 42 43 47 public static Boolean isHidden () { 48 String detectedPath = null; 49 if (Utilities.isWindows()) { 50 try { 51 detectedPath = NbDdeBrowserImpl.getBrowserPath("MOZILLA"); } catch (NbBrowserException e) { 53 ExtWebBrowser.getEM().log("Cannot detect Mozilla : " + 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(MozillaBrowser.class, "CTL_MozillaBrowserName"); 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 (MozillaBrowser.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.org\\Mozilla\\mozilla.exe"; } catch (UnsatisfiedLinkError e) { 112 prg = "iexplore"; } 114 115 retValue = new NbProcessDescriptor (prg, params); 116 return retValue; 117 118 } else { 120 121 prg = "mozilla"; if (Utilities.getOperatingSystem() == Utilities.OS_LINUX) { 123 java.io.File f = new java.io.File ("/usr/bin/mozilla"); if (f.exists()) { 125 prg = f.getAbsolutePath(); 126 } 127 f = new java.io.File ("/usr/local/mozilla/mozilla"); if (f.exists()) { 129 prg = f.getAbsolutePath(); 130 } 131 } else if (Utilities.getOperatingSystem() == Utilities.OS_SOLARIS) { 132 java.io.File f = new java.io.File ("/usr/sfw/lib/mozilla/mozilla"); if (f.exists()) { 134 prg = f.getAbsolutePath(); 135 } else { 136 f = new java.io.File ("/opt/csw/bin/mozilla"); if (f.exists()) { 138 prg = f.getAbsolutePath(); 139 } 140 } 141 } 142 retValue = new NbProcessDescriptor( 143 prg, 144 "-remote \"openURL({" + ExtWebBrowser.UnixBrowserFormat.TAG_URL + "})\"", NbBundle.getMessage(MozillaBrowser.class, "MSG_BrowserExecutorHint") 146 ); 147 } 148 return retValue; 149 } 150 151 } 152 | Popular Tags |