public Composite configSectionCreate(final Composite parent) {
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image imgOpenFolder = imageLoader.getImage("openFolderButton");

    GridData gridData;
    GridLayout layout;

    final Composite cBR = new Composite(parent, SWT.NULL);

    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    cBR.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    cBR.setLayout(layout);

    Label info_label = new Label(cBR, SWT.WRAP);
    Messages.setLanguageText(info_label, "ConfigView.section.br.overview");
    gridData = Utils.getWrappableLabelGridData(1, GridData.HORIZONTAL_ALIGN_FILL);

    info_label.setLayoutData(gridData);

    // wiki link

    final Label linkLabel = new Label(cBR, SWT.NULL);
    linkLabel.setText(MessageText.getString("ConfigView.label.please.visit.here"));
    linkLabel.setData("http://wiki.vuze.com/w/Backup_And_Restore");
    linkLabel.setCursor(linkLabel.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    linkLabel.setForeground(Colors.blue);
    gridData = Utils.getWrappableLabelGridData(1, 0);
    linkLabel.setLayoutData(gridData);
    linkLabel.addMouseListener(
        new MouseAdapter() {
          public void mouseDoubleClick(MouseEvent arg0) {
            Utils.launch((String) ((Label) arg0.widget).getData());
          }

          public void mouseDown(MouseEvent arg0) {
            Utils.launch((String) ((Label) arg0.widget).getData());
          }
        });
    ClipboardCopy.addCopyToClipMenu(linkLabel);

    final BackupManager backup_manager =
        BackupManagerFactory.getManager(AzureusCoreFactory.getSingleton());

    // backup

    Group gBackup = new Group(cBR, SWT.NULL);
    Messages.setLanguageText(gBackup, "br.backup");
    layout = new GridLayout(2, false);
    gBackup.setLayout(layout);
    gBackup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // info

    Label last_backup_label = new Label(gBackup, SWT.NULL);
    Messages.setLanguageText(last_backup_label, "br.backup.last.time");

    final Label last_backup_time = new Label(gBackup, SWT.NULL);

    Label last_backup_error_label = new Label(gBackup, SWT.NULL);
    Messages.setLanguageText(last_backup_error_label, "br.backup.last.error");

    final Label last_backup_error = new Label(gBackup, SWT.NULL);

    final Runnable stats_updater =
        new Runnable() {
          public void run() {
            long backup_time = backup_manager.getLastBackupTime();

            last_backup_time.setText(backup_time == 0 ? "" : String.valueOf(new Date(backup_time)));

            last_backup_error.setText(backup_manager.getLastBackupError());
          };
        };

    stats_updater.run();

    // manual button

    Label backup_manual_label = new Label(gBackup, SWT.NULL);
    Messages.setLanguageText(backup_manual_label, "br.backup.manual.info");

    Button backup_button = new Button(gBackup, SWT.PUSH);
    Messages.setLanguageText(backup_button, "br.backup");

    backup_button.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default");

            DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);

            if (def_dir != null) {
              dialog.setFilterPath(def_dir);
            }

            dialog.setMessage(MessageText.getString("br.backup.folder.info"));
            dialog.setText(MessageText.getString("br.backup.folder.title"));

            String path = dialog.open();

            if (path != null) {

              COConfigurationManager.setParameter("br.backup.folder.default", path);

              runBackup(backup_manager, path, stats_updater);
            }
          }
        });

    final BooleanParameter auto_backup_enable =
        new BooleanParameter(gBackup, "br.backup.auto.enable", "br.backup.auto.enable");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    auto_backup_enable.setLayoutData(gridData);

    Composite gDefaultDir = new Composite(gBackup, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = 2;
    gDefaultDir.setLayout(layout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gDefaultDir.setLayoutData(gridData);

    Label lblDefaultDir = new Label(gDefaultDir, SWT.NONE);
    Messages.setLanguageText(lblDefaultDir, "ConfigView.section.file.defaultdir.ask");
    lblDefaultDir.setLayoutData(new GridData());

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    final StringParameter pathParameter =
        new StringParameter(gDefaultDir, "br.backup.auto.dir", "");
    pathParameter.setLayoutData(gridData);

    if (pathParameter.getValue().length() == 0) {
      String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default");

      pathParameter.setValue(def_dir);
    }

    Button browse = new Button(gDefaultDir, SWT.PUSH);
    browse.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse.getBackground());
    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));

    browse.addListener(
        SWT.Selection,
        new Listener() {
          /* (non-Javadoc)
           * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
           */
          public void handleEvent(Event event) {
            DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
            dialog.setFilterPath(pathParameter.getValue());
            dialog.setMessage(MessageText.getString("br.backup.auto.dir.select"));
            dialog.setText(MessageText.getString("ConfigView.section.file.defaultdir.ask"));
            String path = dialog.open();
            if (path != null) {
              pathParameter.setValue(path);

              COConfigurationManager.setParameter("br.backup.folder.default", path);
            }
          }
        });

    Label lbl_backup_days = new Label(gDefaultDir, SWT.NULL);
    Messages.setLanguageText(lbl_backup_days, "br.backup.auto.everydays");

    IntParameter backup_everydays =
        new IntParameter(gDefaultDir, "br.backup.auto.everydays", 1, Integer.MAX_VALUE);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    backup_everydays.setLayoutData(gridData);

    Label lbl_backup_retain = new Label(gDefaultDir, SWT.NULL);
    Messages.setLanguageText(lbl_backup_retain, "br.backup.auto.retain");

    IntParameter backup_retain =
        new IntParameter(gDefaultDir, "br.backup.auto.retain", 1, Integer.MAX_VALUE);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    backup_retain.setLayoutData(gridData);

    BooleanParameter chkNotify =
        new BooleanParameter(gDefaultDir, "br.backup.notify", "br.backup.notify");
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    chkNotify.setLayoutData(gridData);

    Label backup_auto_label = new Label(gDefaultDir, SWT.NULL);
    Messages.setLanguageText(backup_auto_label, "br.backup.auto.now");

    Button backup_auto_button = new Button(gDefaultDir, SWT.PUSH);
    Messages.setLanguageText(backup_auto_button, "br.test");

    backup_auto_button.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            runBackup(backup_manager, null, stats_updater);
          }
        });

    auto_backup_enable.setAdditionalActionPerformer(
        new ChangeSelectionActionPerformer(gDefaultDir));

    // restore

    Group gRestore = new Group(cBR, SWT.NULL);
    Messages.setLanguageText(gRestore, "br.restore");
    layout = new GridLayout(2, false);
    gRestore.setLayout(layout);
    gRestore.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label restore_label = new Label(gRestore, SWT.NULL);
    Messages.setLanguageText(restore_label, "br.restore.info");

    Button restore_button = new Button(gRestore, SWT.PUSH);
    Messages.setLanguageText(restore_button, "br.restore");

    restore_button.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default");

            DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);

            if (def_dir != null) {
              dialog.setFilterPath(def_dir);
            }

            dialog.setMessage(MessageText.getString("br.restore.folder.info"));

            dialog.setText(MessageText.getString("br.restore.folder.title"));

            final String path = dialog.open();

            if (path != null) {

              MessageBoxShell mb =
                  new MessageBoxShell(
                      SWT.ICON_WARNING | SWT.OK | SWT.CANCEL,
                      MessageText.getString("br.restore.warning.title"),
                      MessageText.getString("br.restore.warning.info"));

              mb.setDefaultButtonUsingStyle(SWT.CANCEL);
              mb.setParent(parent.getShell());

              mb.open(
                  new UserPrompterResultListener() {
                    public void prompterClosed(int returnVal) {
                      if (returnVal != SWT.OK) {
                        return;
                      }

                      final TextViewerWindow viewer =
                          new TextViewerWindow(
                              MessageText.getString("br.backup.progress"), null, "", true, true);

                      viewer.setEditable(false);

                      viewer.setOKEnabled(false);

                      backup_manager.restore(
                          new File(path),
                          new BackupManager.BackupListener() {
                            public boolean reportProgress(String str) {
                              return (append(str, false));
                            }

                            public void reportComplete() {
                              append("Restore Complete!", true);

                              Utils.execSWTThread(
                                  new AERunnable() {
                                    public void runSupport() {
                                      MessageBoxShell mb =
                                          new MessageBoxShell(
                                              SWT.ICON_INFORMATION | SWT.OK,
                                              MessageText.getString(
                                                  "ConfigView.section.security.restart.title"),
                                              MessageText.getString(
                                                  "ConfigView.section.security.restart.msg"));
                                      mb.setParent(parent.getShell());
                                      mb.open(
                                          new UserPrompterResultListener() {
                                            public void prompterClosed(int returnVal) {
                                              UIFunctionsSWT uiFunctions =
                                                  UIFunctionsManagerSWT.getUIFunctionsSWT();

                                              if (uiFunctions != null) {

                                                uiFunctions.dispose(true, false);
                                              }
                                            }
                                          });
                                    }
                                  });
                            }

                            public void reportError(Throwable error) {
                              append(
                                  "Restore Failed: " + Debug.getNestedExceptionMessage(error),
                                  true);
                            }

                            private boolean append(final String str, final boolean complete) {
                              if (viewer.isDisposed()) {

                                return (false);
                              }

                              Utils.execSWTThread(
                                  new AERunnable() {
                                    public void runSupport() {
                                      if (str.endsWith("...")) {

                                        viewer.append(str);

                                      } else {

                                        viewer.append(str + "\r\n");
                                      }

                                      if (complete) {

                                        viewer.setOKEnabled(true);
                                      }
                                    }
                                  });

                              return (true);
                            }
                          });

                      viewer.goModal();
                    }
                  });
            }
          }
        });

    return (cBR);
  }
  public Composite configSectionCreate(final Composite parent) {
    GridData gridData;
    GridLayout layout;
    Label label;

    Composite cDisplay = new Composite(parent, SWT.NULL);

    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    cDisplay.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    cDisplay.setLayout(layout);

    new BooleanParameter(cDisplay, "Open Details", LBLKEY_PREFIX + "opendetails");

    /** Old-style speed menus. */
    new BooleanParameter(cDisplay, "GUI_SWT_bOldSpeedMenu", LBLKEY_PREFIX + "use_old_speed_menus");

    Composite cBars = new Composite(cDisplay, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cBars.setLayout(layout);
    cBars.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    new BooleanParameter(cBars, "Open Bar Incomplete", LBLKEY_PREFIX + "openbar.incomplete");
    new BooleanParameter(cBars, "Open Bar Complete", LBLKEY_PREFIX + "openbar.complete");
    new BooleanParameter(
        cDisplay,
        "Remember transfer bar location",
        LBLKEY_PREFIX + "transferbar.remember_location");

    if (!Constants.isOSX || SWT.getVersion() >= 3300) {

      BooleanParameter est =
          new BooleanParameter(cDisplay, "Enable System Tray", KEY_PREFIX + "enabletray");

      BooleanParameter ctt =
          new BooleanParameter(cDisplay, "Close To Tray", LBLKEY_PREFIX + "closetotray");
      BooleanParameter mtt =
          new BooleanParameter(cDisplay, "Minimize To Tray", LBLKEY_PREFIX + "minimizetotray");

      est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(ctt.getControls()));
      est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(mtt.getControls()));
    }

    /** Default download / upload limits available in the UI. */
    Group limit_group = new Group(cDisplay, SWT.NULL);
    Messages.setLanguageText(limit_group, LBLKEY_PREFIX + "set_ui_transfer_speeds");
    layout = new GridLayout();
    limit_group.setLayout(layout);
    limit_group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label limit_group_label = new Label(limit_group, SWT.WRAP);
    limit_group_label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.GRAB_HORIZONTAL));
    Messages.setLanguageText(
        limit_group_label, LBLKEY_PREFIX + "set_ui_transfer_speeds.description");

    String[] limit_types = new String[] {"download", "upload"};
    final String limit_type_prefix = "config.ui.speed.partitions.manual.";
    for (int i = 0; i < limit_types.length; i++) {
      final BooleanParameter bp =
          new BooleanParameter(
              limit_group,
              limit_type_prefix + limit_types[i] + ".enabled",
              false,
              LBLKEY_PREFIX + "set_ui_transfer_speeds.description." + limit_types[i]);
      final StringParameter sp =
          new StringParameter(limit_group, limit_type_prefix + limit_types[i] + ".values", "");
      IAdditionalActionPerformer iaap =
          new GenericActionPerformer(new Control[] {}) {
            public void performAction() {
              sp.getControl().setEnabled(bp.isSelected());
            }
          };

      gridData = new GridData();
      gridData.widthHint = 150;
      sp.setLayoutData(gridData);
      iaap.performAction();
      bp.setAdditionalActionPerformer(iaap);
    }

    new BooleanParameter(cDisplay, "Send Version Info", LBLKEY_PREFIX + "allowSendVersion");

    Composite cArea = new Composite(cDisplay, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
    cArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    new LinkLabel(
        cArea,
        LBLKEY_PREFIX + "version.info.link",
        "http://www.azureuswiki.com/index.php/Version.azureusplatform.com");

    if (!Constants.isOSX) {

      BooleanParameter confirm =
          new BooleanParameter(
              cArea, "confirmationOnExit", "ConfigView.section.style.confirmationOnExit");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      confirm.setLayoutData(gridData);
    }

    cArea = new Composite(cDisplay, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
    cArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // config torrent removal

    BooleanParameter confirm_removal =
        new BooleanParameter(
            cArea, "confirm_torrent_removal", KEY_PREFIX + "confirm_torrent_removal");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    confirm_removal.setLayoutData(gridData);

    // clear remembered decisions

    final Label clear_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_label, KEY_PREFIX + "cleardecisions");

    final Button clear_decisions = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_decisions, KEY_PREFIX + "cleardecisionsbutton");

    clear_decisions.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {

            COConfigurationManager.setParameter("MessageBoxWindow.decisions", new HashMap());
          }
        });

    final Label clear_tracker_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_tracker_label, KEY_PREFIX + "cleartrackers");

    final Button clear_tracker_button = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_tracker_button, KEY_PREFIX + "cleartrackersbutton");

    clear_tracker_button.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            TrackersUtil.getInstance().clearAllTrackers(true);
          }
        });

    final Label clear_save_path_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_save_path_label, KEY_PREFIX + "clearsavepaths");

    final Button clear_save_path_button = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_save_path_button, KEY_PREFIX + "clearsavepathsbutton");

    clear_save_path_button.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            COConfigurationManager.setParameter("saveTo_list", new StringListImpl());
          }
        });

    decisions_parameter_listener =
        new ParameterListener() {
          public void parameterChanged(String parameterName) {
            if (clear_decisions.isDisposed()) {

              // tidy up from previous incarnations

              COConfigurationManager.removeParameterListener("MessageBoxWindow.decisions", this);

            } else {

              boolean enabled =
                  COConfigurationManager.getMapParameter(
                              "MessageBoxWindow.decisions", new HashMap())
                          .size()
                      > 0;

              clear_label.setEnabled(enabled);
              clear_decisions.setEnabled(enabled);
            }
          }
        };

    decisions_parameter_listener.parameterChanged(null);

    COConfigurationManager.addParameterListener(
        "MessageBoxWindow.decisions", decisions_parameter_listener);

    // password

    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, LBLKEY_PREFIX + "password");

    gridData = new GridData();
    gridData.widthHint = 150;
    PasswordParameter pw1 = new PasswordParameter(cArea, "Password");
    pw1.setLayoutData(gridData);
    Text t1 = (Text) pw1.getControl();

    // password confirm

    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, LBLKEY_PREFIX + "passwordconfirm");
    gridData = new GridData();
    gridData.widthHint = 150;
    PasswordParameter pw2 = new PasswordParameter(cArea, "Password Confirm");
    pw2.setLayoutData(gridData);
    Text t2 = (Text) pw2.getControl();

    // password activated

    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, LBLKEY_PREFIX + "passwordmatch");
    passwordMatch = new Label(cArea, SWT.NULL);
    gridData = new GridData();
    gridData.widthHint = 150;
    passwordMatch.setLayoutData(gridData);
    refreshPWLabel();

    t1.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            refreshPWLabel();
          }
        });
    t2.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            refreshPWLabel();
          }
        });

    // drag-drop

    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.section.style.dropdiraction");

    String[] drop_options = {
      "ConfigView.section.style.dropdiraction.opentorrents",
      "ConfigView.section.style.dropdiraction.sharefolder",
      "ConfigView.section.style.dropdiraction.sharefoldercontents",
      "ConfigView.section.style.dropdiraction.sharefoldercontentsrecursive",
    };

    String dropLabels[] = new String[drop_options.length];
    String dropValues[] = new String[drop_options.length];
    for (int i = 0; i < drop_options.length; i++) {

      dropLabels[i] = MessageText.getString(drop_options[i]);
      dropValues[i] = "" + i;
    }
    new StringListParameter(cArea, "config.style.dropdiraction", dropLabels, dropValues);

    // reset associations

    final PlatformManager platform = PlatformManagerFactory.getPlatformManager();

    if (platform.hasCapability(PlatformManagerCapabilities.RegisterFileAssociations)) {

      Composite cResetAssoc = new Composite(cArea, SWT.NULL);
      layout = new GridLayout();
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      layout.numColumns = 2;
      cResetAssoc.setLayout(layout);
      cResetAssoc.setLayoutData(new GridData());

      label = new Label(cResetAssoc, SWT.NULL);
      Messages.setLanguageText(label, KEY_PREFIX + "resetassoc");

      Button reset = new Button(cResetAssoc, SWT.PUSH);
      Messages.setLanguageText(reset, KEY_PREFIX + "resetassocbutton"); // $NON-NLS-1$

      reset.addListener(
          SWT.Selection,
          new Listener() {
            public void handleEvent(Event event) {

              try {
                platform.registerApplication();

              } catch (PlatformManagerException e) {

                Logger.log(
                    new LogAlert(LogAlert.UNREPEATABLE, "Failed to register application", e));
              }
            }
          });

      new BooleanParameter(cArea, "config.interface.checkassoc", KEY_PREFIX + "checkassoc");
    }

    return cDisplay;
  }
  public Composite configSectionCreate(final Composite parent) {
    GridData gridData;

    Composite cSection = new Composite(parent, SWT.NULL);

    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL + GridData.VERTICAL_ALIGN_FILL);
    cSection.setLayoutData(gridData);
    GridLayout advanced_layout = new GridLayout();
    cSection.setLayout(advanced_layout);

    int userMode = COConfigurationManager.getIntParameter("User Mode");
    if (userMode < REQUIRED_MODE) {
      Label label = new Label(cSection, SWT.WRAP);
      gridData = new GridData();
      label.setLayoutData(gridData);

      final String[] modeKeys = {
        "ConfigView.section.mode.beginner",
        "ConfigView.section.mode.intermediate",
        "ConfigView.section.mode.advanced"
      };

      String param1, param2;
      if (REQUIRED_MODE < modeKeys.length) param1 = MessageText.getString(modeKeys[REQUIRED_MODE]);
      else param1 = String.valueOf(REQUIRED_MODE);

      if (userMode < modeKeys.length) param2 = MessageText.getString(modeKeys[userMode]);
      else param2 = String.valueOf(userMode);

      label.setText(
          MessageText.getString("ConfigView.notAvailableForMode", new String[] {param1, param2}));

      return cSection;
    }

    new LinkLabel(
        cSection, gridData, CFG_PREFIX + "info.link", MessageText.getString(CFG_PREFIX + "url"));

    ///////////////////////   ADVANCED SOCKET SETTINGS GROUP //////////

    Group gSocket = new Group(cSection, SWT.NULL);
    Messages.setLanguageText(gSocket, CFG_PREFIX + "socket.group");
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
    gSocket.setLayoutData(gridData);
    GridLayout glayout = new GridLayout();
    glayout.numColumns = 3;
    gSocket.setLayout(glayout);

    // max simultaneous

    Label lmaxout = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(
        lmaxout, "ConfigView.section.connection.network.max.simultaneous.connect.attempts");
    gridData = new GridData();
    lmaxout.setLayoutData(gridData);

    IntParameter max_connects =
        new IntParameter(gSocket, "network.max.simultaneous.connect.attempts", 1, 100);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    max_connects.setLayoutData(gridData);

    // // max pending

    Label lmaxpout = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(
        lmaxpout, "ConfigView.section.connection.network.max.outstanding.connect.attempts");
    gridData = new GridData();
    lmaxpout.setLayoutData(gridData);

    IntParameter max_pending_connects =
        new IntParameter(gSocket, "network.tcp.max.connections.outstanding", 1, 65536);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    max_pending_connects.setLayoutData(gridData);

    // bind ip

    Label lbind = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(lbind, "ConfigView.label.bindip");
    gridData = new GridData();
    lbind.setLayoutData(gridData);

    StringParameter bindip = new StringParameter(gSocket, "Bind IP", "", false);
    gridData = new GridData();
    gridData.widthHint = 100;
    gridData.horizontalSpan = 2;
    bindip.setLayoutData(gridData);

    Text lbind2 = new Text(gSocket, SWT.READ_ONLY | SWT.MULTI);
    lbind2.setTabs(8);
    Messages.setLanguageText(
        lbind2,
        "ConfigView.label.bindip.details",
        new String[] {
          "\t"
              + NetworkAdmin.getSingleton()
                  .getNetworkInterfacesAsString()
                  .replaceAll("\\\n", "\n\t")
        });
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    lbind2.setLayoutData(gridData);

    BooleanParameter check_bind =
        new BooleanParameter(gSocket, "Check Bind IP On Start", "network.check.ipbinding");
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    check_bind.setLayoutData(gridData);

    BooleanParameter force_bind =
        new BooleanParameter(gSocket, "Enforce Bind IP", "network.enforce.ipbinding");
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    force_bind.setLayoutData(gridData);

    BooleanParameter bind_icon =
        new BooleanParameter(gSocket, "Show IP Bindings Icon", "network.ipbinding.icon.show");
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    bind_icon.setLayoutData(gridData);

    Label lpbind = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(lpbind, CFG_PREFIX + "bind_port");
    final IntParameter port_bind = new IntParameter(gSocket, "network.bind.local.port", 0, 65535);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    port_bind.setLayoutData(gridData);

    Label lmtu = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(lmtu, CFG_PREFIX + "mtu");
    final IntParameter mtu_size = new IntParameter(gSocket, "network.tcp.mtu.size");
    mtu_size.setMaximumValue(512 * 1024);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    mtu_size.setLayoutData(gridData);

    // sndbuf

    Label lsend = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(lsend, CFG_PREFIX + "SO_SNDBUF");
    final IntParameter SO_SNDBUF = new IntParameter(gSocket, "network.tcp.socket.SO_SNDBUF");
    gridData = new GridData();
    SO_SNDBUF.setLayoutData(gridData);

    final Label lsendcurr = new Label(gSocket, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalIndent = 10;
    lsendcurr.setLayoutData(gridData);

    // rcvbuf

    Label lreceiv = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(lreceiv, CFG_PREFIX + "SO_RCVBUF");
    final IntParameter SO_RCVBUF = new IntParameter(gSocket, "network.tcp.socket.SO_RCVBUF");
    gridData = new GridData();
    SO_RCVBUF.setLayoutData(gridData);

    final Label lreccurr = new Label(gSocket, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalIndent = 10;
    lreccurr.setLayoutData(gridData);

    final Runnable buff_updater =
        new Runnable() {
          public void run() {
            SocketChannel sc = null;

            int snd_val = 0;
            int rec_val = 0;

            try {
              sc = SocketChannel.open();

              Socket socket = sc.socket();

              if (SO_SNDBUF.getValue() == 0) {

                snd_val = socket.getSendBufferSize();
              }

              if (SO_RCVBUF.getValue() == 0) {

                rec_val = socket.getReceiveBufferSize();
              }
            } catch (Throwable e) {

            } finally {

              try {
                sc.close();

              } catch (Throwable e) {
              }
            }

            if (snd_val == 0) {
              lsendcurr.setText("");
            } else {
              Messages.setLanguageText(
                  lsendcurr, "label.current.equals", new String[] {String.valueOf(snd_val)});
            }

            if (rec_val == 0) {
              lreccurr.setText("");
            } else {
              Messages.setLanguageText(
                  lreccurr, "label.current.equals", new String[] {String.valueOf(rec_val)});
            }
          }
        };

    buff_updater.run();

    ParameterChangeAdapter buff_listener =
        new ParameterChangeAdapter() {
          public void parameterChanged(Parameter p, boolean caused_internally) {
            buff_updater.run();
          }
        };

    SO_RCVBUF.addChangeListener(buff_listener);
    SO_SNDBUF.addChangeListener(buff_listener);

    Label ltos = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(ltos, CFG_PREFIX + "IPDiffServ");
    final StringParameter IPDiffServ =
        new StringParameter(gSocket, "network.tcp.socket.IPDiffServ");
    gridData = new GridData();
    gridData.widthHint = 100;
    gridData.horizontalSpan = 2;
    IPDiffServ.setLayoutData(gridData);

    // do simple input verification, and registry key setting for TOS field
    IPDiffServ.addChangeListener(
        new ParameterChangeAdapter() {

          final Color obg = IPDiffServ.getControl().getBackground();

          final Color ofg = IPDiffServ.getControl().getForeground();

          public void parameterChanged(Parameter p, boolean caused_internally) {
            String raw = IPDiffServ.getValue();
            int value = -1;

            try {
              value = Integer.decode(raw).intValue();
            } catch (Throwable t) {
            }

            if (value < 0 || value > 255) { // invalid or no value entered
              ConfigurationManager.getInstance().removeParameter("network.tcp.socket.IPDiffServ");

              if (raw != null && raw.length() > 0) { // error state
                IPDiffServ.getControl().setBackground(Colors.red);
                IPDiffServ.getControl().setForeground(Colors.white);
              } else { // no value state
                IPDiffServ.getControl().setBackground(obg);
                IPDiffServ.getControl().setForeground(ofg);
              }

              enableTOSRegistrySetting(false); // disable registry setting if necessary
            } else { // passes test
              IPDiffServ.getControl().setBackground(obg);
              IPDiffServ.getControl().setForeground(ofg);

              enableTOSRegistrySetting(true); // enable registry setting if necessary
            }
          }
        });

    // read select

    Label lreadsel = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(
        lreadsel,
        CFG_PREFIX + "read_select",
        new String[] {
          String.valueOf(COConfigurationManager.getDefault("network.tcp.read.select.time"))
        });
    final IntParameter read_select =
        new IntParameter(gSocket, "network.tcp.read.select.time", 10, 250);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    read_select.setLayoutData(gridData);

    Label lreadselmin = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(
        lreadselmin,
        CFG_PREFIX + "read_select_min",
        new String[] {
          String.valueOf(COConfigurationManager.getDefault("network.tcp.read.select.min.time"))
        });
    final IntParameter read_select_min =
        new IntParameter(gSocket, "network.tcp.read.select.min.time", 0, 100);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    read_select_min.setLayoutData(gridData);

    // write select

    Label lwritesel = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(
        lwritesel,
        CFG_PREFIX + "write_select",
        new String[] {
          String.valueOf(COConfigurationManager.getDefault("network.tcp.write.select.time"))
        });
    final IntParameter write_select =
        new IntParameter(gSocket, "network.tcp.write.select.time", 10, 250);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    write_select.setLayoutData(gridData);

    Label lwriteselmin = new Label(gSocket, SWT.NULL);
    Messages.setLanguageText(
        lwriteselmin,
        CFG_PREFIX + "write_select_min",
        new String[] {
          String.valueOf(COConfigurationManager.getDefault("network.tcp.write.select.min.time"))
        });
    final IntParameter write_select_min =
        new IntParameter(gSocket, "network.tcp.write.select.min.time", 0, 100);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    write_select_min.setLayoutData(gridData);

    new BooleanParameter(cSection, "IPV6 Enable Support", "network.ipv6.enable.support");

    new BooleanParameter(cSection, "IPV6 Prefer Addresses", "network.ipv6.prefer.addresses");

    if (Constants.isWindowsVistaOrHigher && Constants.isJava7OrHigher) {

      new BooleanParameter(cSection, "IPV4 Prefer Stack", "network.ipv4.prefer.stack");
    }

    //////////////////////////////////////////////////////////////////////////

    return cSection;
  }
  public Composite configSectionCreate(final Composite parent) {
    GridData gridData;
    GridLayout layout;
    Label label;

    final Composite cDisplay = new Composite(parent, SWT.NULL);

    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    cDisplay.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    cDisplay.setLayout(layout);

    final PlatformManager platform = PlatformManagerFactory.getPlatformManager();

    int userMode = COConfigurationManager.getIntParameter("User Mode");

    // ***** start group

    boolean can_ral = platform.hasCapability(PlatformManagerCapabilities.RunAtLogin);

    if (can_ral || userMode > 0) {

      Group gStartStop = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gStartStop, LBLKEY_PREFIX + "start");
      layout = new GridLayout(2, false);
      gStartStop.setLayout(layout);
      gStartStop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      if (can_ral) {

        gridData = new GridData();
        gridData.horizontalSpan = 2;
        BooleanParameter start_on_login =
            new BooleanParameter(gStartStop, "Start On Login", LBLKEY_PREFIX + "start.onlogin");

        try {
          start_on_login.setSelected(platform.getRunAtLogin());

          start_on_login.addChangeListener(
              new ParameterChangeAdapter() {
                public void booleanParameterChanging(Parameter p, boolean toValue) {
                  try {
                    platform.setRunAtLogin(toValue);

                  } catch (Throwable e) {

                    Debug.out(e);
                  }
                }
              });

        } catch (Throwable e) {

          start_on_login.setEnabled(false);

          Debug.out(e);
        }

        start_on_login.setLayoutData(gridData);
      }

      if (userMode > 0) {

        gridData = new GridData();
        gridData.horizontalSpan = 2;

        BooleanParameter start_in_lr_mode =
            new BooleanParameter(
                gStartStop, "Start In Low Resource Mode", LBLKEY_PREFIX + "start.inlrm");

        start_in_lr_mode.setLayoutData(gridData);
      }
    }

    if (platform.hasCapability(PlatformManagerCapabilities.PreventComputerSleep)) {

      Group gSleep = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gSleep, LBLKEY_PREFIX + "sleep");
      layout = new GridLayout(2, false);
      gSleep.setLayout(layout);
      gSleep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      label = new Label(gSleep, SWT.NULL);
      Messages.setLanguageText(label, "ConfigView.label.sleep.info");
      label.setLayoutData(gridData);

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter no_sleep_dl =
          new BooleanParameter(
              gSleep, "Prevent Sleep Downloading", LBLKEY_PREFIX + "sleep.download");
      no_sleep_dl.setLayoutData(gridData);

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter no_sleep_se =
          new BooleanParameter(gSleep, "Prevent Sleep FP Seeding", LBLKEY_PREFIX + "sleep.fpseed");
      no_sleep_se.setLayoutData(gridData);
    }

    if (userMode > 0) {

      Group gPR = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gPR, LBLKEY_PREFIX + "pauseresume");
      layout = new GridLayout(2, false);
      gPR.setLayout(layout);
      gPR.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter pauseOnExit =
          new BooleanParameter(
              gPR, "Pause Downloads On Exit", "ConfigView.label.pause.downloads.on.exit");
      pauseOnExit.setLayoutData(gridData);

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter resumeOnStart =
          new BooleanParameter(
              gPR, "Resume Downloads On Start", "ConfigView.label.resume.downloads.on.start");
      resumeOnStart.setLayoutData(gridData);
    }

    if (userMode >= 0) {

      Group gStop = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gStop, LBLKEY_PREFIX + "stop");
      layout = new GridLayout(2, false);
      gStop.setLayout(layout);
      gStop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      // done downloading

      gridData = new GridData();
      label = new Label(gStop, SWT.NULL);
      Messages.setLanguageText(label, "ConfigView.label.stop.downcomp");
      label.setLayoutData(gridData);

      int shutdown_types = platform.getShutdownTypes();

      List<String> l_action_values = new ArrayList<String>();
      List<String> l_action_descs = new ArrayList<String>();

      l_action_values.add("Nothing");
      l_action_values.add("QuitVuze");

      if ((shutdown_types & PlatformManager.SD_SLEEP) != 0) {

        l_action_values.add("Sleep");
      }
      if ((shutdown_types & PlatformManager.SD_HIBERNATE) != 0) {

        l_action_values.add("Hibernate");
      }
      if ((shutdown_types & PlatformManager.SD_SHUTDOWN) != 0) {

        l_action_values.add("Shutdown");
      }

      String[] action_values = l_action_values.toArray(new String[l_action_values.size()]);

      for (String s : action_values) {

        l_action_descs.add(MessageText.getString("ConfigView.label.stop." + s));
      }

      String[] action_descs = l_action_descs.toArray(new String[l_action_descs.size()]);

      new StringListParameter(
          gStop, "On Downloading Complete Do", "Nothing", action_descs, action_values);

      // done seeding

      gridData = new GridData();
      label = new Label(gStop, SWT.NULL);
      Messages.setLanguageText(label, "ConfigView.label.stop.seedcomp");
      label.setLayoutData(gridData);

      new StringListParameter(
          gStop, "On Seeding Complete Do", "Nothing", action_descs, action_values);

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter resetOnTrigger =
          new BooleanParameter(
              gStop,
              "Stop Triggers Auto Reset",
              "!"
                  + MessageText.getString(
                      "ConfigView.label.stop.autoreset",
                      new String[] {MessageText.getString("ConfigView.label.stop.Nothing")})
                  + "!");

      resetOnTrigger.setLayoutData(gridData);
    }

    if (userMode > 0
        && platform.hasCapability(PlatformManagerCapabilities.AccessExplicitVMOptions)) {

      Group gJVM = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gJVM, LBLKEY_PREFIX + "jvm");
      layout = new GridLayout(2, false);
      gJVM.setLayout(layout);
      gJVM.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      // wiki link

      gridData = new GridData();
      gridData.horizontalSpan = 2;

      LinkLabel link =
          new LinkLabel(
              gJVM,
              gridData,
              "ConfigView.label.please.visit.here",
              "http://wiki.vuze.com/w/Java_VM_memory_usage");

      // info

      label = new Label(gJVM, SWT.NULL);
      Messages.setLanguageText(label, "jvm.info");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      label.setLayoutData(gridData);

      try {
        final File option_file = platform.getVMOptionFile();

        final Group gJVMOptions = new Group(gJVM, SWT.NULL);
        layout = new GridLayout(3, false);
        gJVMOptions.setLayout(layout);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 2;
        gJVMOptions.setLayoutData(gridData);

        buildOptions(cDisplay, platform, gJVMOptions, false);

        // show option file

        label = new Label(gJVM, SWT.NULL);
        Messages.setLanguageText(
            label, "jvm.show.file", new String[] {option_file.getAbsolutePath()});

        Button show_folder_button = new Button(gJVM, SWT.PUSH);

        Messages.setLanguageText(show_folder_button, "MyTorrentsView.menu.explore");

        show_folder_button.addSelectionListener(
            new SelectionAdapter() {
              public void widgetSelected(SelectionEvent e) {
                ManagerUtils.open(option_file);
              }
            });

        label = new Label(gJVM, SWT.NULL);
        Messages.setLanguageText(label, "jvm.reset");

        Button reset_button = new Button(gJVM, SWT.PUSH);

        Messages.setLanguageText(reset_button, "Button.reset");

        reset_button.addSelectionListener(
            new SelectionAdapter() {
              public void widgetSelected(SelectionEvent event) {
                try {
                  platform.setExplicitVMOptions(new String[0]);

                  buildOptions(cDisplay, platform, gJVMOptions, true);

                } catch (Throwable e) {

                  Debug.out(e);
                }
              }
            });

      } catch (Throwable e) {

        Debug.out(e);

        label = new Label(gJVM, SWT.NULL);
        Messages.setLanguageText(
            label, "jvm.error", new String[] {Debug.getNestedExceptionMessage(e)});
        gridData = new GridData();
        gridData.horizontalSpan = 2;
        label.setLayoutData(gridData);
      }
    }

    return cDisplay;
  }