Exemple #1
0
  public static Object loadFrame(
      JopSession session, String className, String instance, boolean scrollbar)
      throws ClassNotFoundException {

    if (className.indexOf(".pwg") != -1) {
      GrowFrame frame =
          new GrowFrame(
              className, session.getGdh(), instance, new GrowFrameCb(session), session.getRoot());
      frame.validate();
      frame.setVisible(true);
    } else {
      Object frame;
      if (instance == null) instance = "";

      JopLog.log(
          "JopSpider.loadFrame: Loading frame \"" + className + "\" instance \"" + instance + "\"");
      try {
        Class clazz = Class.forName(className);
        try {
          Class argTypeList[] =
              new Class[] {session.getClass(), instance.getClass(), boolean.class};
          Object argList[] = new Object[] {session, instance, new Boolean(scrollbar)};
          System.out.println("JopSpider.loadFrame getConstructor");
          Constructor constructor = clazz.getConstructor(argTypeList);

          try {
            frame = constructor.newInstance(argList);
          } catch (Exception e) {
            System.out.println(
                "Class instanciation error: "
                    + className
                    + " "
                    + e.getMessage()
                    + " "
                    + constructor);
            return null;
          }
          // frame = clazz.newInstance();
          JopLog.log("JopSpider.loadFrame openFrame");
          openFrame(frame);
          return frame;
        } catch (NoSuchMethodException e) {
          System.out.println("NoSuchMethodException: Unable to get frame constructor " + className);
        } catch (Exception e) {
          System.out.println(
              "Exception: Unable to get frame class " + className + " " + e.getMessage());
        }
      } catch (ClassNotFoundException e) {
        System.out.println("Class not found: " + className);
        throw new ClassNotFoundException();
      }
      return null;
    }
    return null;
  }
  private void testPattern() {

    // test directory pattern
    String pattern = getView().getJTextFieldDirPattern().getText();
    BORecordArgs arg = new BORecordArgs(true);
    arg.setSenderName("RTL");
    arg.setEpgTitle("JackTheMovie");
    arg.setEpgInfo1("1.Teil");

    try {
      String result = SerFormatter.removeInvalidCharacters(SerHelper.createFileName(arg, pattern));
      JOptionPane.showMessageDialog(
          getView(),
          pattern + " ------>\n " + result,
          ControlMain.getProperty("filep_directory"),
          JOptionPane.INFORMATION_MESSAGE);

      pattern = getView().getJTextFieldFilePattern().getText();
      if (pattern.length() > 0) {
        result = SerFormatter.removeInvalidCharacters(SerHelper.createFileName(arg, pattern));
        JOptionPane.showMessageDialog(
            getView(),
            pattern + " ------>\n " + result,
            ControlMain.getProperty("filep_file"),
            JOptionPane.INFORMATION_MESSAGE);
      }
    } catch (Exception e) {
      JOptionPane.showMessageDialog(getView(), e.getMessage(), "", JOptionPane.ERROR_MESSAGE);
    }
  }
  /** Set the parameters object to the settings in the properties object. */
  private void loadParams() throws SerialConnectionException {

    try {
      PropertyResourceBundle props =
          (PropertyResourceBundle) PropertyResourceBundle.getBundle(CONFIG_BUNDLE_NAME);
      System.out.println("BaudRate=" + props.getString("baudRate"));

      ezlink.info("BaudRate= : " + props.getString("baudRate"));

      parameters.setBaudRate(props.getString("baudRate"));
      parameters.setFlowControlIn(props.getString("flowControlIn"));
      parameters.setFlowControlOut(props.getString("flowControlOut"));
      parameters.setParity(props.getString("parity"));
      parameters.setDatabits(props.getString("databits"));
      parameters.setStopbits(props.getString("stopbits"));
      parameters.setPIN(props.getString("pin"));
      parameters.setSMC(props.getString("smc"));

      parameters.setDriver(props.getString("driver"));
      parameters.setURL(props.getString("url"));
      parameters.setUserName(props.getString("username"));
      parameters.setPassword(props.getString("password"));
      parameters.setPortName(props.getString("portName"));

    } catch (Exception exp) {
      ezlink.info("+++Error While setting parameters : +++");
      ezlink.error(new Object(), exp);
      throw new SerialConnectionException("Error While setting parameters=" + exp.getMessage());
    }
  }
