private boolean login(final MonitorServer server) {
    boolean firstTry = true;
    SecureLoginDialog loginDialog = new SecureLoginDialog(null);
    while (!(MonitorServerManager.getInstance().getLoginSucess())) {
      IPreferencesService service = Platform.getPreferencesService();
      boolean auto_login =
          service.getBoolean(Application.PLUGIN_ID, GeneralPreferencePage.AUTO_LOGIN, false, null);
      MonitorServer details = loginDialog.getConnectionDetails();
      if (!auto_login || details == null || !firstTry) {
        if (loginDialog.open() != Window.OK) return false;
        details = loginDialog.getConnectionDetails();
      }
      firstTry = false;

      //			session.setConnectionDetails(details);
      //			MonitorServerManager.getInstance().registerServer(server);
      MonitorServerManager.getInstance().setCurServer(details);
      try {
        MonitorServerManager.getInstance().registerServer(details);
      } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (NotBoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      connectWithProgress(details);
    }
    return true;
  }
  public Object start(IApplicationContext context) {

    // create and register a backend server
    // TODO: this info should be saved, not hard coded.
    try {
      context.applicationRunning(); // only run one
      //			MonitorServerManager.getInstance().getServers().get("");
      MonitorServer server = new MonitorServer("admin", "", "admin");
      MonitorServerManager.getInstance().registerServer(server);
      if (!login(server)) return IApplication.EXIT_OK;
      //			MonitorServerManager.getInstance().getCurServer().connectAndLogin();
      //			server.connectAndLogin();

    } catch (RemoteException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (NotBoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Display display = PlatformUI.createDisplay();
    try {
      int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());

      if (returnCode == PlatformUI.RETURN_RESTART) {
        return IApplication.EXIT_RESTART;
      }
      return IApplication.EXIT_OK;
    } finally {
      display.dispose();
    }
  }