Beispiel #1
0
  @Override
  protected boolean doAction(ActionEvent e) throws Exception {
    // TODO Auto-generated method stub

    String location = ActionConstants.CMTS_HELP_MENU_CONTENT_URL;

    try {
      URL ur = new URL(location);
      URLConnection ct = ur.openConnection();
      ct.getInputStream();
    } catch (Exception ee) {
      location = null;
    }

    if (mainFrame.getMainApplet() != null) {
      try {
        if (location == null) {
          location = mainFrame.getMainApplet().getCodeBase() + "/help/CMTS_User_Guide_Document.pdf";
        }
        mainFrame.getMainApplet().getAppletContext().showDocument(new URL(location), "_blank");
      } catch (Exception me) {
        // System.out.println("CCCCX : " + me.getMessage());
        JOptionPane.showMessageDialog(
            mainFrame.getAssociatedUIComponent(),
            "Sorry, Help content is not found.",
            "Not found Help Content",
            JOptionPane.ERROR_MESSAGE);
        return false;
      }
    } else {
      BrowserLauncher browserLauncher = null;
      boolean c2 = true;
      try {
        browserLauncher = new BrowserLauncher();
      } catch (BrowserLaunchingInitializingException e1) {
        c2 = false;
      } catch (UnsupportedOperatingSystemException e2) {
        c2 = false;
      }

      while (c2) {
        c2 = false;

        if (location != null) {
          browserLauncher.openURLinBrowser(location);
          c2 = true;
          break;
        }
        String str = FileUtil.searchFile("CMTS_User_Guide_Document.pdf");
        if ((str == null) || (str.trim().equals(""))) break;
        File f = new File(str.trim());
        if ((!f.exists()) || (!f.isFile())) break;
        URL url = f.toURI().toURL();
        browserLauncher.openURLinBrowser(url.toString());
        c2 = true;
        break;
      }

      if (!c2) {
        JOptionPane.showMessageDialog(
            mainFrame.getAssociatedUIComponent(),
            "Sorry, Help Content is not found.",
            "Not found Help Content",
            JOptionPane.ERROR_MESSAGE);
        return false;
      }
    }
    return true;
  }
Beispiel #2
0
 @Override
 protected Component getAssociatedUIComponent() {
   // TODO Auto-generated method stub
   return mainFrame.getAssociatedUIComponent();
 }