Exemple #4
0
  public void init() {
    add(intitule);
    add(texte);
    add(bouton);
    bouton.addActionListener(this);

    try {
      ORB orb = ORB.init(this, null);
      FileReader file = new FileReader(iorfile.value);
      BufferedReader in = new BufferedReader(file);
      String ior = in.readLine();
      file.close();
      org.omg.CORBA.Object obj = orb.string_to_object(ior);
      annuaire = AnnuaireHelper.narrow(obj);

    } catch (org.omg.CORBA.SystemException ex) {
      System.err.println("Error");
      ex.printStackTrace();
    } catch (FileNotFoundException fnfe) {
      System.err.println(fnfe.getMessage());
    } catch (IOException io) {
      System.err.println(io.getMessage());
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
  }
  /**
   * Main method. Checks to see if the command line agrument is requesting usage informaition (-h,
   * -help), if it is, display a usage message and exit, otherwise create a new <code>SerialDemo
   * </code> and set it visible.
   */
  public static void main(String[] args) {
    try {

      serialDemo = new SerialManager();
      ETerminalDataDto objETerminalDataDto =
          serialDemo.getDebitCmd(
              "DC7934737E93BE4F",
              "DC7934737E93BE4F",
              "FFFFFE",
              "0203000A820013881000130007177762B20D5307D50E3F3B24D01C4001FD1EFF75004E202556FBDA1E2088881C00A0FFFFFF2570016643544E3536323120550001000400005555000000000000000000000000000000000000000000000000AB273C2F13AFC9FB03F79059E20C3EC73BF7");

      // Commet this after testing with main method;
      // serialDemo.initConfig();
      // serialDemo.connection.sendMessage(ISOUtil.hex2byte("020079600037000002007024058000C10004164999770007848180000000000000011111011000100309020037003237303031393630313638313638313035323934202020000334343400063031313030320388"));
      /*	byte [] debitCommand = serialDemo.connection.sendMessage(ISOUtil.hex2byte(HeaderUtil.getReqHeader("DC7934737E93BE4F","DC7934737E93BE4F","FFFFFE","0203000A820013881000130007177762B20D5307D50E3F3B24D01C4001FD1EFF75004E202556FBDA1E2088881C00A0FFFFFF2570016643544E3536323120550001000400005555000000000000000000000000000000000000000000000000AB273C2F13AFC9FB03F79059E20C3EC73BF7")));
      System.out.println("Debit Command="+ ISOUtil.hexString(debitCommand));

      String strResSplit[] = ISOUtil.hexString(debitCommand).split("1C");
      for(int i=0;i<strResSplit.length;i++)
      {
      strResSplit[i] = strResSplit[i].substring(8);
      System.out.println(strResSplit[i]);
      }*/

      System.out.println("strDebitCmd " + objETerminalDataDto.getDebitCmd());

    } catch (Exception sExp) {
      System.out.println(sExp.getMessage());
    }
  }
Exemple #6
0
  public void run() {
    try {
      AudioInputStream ais = AudioSystem.getAudioInputStream(soundFile);
      AudioFormat format = ais.getFormat();
      //    System.out.println("Format: " + format);
      DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
      SourceDataLine source = (SourceDataLine) AudioSystem.getLine(info);
      source.open(format);
      source.start();
      int read = 0;
      byte[] audioData = new byte[16384];
      while (read > -1) {
        read = ais.read(audioData, 0, audioData.length);
        if (read >= 0) {
          source.write(audioData, 0, read);
        }
      }
      donePlaying = true;

      source.drain();
      source.close();
    } catch (Exception exc) {
      System.out.println("error: " + exc.getMessage());
      exc.printStackTrace();
    }
  }
  @Override
  public synchronized void run() {
    try {
      for (int i = 0; i < NUM_PIPES; i++) {
        while (Thread.currentThread() == reader[i]) {
          try {
            this.wait(100);
          } catch (InterruptedException ie) {
          }
          if (pin[i].available() != 0) {
            String input = this.readLine(pin[i]);
            appendMsg(htmlize(input));
            if (textArea.getDocument().getLength() > 0) {
              textArea.setCaretPosition(textArea.getDocument().getLength() - 1);
            }
          }
          if (quit) {
            return;
          }
        }
      }

    } catch (Exception e) {
      Debug.error(me + "Console reports an internal error:\n%s", e.getMessage());
    }
  }
  // initialize data hash table servers
  // read server addresses from file and initialize the servers
  private void initServers() {

    try {
      java.net.URL path = ClassLoader.getSystemResource(clientSettingFile);
      FileReader fr = new FileReader(path.getFile());
      BufferedReader br = new BufferedReader(fr);
      try {
        String[] portMap = br.readLine().split(",");
        mServerCount = portMap.length;
        mPortMap = new int[mServerCount];
        for (int i = 0; i < mServerCount; i++) {
          mPortMap[i] = Integer.parseInt(portMap[i]);
        }
      } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
      }
    } catch (FileNotFoundException e2) {
      e2.printStackTrace();
      System.exit(-1);
    }

    mDhtServerArray = new IDistributedHashTable[mServerCount];
    for (int i = 0; i < mServerCount; i++) {
      try {
        mDhtServerArray[i] =
            (IDistributedHashTable)
                Naming.lookup("rmi://localhost:" + mPortMap[i] + "/DistributedHashTable");
        appendOutput("server: " + (i + 1) + " is connected");
      } catch (Exception e) {
        appendOutput("initServers: " + (i + 1) + " " + e.getMessage());
      }
    }
  }
  // Fees update method
  private void updateFeesData(long id) {
    String columns[] = {"Course", "Fees Payed", "Total fees", "Installments"};
    try {
      Database db = new Database();

      panel_7.removeAll();

      feestablemodel = new MyTableModel(db.getFeeData(id), columns);

      feestable = new JTable(feestablemodel);
      feestable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
      feestable.getSelectionModel().addListSelectionListener(this);

      feesscrollpane = new JScrollPane(feestable);
      panel_7.add(feesscrollpane);

      // change fees payed label
      feespayedlabel.setText("Fees Payed");
      feesduelabel.setText("Fees Due");
      totalfeeslabel.setText("Total Fees");

      panel_7.revalidate();
    } catch (Exception e) {
      JOptionPane.showMessageDialog(this, e.getMessage(), null, JOptionPane.ERROR_MESSAGE);
    }
  }
  private void updateEditorView() {
    editorPane.setText("");
    numParameters = 0;
    try {
      java.util.List elements = editableTemplate.getPrintfElements();
      for (Iterator it = elements.iterator(); it.hasNext(); ) {
        PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next();
        if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) {
          appendText(el.getElement(), PLAIN_ATTR);
        } else {
          insertParameter(
              (ConfigParamDescr) paramKeys.get(el.getElement()),
              el.getFormat(),
              editorPane.getDocument().getLength());
        }
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          this,
          "Invalid Format: " + ex.getMessage(),
          "Invalid Printf Format",
          JOptionPane.ERROR_MESSAGE);

      selectedPane = 1;
      printfTabPane.setSelectedIndex(selectedPane);
      updatePane(selectedPane);
    }
  }
