Example #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
   */
  protected void createFieldEditors() {

    StringFieldEditor elvinServer =
        new StringFieldEditor(Constants.ELVIN_SERVER, "Elvin:", getFieldEditorParent());
    elvinServer.getTextControl(getFieldEditorParent());
    addField(elvinServer);

    StringFieldEditor mysqlServer =
        new StringFieldEditor(Constants.MYSQL_SERVER, "Mysql:", getFieldEditorParent());
    mysqlServer.getTextControl(getFieldEditorParent());
    addField(mysqlServer);

    StringFieldEditor mysqlUsername =
        new StringFieldEditor(Constants.MYSQL_USERNAME, "Username:"******"Password:"******"Database:", getFieldEditorParent());
    mysqlDatabase.getTextControl(getFieldEditorParent());
    addField(mysqlDatabase);
  }
  @Override
  protected void createFieldEditors() {
    Text text = null;

    StringFieldEditor databaseDriverNameField =
        new StringFieldEditor(
            CommonParameters.DATABASE_DRIVER_NAME, "&Driver Name:", getFieldEditorParent());
    text = databaseDriverNameField.getTextControl(getFieldEditorParent());
    text.setEditable(false);
    text.setText(
        CommonParameters.get(CommonParameters.DATABASE_DRIVER_NAME) != null
            ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_NAME)
            : DatabasePreferencePage.N_A);
    addField(databaseDriverNameField);

    StringFieldEditor databaseMinorVersionField =
        new StringFieldEditor(
            CommonParameters.DATABASE_DRIVER_MINOR_VERSION,
            "&Minor Version:",
            getFieldEditorParent());
    text = databaseMinorVersionField.getTextControl(getFieldEditorParent());
    text.setEditable(false);
    text.setText(
        CommonParameters.get(CommonParameters.DATABASE_DRIVER_MINOR_VERSION) != null
            ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_MINOR_VERSION)
            : DatabasePreferencePage.N_A);
    addField(databaseMinorVersionField);

    StringFieldEditor databaseMajorVersionField =
        new StringFieldEditor(
            CommonParameters.DATABASE_DRIVER_MAJOR_VERSION,
            "&Major Version:",
            getFieldEditorParent());
    text = databaseMajorVersionField.getTextControl(getFieldEditorParent());
    text.setEditable(false);
    text.setText(
        CommonParameters.get(CommonParameters.DATABASE_DRIVER_MAJOR_VERSION) != null
            ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_MAJOR_VERSION)
            : DatabasePreferencePage.N_A);
    addField(databaseMajorVersionField);

    StringFieldEditor databaseConnectionClassNameField =
        new StringFieldEditor(
            CommonParameters.DATABASE_CONNECTION_CLASS_NAME,
            "&Connection Class Name:",
            getFieldEditorParent());
    text = databaseConnectionClassNameField.getTextControl(getFieldEditorParent());
    text.setEditable(false);
    text.setText(
        CommonParameters.get(CommonParameters.DATABASE_CONNECTION_CLASS_NAME) != null
            ? CommonParameters.get(CommonParameters.DATABASE_CONNECTION_CLASS_NAME)
            : DatabasePreferencePage.N_A);
    addField(databaseConnectionClassNameField);
  }
 private void updateFields(String newSelection) {
   GitDateFormatter.Format format = fromString(newSelection);
   FormatInfo info = DATA.get(format);
   formatExplanation.setText(info.explanation);
   if (format == null) {
     dateFormat.getTextControl(getFieldEditorParent()).setEnabled(true);
     dateFormat.setStringValue(lastCustomValue);
   } else {
     dateFormat.getTextControl(getFieldEditorParent()).setEnabled(false);
     dateFormat.setStringValue(info.format);
     updatePreview(format);
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
   */
  @Override
  protected void createFieldEditors() {

    // Load up the preference store
    super.createFieldEditors();
    // Add a string editor to edit the tool command
    Composite parent = getFieldEditorParent();
    FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
    commandStringField =
        new StringFieldEditor(fTool.getId(), Messages.BuildToolSettingsPage_tool_command, parent);
    commandStringField.setEmptyStringAllowed(false);
    GridData gd = ((GridData) commandStringField.getTextControl(parent).getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3);
    addField(commandStringField);
    // Add a field editor that displays overall build options
    Composite par = getFieldEditorParent();
    allOptionFieldEditor =
        new MultiLineTextFieldEditor(ToolSettingsPrefStore.ALL_OPTIONS_ID, ALL_OPTIONS, par);
    allOptionFieldEditor.getTextControl(par).setEditable(false);
    //		gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
    addField(allOptionFieldEditor);

    addField(createLabelEditor(getFieldEditorParent(), WHITESPACE));
    addField(
        createLabelEditor(
            getFieldEditorParent(), Messages.BuildToolSettingsPage_tool_advancedSettings));

    // Add a string editor to edit the tool command line pattern
    parent = getFieldEditorParent();
    commandLinePatternField =
        new StringFieldEditor(
            fTool.getId() + ToolSettingsPrefStore.COMMAND_LINE_SUFFIX,
            Messages.BuildToolSettingsPage_tool_commandLinePattern,
            parent);
    gd = ((GridData) commandLinePatternField.getTextControl(parent).getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = Dialog.convertWidthInCharsToPixels(fm, 30);
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
    addField(commandLinePatternField);
  }
 private void setTooltip(Composite parent, StringFieldEditor fe, String tooltip) {
   fe.getLabelControl(parent).setToolTipText(tooltip);
   fe.getTextControl(parent).setToolTipText(tooltip);
 }
  public void createControl(Composite parent) {
    setTitle(
        this.m_i18n.getString(
            "ui.jface.configuration.pages.FritzBoxVoip", "title", "label", this.m_language));
    setDescription(
        this.m_i18n.getString(
            "ui.jface.configuration.pages.FritzBoxVoip", "description", "label", this.m_language));

    final Composite c = new Composite(parent, SWT.NONE);
    c.setLayout(new GridLayout(1, false));
    c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    BooleanFieldEditor bfe =
        new BooleanFieldEditor(
            "activemonitor",
            this.m_i18n.getString(
                "ui.jface.configuration.pages.FritzBoxVoip",
                "activemonitor2",
                "label",
                this.m_language),
            c);
    bfe.setPropertyChangeListener(
        new IPropertyChangeListener() {

          public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof Boolean)
              m_active = ((Boolean) e.getNewValue()).booleanValue();
            setPageComplete(isComplete());
          }
        });

    new Label(c, SWT.LEFT);

    StringFieldEditor sfe =
        new StringFieldEditor(
            "boxip",
            this.m_i18n.getString(
                "ui.jface.configuration.pages.FritzBoxVoip", "boxip", "label", this.m_language),
            c);
    sfe.setStringValue("fritz.box");
    this.m_boxip = "fritz.box";

    sfe.setPropertyChangeListener(
        new IPropertyChangeListener() {

          public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
              m_boxip = (String) e.getNewValue();
            setPageComplete(isComplete());
          }
        });

    ComboFieldEditor mode =
        new ComboFieldEditor(
            "boxloginmode",
            this.m_i18n.getString(
                "ui.jface.configuration.pages.FritzBoxVoip",
                "boxloginmode",
                "label",
                this.m_language),
            new String[][] {
              {
                this.m_i18n.getString(
                    "ui.jface.configuration.pages.FritzBoxVoip",
                    "userpassword",
                    "label",
                    this.m_language),
                "0"
              },
              {
                this.m_i18n.getString(
                    "ui.jface.configuration.pages.FritzBoxVoip",
                    "password_only",
                    "label",
                    this.m_language),
                "1"
              }
            },
            c);

    final StringFieldEditor sfe1 =
        new StringFieldEditor(
            "boxuser",
            this.m_i18n.getString(
                "ui.jface.configuration.pages.FritzBoxVoip", "boxuser", "label", this.m_language),
            c);

    sfe1.setStringValue("");
    this.m_boxuser = "";

    mode.setPropertyChangeListener(
        new IPropertyChangeListener() {

          public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String) {
              String state = (String) e.getNewValue();
              if (state.equalsIgnoreCase("1")) {
                sfe1.setEnabled(false, c);
                sfe1.setStringValue("");
                sfe1.getTextControl(c)
                    .setBackground(new Color(DisplayManager.getDefaultDisplay(), 190, 190, 190));
                m_boxuser = "";
              } else {
                sfe1.setEnabled(true, c);
                sfe1.getTextControl(c)
                    .setBackground(new Color(DisplayManager.getDefaultDisplay(), 255, 255, 255));
              }
            }
          }
        });

    sfe1.setPropertyChangeListener(
        new IPropertyChangeListener() {

          public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
              m_boxuser = (String) e.getNewValue();
            setPageComplete(isComplete());
          }
        });

    sfe =
        new StringFieldEditor(
            "boxpassword",
            this.m_i18n.getString(
                "ui.jface.configuration.pages.FritzBoxVoip",
                "boxpassword",
                "label",
                this.m_language),
            c);

    sfe.getTextControl(c).setEchoChar('*');
    sfe.setStringValue("");
    this.m_boxpassword = "";

    sfe.setPropertyChangeListener(
        new IPropertyChangeListener() {

          public void propertyChange(PropertyChangeEvent e) {
            if (e != null && e.getNewValue() != null && e.getNewValue() instanceof String)
              m_boxpassword = (String) e.getNewValue();
            setPageComplete(isComplete());
          }
        });

    new Label(c, SWT.LEFT);
    Text l = new Text(c, SWT.LEFT | SWT.WRAP);
    l.setText(
        this.m_i18n.getString(
            "ui.jface.configuration.pages.FritzBoxVoip", "openfb", "label", this.m_language));
    l.setEditable(false);
    l.setBackground(parent.getBackground());

    new Label(c, SWT.LEFT);
    HyperLink hl = new HyperLink(c, SWT.LEFT | SWT.WRAP);
    hl.setText(
        this.m_i18n.getString(
            "ui.jface.configuration.pages.FritzBoxVoip", "openfb2", "label", this.m_language));
    hl.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (e.button == 1) Program.launch("http://www.janrufmonitor.de/fritzbox-freischalten");
          }
        });

    setPageComplete(isComplete());
    setControl(c);
  }