session.doConnections();
session.startNewSession();
	public SessionPopup(Session ses, MouseEvent me) {      JMenuItem menuItem;      Action action;      JPopupMenu popup = new JPopupMenu();      session = ses;      vt = session.getVT();//      final Gui5250 g = session;      screen = session.getScreen();      JMenuItem mi;      final int pos = screen.getPosFromView(me.getX(),me.getY());      if (!session.rubberband.isAreaSelected() && screen.isInField(pos,false) ) {         action = new AbstractAction(LangTool.getString("popup.copy")) {               public void actionPerformed(ActionEvent e) {                  screen.copyField(pos);                  session.getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_COPY));         action = new AbstractAction(LangTool.getString("popup.paste")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(false);                  session.getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_PASTE));         action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(true);                  session.getFocusForMe();               }           };         popup.add(action);         popup.addSeparator();      }      else {         action = new AbstractAction(LangTool.getString("popup.copy")) {               public void actionPerformed(ActionEvent e) {                  screen.copyMe();                  session.getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_COPY));         action = new AbstractAction(LangTool.getString("popup.paste")) {               public void actionPerformed(ActionEvent e) {                  screen.sendKeys(MNEMONIC_PASTE);                  session.getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_PASTE));         action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) {               public void actionPerformed(ActionEvent e) {                  screen.pasteMe(true);                  session.getFocusForMe();               }           };         popup.add(action);         Rectangle workR = new Rectangle();         if (session.rubberband.isAreaSelected()) {            // get the bounded area of the selection            screen.getBoundingArea(workR);            popup.addSeparator();            menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns")                              + " " + workR.width);            menuItem.setArmed(false);            popup.add(menuItem);            menuItem = new JMenuItem(LangTool.getString("popup.selectedRows")                              + " " + workR.height);            menuItem.setArmed(false);            popup.add(menuItem);            JMenu sumMenu = new JMenu(LangTool.getString("popup.calc"));            popup.add(sumMenu);            action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) {               public void actionPerformed(ActionEvent e) {                  sumArea(true);               }            };            sumMenu.add(action);            action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) {               public void actionPerformed(ActionEvent e) {                  sumArea(false);               }            };            sumMenu.add(action);         }         popup.addSeparator();         action = new AbstractAction(LangTool.getString("popup.printScreen")) {               public void actionPerformed(ActionEvent e) {                  screen.printMe();                  session.getFocusForMe();               }           };         popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN));         popup.addSeparator();         JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard"));         popup.add(kbMenu);         action = new AbstractAction(LangTool.getString("popup.mapKeys")) {               public void actionPerformed(ActionEvent e) {                  mapMeKeys();               }           };         kbMenu.add(action);         kbMenu.addSeparator();         createKeyboardItem(kbMenu,MNEMONIC_ATTN);         createKeyboardItem(kbMenu,MNEMONIC_RESET);         createKeyboardItem(kbMenu,MNEMONIC_SYSREQ);         if (screen.isMessageWait() &&               OptionAccessFactory.getInstance().isValidOption(MNEMONIC_DISP_MESSAGES)) {            action = new AbstractAction(LangTool.getString("popup.displayMessages")) {                  public void actionPerformed(ActionEvent e) {                     vt.systemRequest('4');                  }              };            kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES));         }         kbMenu.addSeparator();         createKeyboardItem(kbMenu,MNEMONIC_DUP_FIELD);         createKeyboardItem(kbMenu,MNEMONIC_HELP);         createKeyboardItem(kbMenu,MNEMONIC_ERASE_EOF);         createKeyboardItem(kbMenu,MNEMONIC_FIELD_PLUS);         createKeyboardItem(kbMenu,MNEMONIC_FIELD_MINUS);         createKeyboardItem(kbMenu,MNEMONIC_NEW_LINE);         if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_PRINT)) {            action = new AbstractAction(LangTool.getString("popup.hostPrint")) {                  public void actionPerformed(ActionEvent e) {                     vt.hostPrint(1);                  }              };            kbMenu.add(createMenuItem(action,MNEMONIC_PRINT));         }         createShortCutItems(kbMenu);         if (screen.isMessageWait() &&            OptionAccessFactory.getInstance().isValidOption(MNEMONIC_DISP_MESSAGES)) {            action = new AbstractAction(LangTool.getString("popup.displayMessages")) {                  public void actionPerformed(ActionEvent e) {                     vt.systemRequest('4');                  }              };            popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES));         }         popup.addSeparator();         action = new AbstractAction(LangTool.getString("popup.hexMap")) {               public void actionPerformed(ActionEvent e) {                  showHexMap();                  session.getFocusForMe();               }           };         popup.add(createMenuItem(action,""));         action = new AbstractAction(LangTool.getString("popup.mapKeys")) {               public void actionPerformed(ActionEvent e) {                  mapMeKeys();                  session.getFocusForMe();               }           };         popup.add(createMenuItem(action,""));         if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_DISP_ATTRIBUTES)) {            action = new AbstractAction(LangTool.getString("popup.settings")) {                  public void actionPerformed(ActionEvent e) {                     session.doAttributes();                    session.getFocusForMe();                  }              };            popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES));         }         popup.addSeparator();         if (session.isMacroRunning()) {            action = new AbstractAction(LangTool.getString("popup.stopScript")) {                  public void actionPerformed(ActionEvent e) {                     session.setStopMacroRequested();                  }              };            popup.add(action);         }         else {            JMenu macMenu = new JMenu(LangTool.getString("popup.macros"));            if (session.isSessionRecording()) {               action = new AbstractAction(LangTool.getString("popup.stop")) {                     public void actionPerformed(ActionEvent e) {                        session.stopRecordingMe();                        session.getFocusForMe();                     }               };            }            else {               action = new AbstractAction(LangTool.getString("popup.record")) {                     public void actionPerformed(ActionEvent e) {                        session.startRecordingMe();                        session.getFocusForMe();                     }               };            }            macMenu.add(action);            if (Macronizer.isMacrosExist()) {               // this will add a sorted list of the macros to the macro menu               addMacros(macMenu);            }            popup.add(macMenu);         }         popup.addSeparator();         JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export"));         if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_FILE_TRANSFER)) {            action = new AbstractAction(LangTool.getString("popup.xtfrFile")) {                  public void actionPerformed(ActionEvent e) {                     doMeTransfer();                     session.getFocusForMe();                  }              };            xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER));         }         if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_SPOOL_FILE)) {            action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) {                  public void actionPerformed(ActionEvent e) {                     doMeSpool();                     session.getFocusForMe();                  }              };            xtfrMenu.add(action);         }         popup.add(xtfrMenu);         JMenu sendMenu = new JMenu(LangTool.getString("popup.send"));         popup.add(sendMenu);         if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_QUICK_MAIL)) {            action = new AbstractAction(LangTool.getString("popup.quickmail")) {                  public void actionPerformed(ActionEvent e) {                    sendQuickEMail();                    session.getFocusForMe();                  }               };   		   sendMenu.add(createMenuItem(action,MNEMONIC_QUICK_MAIL));         }         if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_E_MAIL)) {            action = new AbstractAction(LangTool.getString("popup.email")) {                  public void actionPerformed(ActionEvent e) {                     sendScreenEMail();                     session.getFocusForMe();                  }              };            sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL));         }         action = new AbstractAction(LangTool.getString("popup.file")) {               public void actionPerformed(ActionEvent e) {                  sendMeToFile();               }           };         sendMenu.add(action);         action = new AbstractAction(LangTool.getString("popup.toImage")) {               public void actionPerformed(ActionEvent e) {                  sendMeToImageFile();               }           };         sendMenu.add(action);         popup.addSeparator();      }      if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_OPEN_NEW)) {         action = new AbstractAction(LangTool.getString("popup.connections")) {               public void actionPerformed(ActionEvent e) {                  session.doConnections();               }           };         popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW));      }      popup.addSeparator();      if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_TOGGLE_CONNECTION)) {         if (vt.isConnected()) {            action = new AbstractAction(LangTool.getString("popup.disconnect")) {                  public void actionPerformed(ActionEvent e) {                     changeConnection();                     session.getFocusForMe();                  }              };         }         else {            action = new AbstractAction(LangTool.getString("popup.connect")) {                  public void actionPerformed(ActionEvent e) {                     changeConnection();                    session.getFocusForMe();                  }              };         }         popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION));      }      if (OptionAccessFactory.getInstance().isValidOption(MNEMONIC_CLOSE)) {         action = new AbstractAction(LangTool.getString("popup.close")) {               public void actionPerformed(ActionEvent e) {                  session.closeSession();               }           };         popup.add(createMenuItem(action,MNEMONIC_CLOSE));      }      GUIGraphicsUtils.positionPopup(me.getComponent(),popup,               me.getX(),me.getY());   }