Exemple #11
0
 @Override
 public boolean importData(JComponent comp, Transferable t) {
   DataFlavor htmlFlavor = DataFlavor.stringFlavor;
   if (canImport(comp, t.getTransferDataFlavors())) {
     try {
       String transferString = (String) t.getTransferData(htmlFlavor);
       EditorPane targetTextPane = (EditorPane) comp;
       for (Map.Entry<String, String> entry : _copiedImgs.entrySet()) {
         String imgName = entry.getKey();
         String imgPath = entry.getValue();
         File destFile = targetTextPane.copyFileToBundle(imgPath);
         String newName = destFile.getName();
         if (!newName.equals(imgName)) {
           String ptnImgName = "\"" + imgName + "\"";
           newName = "\"" + newName + "\"";
           transferString = transferString.replaceAll(ptnImgName, newName);
           Debug.info(ptnImgName + " exists. Rename it to " + newName);
         }
       }
       targetTextPane.insertString(transferString);
     } catch (Exception e) {
       Debug.error(me + "importData: Problem pasting text\n%s", e.getMessage());
     }
     return true;
   }
   return false;
 }
  void onDelete() {
    TreePath path = m_tree.getSelectionPath();
    if (path != null) {
      DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();

      Object[] options = {"Yes", "No"};
      int choise =
          JOptionPane.showOptionDialog(
              pohaci.gumunda.cgui.GumundaMainFrame.getMainFrame(),
              "Are you sure deleting this " + node + " ?",
              "Confirm",
              JOptionPane.YES_NO_OPTION,
              JOptionPane.QUESTION_MESSAGE,
              null,
              options,
              options[1]);

      if (choise == JOptionPane.YES_OPTION) {
        try {
          deleteNodeParent(node);
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this, ex.getMessage(), "Warning", JOptionPane.WARNING_MESSAGE);
        }
      }
    }
  }
  public void actionPerformed(ActionEvent evt) {
    Object src = evt.getSource();

    try {
      if (src == propDialog) {
        propDialog_actionPerformed(evt);
      } else {
        pdu = new BlockPdu(context);
        if (src == setButton) {
          pdu.setPduType(BlockPdu.SET);
          pdu.addOid(toid.getText(), new AsnOctets(tvalue.getText()));
        } else if (src == getButton) {
          pdu.setPduType(BlockPdu.GET);
          pdu.addOid(toid.getText());
        } else if (src == getNextButton) {
          pdu.setPduType(BlockPdu.GETNEXT);
          pdu.addOid(toid.getText());
        }
        sendRequest(pdu);
      }
    } catch (Exception exc) {
      exc.printStackTrace();
      lmessage.setText("Exception: " + exc.getMessage());
      lmessage.setBackground(Color.red);
    }
  }
 static {
   try {
     SoundMixer mixer = SoundMixerEnumerator.getMixerByVendor("mm's computing");
     System.out.println("Mixer " + mixer.getMixerInfo() + " is available");
   } catch (Exception e) {
     System.out.println("9\b" + e.getMessage());
   }
 }
