Beispiel #1
0
 /**
  * A change in the text fields.
  *
  * @param e the document event.
  */
 private void documentChanged(DocumentEvent e) {
   if (e.getDocument().equals(fileCountField.getDocument())) {
     // set file count only if its un integer
     try {
       int newFileCount = Integer.valueOf(fileCountField.getText());
       fileCountField.setForeground(Color.black);
       LoggingUtilsActivator.getPacketLoggingService()
           .getConfiguration()
           .setLogfileCount(newFileCount);
     } catch (Throwable t) {
       fileCountField.setForeground(Color.red);
     }
   } else if (e.getDocument().equals(fileSizeField.getDocument())) {
     // set file size only if its un integer
     try {
       int newFileSize = Integer.valueOf(fileSizeField.getText());
       fileSizeField.setForeground(Color.black);
       LoggingUtilsActivator.getPacketLoggingService()
           .getConfiguration()
           .setLimit(newFileSize * 1000);
     } catch (Throwable t) {
       fileSizeField.setForeground(Color.red);
     }
   }
 }
Beispiel #2
0
  /** Loading the values stored into configuration form */
  private void loadValues() {
    PacketLoggingService packetLogging = LoggingUtilsActivator.getPacketLoggingService();
    PacketLoggingConfiguration cfg = packetLogging.getConfiguration();

    enableCheckBox.setSelected(cfg.isGlobalLoggingEnabled());

    sipProtocolCheckBox.setSelected(cfg.isSipLoggingEnabled());
    jabberProtocolCheckBox.setSelected(cfg.isJabberLoggingEnabled());
    rtpProtocolCheckBox.setSelected(cfg.isRTPLoggingEnabled());
    ice4jProtocolCheckBox.setSelected(cfg.isIce4JLoggingEnabled());
    fileCountField.setText(String.valueOf(cfg.getLogfileCount()));
    fileSizeField.setText(String.valueOf(cfg.getLimit() / 1000));

    updateButtonsState();
  }
Beispiel #3
0
  /** Invoked when an action occurs. */
  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    PacketLoggingService packetLogging = LoggingUtilsActivator.getPacketLoggingService();

    if (source.equals(enableCheckBox)) {
      // turn it on/off in activator
      packetLogging.getConfiguration().setGlobalLoggingEnabled(enableCheckBox.isSelected());
      updateButtonsState();
    } else if (source.equals(sipProtocolCheckBox)) {
      packetLogging.getConfiguration().setSipLoggingEnabled(sipProtocolCheckBox.isSelected());
    } else if (source.equals(jabberProtocolCheckBox)) {
      packetLogging.getConfiguration().setJabberLoggingEnabled(jabberProtocolCheckBox.isSelected());
    } else if (source.equals(rtpProtocolCheckBox)) {
      packetLogging.getConfiguration().setRTPLoggingEnabled(rtpProtocolCheckBox.isSelected());
    } else if (source.equals(ice4jProtocolCheckBox)) {
      packetLogging.getConfiguration().setIce4JLoggingEnabled(ice4jProtocolCheckBox.isSelected());
    } else if (source.equals(archiveButton)) {
      // don't block the UI thread
      new Thread(
              new Runnable() {
                public void run() {
                  collectLogs();
                }
              })
          .start();
    } else if (source.equals(uploadLogsButton)) {
      // don't block the UI thread
      new Thread(
              new Runnable() {
                public void run() {
                  uploadLogs();
                }
              })
          .start();
    }
  }