@Override
  public void loadProperties(final IProject project) {
    try {
      String temp =
          project.getPersistentProperty(
              new QualifiedName(
                  ProjectBuildPropertyData.QUALIFIER,
                  COptimalizationOptionsData.OPTIMIZATION_LEVEL_PROPERTY));
      if (temp != null && temp.length() != 0) {
        optimalizationLevel.setSelectedValue(temp);
      } else {
        optimalizationLevel.setSelectedValue("Common optimizations");
      }

      temp =
          project.getPersistentProperty(
              new QualifiedName(
                  ProjectBuildPropertyData.QUALIFIER,
                  COptimalizationOptionsData.OTHER_OPTIMIZATION_FLAGS_PROPERTY));
      otherFlags.setStringValue(temp);
    } catch (CoreException e) {
      optimalizationLevel.setSelectedValue("Common optimizations");
      otherFlags.setStringValue("");
    }
  }
 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);
   }
 }
  @Override
  public void performDefaults() {
    if (mainComposite == null) {
      return;
    }

    optimalizationLevel.setEnabled(true, mainComposite);
    optimalizationLevel.setSelectedValue("Common optimizations");

    otherFlags.setEnabled(true, mainComposite);
    otherFlags.setStringValue("");
  }
  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);
  }