Exemple #15
0
 private void insertString(int pos, String str) {
   Document doc = getDocument();
   try {
     doc.insertString(pos, str, null);
   } catch (Exception e) {
     Debug.error(me + "insertString: Problem while trying to insert at pos\n%s", e.getMessage());
   }
 }
Exemple #16
0
 protected static Object newInstance(String name) {
   try {
     Class clazz = Class.forName(name);
     return clazz.newInstance();
   } catch (Exception e) {
     Logger().severe("Cannot extatiate class " + name + ": " + e.getMessage());
     return null;
   }
 }
Exemple #17
0
 public static void quit() {
   try {
     if (instance.onQuit()) {
       System.exit(0);
     }
   } catch (Exception e) {
     Logger().severe("Error when quiting: " + e.getMessage());
   }
 }
 // ------------------------------------------------------------------------------------------------------
 public void connectToGaggle() {
   try {
     connector.connectToGaggle();
   } catch (Exception ex0) {
     System.err.println("failed to connect to gaggle: " + ex0.getMessage());
     ex0.printStackTrace();
   }
   gaggleBoss = connector.getBoss();
 } // connectToGaggle
 private void appendMsg(String msg) {
   HTMLDocument doc = (HTMLDocument) textArea.getDocument();
   HTMLEditorKit kit = (HTMLEditorKit) textArea.getEditorKit();
   try {
     kit.insertHTML(doc, doc.getLength(), msg, 0, 0, null);
   } catch (Exception e) {
     Debug.error(me + "Problem appending text to message area!\n%s", e.getMessage());
   }
 }
Exemple #20
0
 public void setTime(String theTime) {
   time = theTime;
   try {
     this.theDate = dateFormat.parse(time);
   } catch (Exception ex) {
     jade.util.Logger.getMyLogger(this.getClass().getName())
         .log(jade.util.Logger.WARNING, ex.getMessage());
   }
 }
Exemple #21
0
  public void actionPerformed(ActionEvent e) {
    String cmd = (e.getActionCommand());

    if (cmd.equals(aboutItem.getText()))
      JOptionPane.showMessageDialog(
          this,
          "Simple Image Program for DB2004\nversion 0.1\nThanks to BvS",
          "About imageLab",
          JOptionPane.INFORMATION_MESSAGE);
    else if (cmd.equals(quitItem.getText())) System.exit(0);
    else if (cmd.equals(openItem.getText())) {
      int returnVal = chooser.showOpenDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        try {
          pic2 = new Picture(chooser.getSelectedFile().getName());
          pic1 = new Picture(pic2.width(), pic2.height());
          lab.setIcon(pic2.getJLabel().getIcon());
          sliderPanel.setVisible(false);
          pack();
          repaint();
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this,
              "Could not open " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(),
              "Open Error",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }

    } else if (cmd.equals(saveItem.getText())) {
      int returnVal = chooser.showSaveDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        try {
          pic2.save(chooser.getSelectedFile().getName());
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this,
              "Could not write " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(),
              "Save Error",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }
    }
  }
