Esempio n. 1
0
  @Override
  protected final void doExecute(Application app) {
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(getType())) {
        try {
          switch (getType()) {
            case BROWSE:
              desktop.browse(getURI(app));
              return;
            case MAIL:
              desktop.mail(getURI(app));
              return;
          }
        } catch (Exception e) {
          getLog().error("Invalid URI", e);
        }
      }
    }

    JOptionPane.showMessageDialog(
        app.getAppFrame(),
        String.format("Action %s is not supported", getType()),
        "",
        JOptionPane.WARNING_MESSAGE);
  }
 private void prepareMailAll() {
   // TODO Auto-generated method stub
   String list = "";
   for (DimensionsUser user : users) {
     //					list += user.getUserId()+"@ac.bankit.it";
     list += user.getUserId();
     list += ";";
   }
   GestConfFrame.getInstance().cmdOutAppend("\n" + list);
   Desktop desktop;
   if (Desktop.isDesktopSupported()
       && (desktop = Desktop.getDesktop()).isSupported(Desktop.Action.MAIL)) {
     URI mailto = null;
     try {
       mailto = new URI("mailto:" + list + "?subject=Hello%20World");
     } catch (URISyntaxException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
     try {
       desktop.mail(mailto);
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   } else {
     // TODO fallback to some Runtime.exec(..) voodoo?
     throw new RuntimeException("desktop doesn't support mailto; mail is dead anyway ;)");
   }
   setVisible(false);
 }