コード例 #1
0
 public LauncherParameters getLauncherParameters() {
   final LauncherParameters.LauncherType launcherType =
       myPlayerRadioButton.isSelected()
           ? LauncherParameters.LauncherType.Player
           : myBrowserRadioButton.isSelected()
               ? LauncherParameters.LauncherType.Browser
               : LauncherParameters.LauncherType.OSDefault;
   final WebBrowser browser = myBrowserSelector.getSelected();
   final WebBrowser notNullBrowser =
       browser == null
           ? WebBrowserManager.getInstance().getFirstBrowser(BrowserFamily.FIREFOX)
           : browser;
   final String playerPath =
       FileUtil.toSystemIndependentName(myPlayerTextWithBrowse.getText().trim());
   final boolean isNewPlayerInstance = myNewPlayerInstanceCheckBox.isSelected();
   return new LauncherParameters(launcherType, notNullBrowser, playerPath, isNewPlayerInstance);
 }
 @Nullable
 public static WebBrowser findUsingBrowser() {
   WebBrowserManager browserManager = WebBrowserManager.getInstance();
   DefaultBrowserPolicy defaultBrowserPolicy = browserManager.getDefaultBrowserPolicy();
   if (defaultBrowserPolicy == DefaultBrowserPolicy.FIRST
       || (defaultBrowserPolicy == DefaultBrowserPolicy.SYSTEM
           && !BrowserLauncherAppless.canUseSystemDefaultBrowserPolicy())) {
     return browserManager.getFirstActiveBrowser();
   } else if (defaultBrowserPolicy == DefaultBrowserPolicy.ALTERNATIVE) {
     String path = GeneralSettings.getInstance().getBrowserPath();
     if (!StringUtil.isEmpty(path)) {
       WebBrowser browser = browserManager.findBrowserById(path);
       if (browser == null) {
         for (WebBrowser item : browserManager.getActiveBrowsers()) {
           if (path.equals(item.getPath())) {
             return item;
           }
         }
       }
     }
   }
   return null;
 }