Exemple #22
0
  private boolean mapRefs() {
    try {
      EpubUtils.outputMessage(taskOutput, "Editing references");

      for (Map.Entry<String, Document> entry : docList.entrySet()) {
        NodeList refNodes = null;
        Document doc = entry.getValue();

        // Get references
        XPathFactory factory = XPathFactory.newInstance();
        XPath xpath = factory.newXPath();
        try {
          refNodes =
              (NodeList) xpath.evaluate("//*[local-name() = 'a']", doc, XPathConstants.NODESET);
        } catch (Exception e) {
          EpubUtils.outputMessage(taskOutput, "Error in Xml document: " + e.getMessage());
          return false;
        }

        // Check referencer mod samlingen af Id'er
        for (int i = 0; i < refNodes.getLength(); i++) {
          Node ref = refNodes.item(i);
          String href = getAttributeFromNode(ref, "href");
          href = href.replace("#", "");

          String fileName = GetReferenceFileName(href);
          if (fileName != "") {
            // Change reference
            Attr attHref = doc.createAttribute("href");
            attHref.setValue(fileName + "#" + href);
            NamedNodeMap bodyAttrs = ref.getAttributes();
            bodyAttrs.setNamedItem(attHref);
          }
        }
      }
      return true;
    } catch (Exception e) {
      EpubUtils.outputMessage(
          taskOutput, "Could not edit references. An Exception occurred: " + e.getMessage());
    }

    return false;
  }
 // send a count request to a server
 // 1 < key < max key number
 // server: id of server to count the number of entities
 private void sendCountRequest(int server) {
   try {
     if (mDhtServerArray[server - 1] != null) {
       int n = mDhtServerArray[server - 1].count();
       appendOutput("Count machine " + server + " is " + n);
     } else appendOutput("sendCountRequest: server " + server + " is not initialized");
   } catch (Exception e) {
     appendOutput("sendCountRequest: " + server + e.getMessage());
   }
 }
  public static void main(String args[]) {
    boolean debug = true;

    // Parse command-line arguments
    try {
      for (int i = 0; i < args.length; i++) {
        if (args[i].equals("-help")) {
          System.out.println("Usage: java Mesh <filename>");
          System.out.println("   or: java Mesh <shape> [uSize vSize]");
          System.out.println(" where <shape> is one of:");
          System.out.println(" -ellipsoid  -torus");
          System.exit(0);
        } else if (args[i].equals("-nodebug")) {
          debug = false;
        } else if (args[i].charAt(0) == '-') {
          // Primitive
          String primName = args[i].substring(1);

          int uSize = 24, vSize = 24;

          // Check for u/v
          if (args.length >= i + 3) {
            uSize = (new Integer(args[i + 1])).intValue();
            vSize = (new Integer(args[i + 2])).intValue();
            i += 2;
          }

          // Create primitive
          if (primName.equals("ellipsoid")) {
            shape = new Ellipsoid(uSize, vSize);
          } else if (primName.equals("torus")) {
            shape = new Torus(uSize, vSize);
          } else {
            throw new Exception("Unknown primitive: " + primName);
          }
        } else {
          // Filename
          shape = new PolyMesh(args[i]);
        }
      }
      if (shape == null) throw new Exception("No shape specified.");
    } catch (Exception e) {
      e.printStackTrace();
      System.out.println("Error: " + e.getMessage());
      System.exit(1);
    }

    // Create main window
    try {
      Mesh m = new Mesh(debug);
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
  }
  void find() {
    String query = "";
    try {
      query = m_table.getCriterion();
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(this, ex.getMessage());
      return;
    }

    try {
      HRMBusinessLogic logic = new HRMBusinessLogic(m_conn);
      m_panel.reset(
          logic.getEmployeeByCriteria(m_sessionid, IDBConstants.MODUL_MASTER_DATA, query));
      if (m_panel.m_panel_rptEmployeProfile != null)
        m_panel.m_panel_rptEmployeProfile.m_employee = null;
      else if (m_panel.m_panel_rptPaycheq != null) m_panel.m_panel_rptPaycheq.m_employee = null;
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(this, ex.getMessage(), "Warning", JOptionPane.WARNING_MESSAGE);
    }
  }
Exemple #26
0
 void writeNetCDF(String filename) {
   try {
     FileWriter2 writer = new FileWriter2(ds, filename, NetcdfFileWriter.Version.netcdf3);
     NetcdfFile result = writer.write();
     result.close();
     JOptionPane.showMessageDialog(this, "File successfully written");
   } catch (Exception ioe) {
     JOptionPane.showMessageDialog(this, "ERROR: " + ioe.getMessage());
     ioe.printStackTrace();
   }
 }
  /**
   * Handles the event of an option being selected.
   *
   * @param evt, the event associated with the option being selected.
   */
  public void actionPerformed(ActionEvent evt) {

    Object source = evt.getSource();

    if (source.equals(miMenuItemShow)) {
      UITagUsageDialog dlg = new UITagUsageDialog(code, oParent);
      dlg.setVisible(true);
    } else if (source.equals(miMenuItemEdit)) {
      IModel model = ProjectCompendium.APP.getModel();

      String sOldName = code.getName();
      String sNewName =
          JOptionPane.showInputDialog(
              LanguageProperties.getString(
                  LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.edittagname"),
              sOldName); //$NON-NLS-1$
      sNewName = sNewName.trim();
      if (!sNewName.equals("")) { // $NON-NLS-1$
        try {
          String sCodeID = code.getId();

          // CHECK NAME DOES NOT ALREADY EXIST
          if (model.codeNameExists(sCodeID, sNewName)) {
            ProjectCompendium.APP.displayMessage(
                LanguageProperties.getString(
                        LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.tagexists")
                    + "\n\n"
                    + sNewName
                    + LanguageProperties.getString(
                        LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.pleasetryagain")
                    + "\n\n",
                LanguageProperties.getString(
                    LanguageProperties.TAGS_BUNDLE,
                    "UITagTreeLeafPopupMenu.tagmaintenance")); //$NON-NLS-1$ //$NON-NLS-2$
                                                               // //$NON-NLS-3$
          } else {
            code.initialize(model.getSession(), model);
            code.setName(sNewName); // Updates Database and model as model holds same object.
            oParent.updateTreeData();
          }

        } catch (Exception ex) {
          ProjectCompendium.APP.displayError(
              "UITagTreeLeafPopupMenu.editTagName\n\n" + ex.getMessage()); // $NON-NLS-1$
        }
      }
    } else if (source.equals(miMenuItemDelete)) {
      oParent.onDeleteCode(code);
    } else if (source.equals(miMenuItemRemove)) {
      oParent.onRemoveCodeFromGroup(code, sGroupID);
    } else if (source.equals(miMenuItemRemoveTag)) {
      oParent.onRemoveCodeFromNodes(code);
    }
  }
Exemple #28
0
 // TODO not used
 public void appendString(String str) {
   Document doc = getDocument();
   try {
     int start = doc.getLength();
     doc.insertString(doc.getLength(), str, null);
     int end = doc.getLength();
     // end = parseLine(start, end, patHistoryBtnStr);
   } catch (Exception e) {
     Debug.error(me + "appendString: Problem while trying to append\n%s", e.getMessage());
   }
 }
Exemple #29
0
 public static void closeActiveWindow() {
   for (int i = 0; i < windows.size(); i++) {
     try {
       AbstractWindow window = (AbstractWindow) windows.get(i);
       if (window != null && window.isActive()) {
         closeWindow(window);
       }
     } catch (Exception e) {
       logger.warning("Cannot close window: " + e.getMessage());
     }
   }
 }
 // send a purge request to a server
 // 1 < key < max key number
 // server: id of server to purge data
 private void sendPurgeRequest() {
   for (int i = 0; i < mServerCount; i++) {
     if (mDhtServerArray[i] != null) {
       try {
         mDhtServerArray[i].purge();
         appendOutput("purge: machine " + (i + 1));
       } catch (Exception e1) {
         appendOutput("purge server " + (i + 1) + " " + e1.getMessage());
       }
     } else appendOutput("purge server " + (i + 1) + " is not initialized");
   }
 }