/*
   * @see PreferencePage#performDefaults()
   */
  @Override
  protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();
    for (int i = 0; i < fCheckBoxes.size(); i++) {
      Button button = fCheckBoxes.get(i);
      String key = (String) button.getData();
      button.setSelection(store.getDefaultBoolean(key));
    }
    for (int i = 0; i < fRadioButtons.size(); i++) {
      Button button = fRadioButtons.get(i);
      String[] info = (String[]) button.getData();
      button.setSelection(info[1].equals(store.getDefaultString(info[0])));
    }
    for (int i = 0; i < fTextControls.size(); i++) {
      Text text = fTextControls.get(i);
      String key = (String) text.getData();
      text.setText(store.getDefaultString(key));
    }
    if (fJRECombo != null) {
      fJRECombo.select(store.getDefaultInt(CLASSPATH_JRELIBRARY_INDEX));
    }

    validateFolders();
    super.performDefaults();
  }
Esempio n. 2
0
 /** @see org.eclipse.jface.preference.PreferencePage#performDefaults() */
 protected void performDefaults() {
   IPreferenceStore prefs = getPreferenceStore();
   showGeneratedBy.setSelection(
       prefs.getDefaultBoolean(MsgEditorPreferences.SHOW_SUPPORT_ENABLED));
   convertUnicodeToEncoded.setSelection(
       prefs.getDefaultBoolean(MsgEditorPreferences.UNICODE_ESCAPE_ENABLED));
   convertUnicodeToEncoded.setSelection(
       prefs.getDefaultBoolean(MsgEditorPreferences.UNICODE_ESCAPE_UPPERCASE));
   alignEqualSigns.setSelection(
       prefs.getDefaultBoolean(MsgEditorPreferences.ALIGN_EQUALS_ENABLED));
   alignEqualSigns.setSelection(
       prefs.getDefaultBoolean(MsgEditorPreferences.SPACES_AROUND_EQUALS_ENABLED));
   groupKeys.setSelection(prefs.getDefaultBoolean(MsgEditorPreferences.GROUP_KEYS_ENABLED));
   groupLevelDeep.setText(prefs.getDefaultString(MsgEditorPreferences.GROUP_LEVEL_DEEP));
   groupLineBreaks.setText(
       prefs.getDefaultString(MsgEditorPreferences.GROUP_SEP_BLANK_LINE_COUNT));
   groupAlignEqualSigns.setSelection(
       prefs.getDefaultBoolean(MsgEditorPreferences.GROUP_ALIGN_EQUALS_ENABLED));
   wrapLines.setSelection(prefs.getDefaultBoolean(MsgEditorPreferences.WRAP_LINES_ENABLED));
   wrapCharLimit.setText(prefs.getDefaultString(MsgEditorPreferences.WRAP_LINE_LENGTH));
   wrapAlignEqualSigns.setSelection(
       prefs.getDefaultBoolean(MsgEditorPreferences.WRAP_ALIGN_EQUALS_ENABLED));
   wrapIndentSpaces.setText(prefs.getDefaultString(MsgEditorPreferences.WRAP_INDENT_LENGTH));
   wrapNewLine.setSelection(prefs.getDefaultBoolean(MsgEditorPreferences.NEW_LINE_NICE));
   newLineTypeForce.setSelection(
       prefs.getDefaultBoolean(MsgEditorPreferences.FORCE_NEW_LINE_TYPE));
   newLineTypes[Math.min(prefs.getDefaultInt(MsgEditorPreferences.NEW_LINE_STYLE) - 1, 0)]
       .setSelection(true);
   keepEmptyFields.setSelection(prefs.getDefaultBoolean(MsgEditorPreferences.KEEP_EMPTY_FIELDS));
   sortKeys.setSelection(prefs.getDefaultBoolean(MsgEditorPreferences.SORT_KEYS));
   refreshEnabledStatuses();
   super.performDefaults();
 }
  @Override
  protected void performDefaults() {
    store.setValue(VALGRIND_ENABLE, store.getDefaultBoolean(VALGRIND_ENABLE));
    enableButton.setSelection(store.getDefaultBoolean(VALGRIND_ENABLE));

    store.setValue(VALGRIND_PATH, store.getDefaultString(VALGRIND_PATH));
    binText.setText(store.getDefaultString(VALGRIND_PATH));
    super.performDefaults();
  }
Esempio n. 4
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
  */
 @Override
 protected void performDefaults() {
   IPreferenceStore store = getPreferenceStore();
   for (Button button : fileManagerButtons) {
     if (store
         .getDefaultString(IPreferenceConstants.LINUX_FILE_MANAGER)
         .equals((String) button.getData())) {
       button.setSelection(true);
       selectedFileManager = (String) button.getData();
     } else {
       button.setSelection(false);
     }
   }
   fileManagerPath.setText(store.getDefaultString(IPreferenceConstants.LINUX_FILE_MANAGER_PATH));
   super.performDefaults();
 }
 @Override
 protected void performDefaults() {
   projectBase.setText(prefStore.getDefaultString(PreferenceConstants.BASE_RISK_FACTOR));
   for (int i = 0; i < USED_MARKERS.size(); ++i) {
     impacts
         .get(i)
         .select(
             prefStore.getDefaultInt(ProblemNameToPreferenceMapper.nameSmellImpact(markers.get(i)))
                 - 1);
     baselines
         .get(i)
         .setText(
             prefStore.getDefaultString(
                 ProblemNameToPreferenceMapper.nameSmellBaseLine(markers.get(i))));
   }
   updateApplyButton();
 }
  /** Initializes states of the controls using default values in the preference store. */
  private void initializeDefaults() {
    IPreferenceStore store = getPreferenceStore();

    // Init default database values
    this.dbConnectionCheckBox.setSelection(store.getDefaultBoolean(PRE_DATABASE_CONNECTION));
    this.dbRelengRadioButton.setSelection(false);
    this.dbLocalRadioButton.setSelection(false);
    final boolean dbLocal = store.getDefaultBoolean(PRE_DATABASE_LOCAL);
    if (dbLocal) {
      this.dbLocalRadioButton.setSelection(true);
    } else {
      this.dbRelengRadioButton.setSelection(true);
    }
    this.databaseLocationCombo.removeAll();
    this.databaseLocationCombo.setText(store.getString(PRE_DATABASE_LOCATION));
    updateDatabaseGroup();

    // Init eclipse version
    this.mVersionRadioButton.setSelection(false);
    this.dVersionRadionButton.setSelection(false);
    int version = store.getDefaultInt(PRE_ECLIPSE_VERSION);
    if (version == ECLIPSE_MAINTENANCE_VERSION) {
      this.mVersionRadioButton.setSelection(true);
    } else {
      this.dVersionRadionButton.setSelection(true);
    }
    updateBrowseButtonToolTip(version);

    // Milestones
    this.milestonesCombo.removeAll();
    String prefix = PRE_MILESTONE_BUILDS + "." + version;
    String milestone = store.getDefaultString(prefix + "0");
    int index = 0;
    while (milestone != null && milestone.length() > 0) {
      this.milestonesCombo.add(milestone);
      milestone = store.getDefaultString(prefix + index);
    }

    // Init default default dimension
    String defaultDimension = store.getDefaultString(PRE_DEFAULT_DIMENSION);
    this.defaultDimensionCombo.setText(defaultDimension);

    // Init default generated dimensions
    this.resultsDimensionsList.add(store.getDefaultString(PRE_RESULTS_DIMENSION + ".0"));
    this.resultsDimensionsList.add(store.getDefaultString(PRE_RESULTS_DIMENSION + ".1"));
  }
  /**
   * Obtains the {@link IPreferenceStore}'s default or current value for this preference
   *
   * @param defaultFlag indicates if the default or current value is being requested
   * @return the requested value
   */
  private String getPreferenceStoreValue(boolean defaultFlag) {
    IPreferenceStore prefStore = getPreferenceStore();
    String value = null;

    if (defaultFlag) {
      value = prefStore.getDefaultString(PREF_ID);
    } else {
      value = prefStore.getString(PREF_ID);
    }

    if (StringUtilities.isEmpty(value)) {
      value = TeiidServerVersion.deriveUltimateDefaultServerVersion().toString();
    }

    return value;
  }
 public static List<ClassAttribute> loadFromPreference(boolean defaults) {
   IPreferenceStore store = RinzoJDTPlugin.getDefault().getPreferenceStore();
   String value = null;
   if (defaults) {
     value = store.getDefaultString(RinzoJDTPlugin.PREF_CLASSNAME_ATTRS);
   } else {
     value = store.getString(RinzoJDTPlugin.PREF_CLASSNAME_ATTRS);
   }
   List<ClassAttribute> list = new ArrayList<ClassAttribute>();
   if (value != null) {
     String[] values = value.split("\n");
     for (int i = 0; i < values.length; i++) {
       String[] split = values[i].split("\t");
       if (split.length == 3) {
         list.add(new ClassAttribute(split[0], split[1], split[2]));
       }
     }
   }
   return list;
 }
 protected void doLoadDefault() {
   if (listControl != null) {
     listControl.removeAll();
     java.util.List<String> defaults = new LinkedList<String>();
     int index = 0;
     IPreferenceStore store = getPreferenceStore();
     // If the default exist and isn't null
     while (store.contains(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index)) {
       String value =
           getPreferenceStore()
               .getDefaultString(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index);
       if (value != null && !value.equals("")) {
         defaults.add(
             store.getDefaultString(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index));
       }
       index++;
     }
     String[] array = defaults.toArray(new String[defaults.size()]);
     for (int i = 0; i < array.length; i++) {
       listControl.add(array[i]);
     }
   }
 }
  /**
   * 对控件设置值
   *
   * @param blnIsApplyDefault ;
   */
  private void setInitValues(boolean blnIsApplyDefault) {
    int intAutoUpdate;
    int intLanguage;
    String strSystemUser;
    String strEditorFontName;
    int intEdutorFontSize;
    String strMatchViewFontName;
    int intMatchViewFontSize;
    if (blnIsApplyDefault) {
      intAutoUpdate = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_AUTO_UPDATE);
      intLanguage = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_LANGUAGE);
      strSystemUser = preferenceStore.getDefaultString(IPreferenceConstants.SYSTEM_USER);
      strEditorFontName =
          preferenceStore.getDefaultString(IPreferenceConstants.XLIFF_EDITOR_FONT_NAME);
      intEdutorFontSize =
          preferenceStore.getDefaultInt(IPreferenceConstants.XLIFF_EDITOR_FONT_SIZE);
      strMatchViewFontName =
          preferenceStore.getDefaultString(IPreferenceConstants.MATCH_VIEW_FONT_NAME);
      intMatchViewFontSize =
          preferenceStore.getDefaultInt(IPreferenceConstants.MATCH_VIEW_FONT_SIZE);
    } else {
      intAutoUpdate = preferenceStore.getInt(IPreferenceConstants.SYSTEM_AUTO_UPDATE);
      intLanguage = preferenceStore.getInt(IPreferenceConstants.SYSTEM_LANGUAGE);
      initLang = intLanguage;
      strSystemUser = preferenceStore.getString(IPreferenceConstants.SYSTEM_USER);
      strEditorFontName = preferenceStore.getString(IPreferenceConstants.XLIFF_EDITOR_FONT_NAME);
      intEdutorFontSize = preferenceStore.getInt(IPreferenceConstants.XLIFF_EDITOR_FONT_SIZE);
      strMatchViewFontName = preferenceStore.getString(IPreferenceConstants.MATCH_VIEW_FONT_NAME);
      intMatchViewFontSize = preferenceStore.getInt(IPreferenceConstants.MATCH_VIEW_FONT_SIZE);
    }
    if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_STARTUP) {
      btnCheckUpdateWithStartup.setSelection(true);
      btnCheckUpdateWithMonthly.setSelection(false);
      selectDateSpi.setEnabled(false);
      selectDateSpi.setSelection(1);
      btnCheckUpdateWithWeekly.setSelection(false);
      cmbSelectWeek.setEnabled(false);
      cmbSelectWeek.select(0);
      btnCheckUpdateWithNever.setSelection(false);
    } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY) {
      btnCheckUpdateWithStartup.setSelection(false);
      btnCheckUpdateWithMonthly.setSelection(true);
      btnCheckUpdateWithWeekly.setSelection(false);
      cmbSelectWeek.setEnabled(false);
      cmbSelectWeek.select(0);
      btnCheckUpdateWithNever.setSelection(false);
      int selDate;
      if (blnIsApplyDefault) {
        selDate =
            preferenceStore.getDefaultInt(
                IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE);
      } else {
        selDate =
            preferenceStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE);
      }
      selectDateSpi.setEnabled(true);
      selectDateSpi.setSelection(selDate);
    } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY) {
      btnCheckUpdateWithStartup.setSelection(false);
      btnCheckUpdateWithMonthly.setSelection(false);
      selectDateSpi.setEnabled(false);
      selectDateSpi.setSelection(1);
      btnCheckUpdateWithWeekly.setSelection(true);
      btnCheckUpdateWithNever.setSelection(false);
      int selWeek;
      if (blnIsApplyDefault) {
        selWeek =
            preferenceStore.getDefaultInt(
                IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE);
      } else {
        selWeek = preferenceStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE);
      }
      cmbSelectWeek.setEnabled(true);
      // ArrayList<String> list = new ArrayList<String>(Arrays.asList(arrWeek));
      cmbSelectWeek.select(selWeek - 1);
    } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_NEVER) {
      btnCheckUpdateWithStartup.setSelection(false);
      btnCheckUpdateWithMonthly.setSelection(false);
      selectDateSpi.setEnabled(false);
      btnCheckUpdateWithWeekly.setSelection(false);
      cmbSelectWeek.setEnabled(false);
      cmbSelectWeek.select(0);
      btnCheckUpdateWithNever.setSelection(true);
    }

    if (intLanguage == IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN) {
      btnLanguageWithEN.setSelection(true);
      btnLanguageWithZHCN.setSelection(false);
    } else if (intLanguage == IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN) {
      btnLanguageWithEN.setSelection(false);
      btnLanguageWithZHCN.setSelection(true);
    }
    txtSystemUser.setText(strSystemUser);
    editorFontSetting.initFont(strEditorFontName, intEdutorFontSize);
    matchViewFontSetting.initFont(strMatchViewFontName, intMatchViewFontSize);
  }
 /** @return plot name that playback uses */
 public String getPreferencePlaybackView() {
   IPreferenceStore preferenceStore = AnalysisRCPActivator.getDefault().getPreferenceStore();
   return preferenceStore.isDefault(PreferenceConstants.IMAGEEXPLORER_PLAYBACKVIEW)
       ? preferenceStore.getDefaultString(PreferenceConstants.IMAGEEXPLORER_PLAYBACKVIEW)
       : preferenceStore.getString(PreferenceConstants.IMAGEEXPLORER_PLAYBACKVIEW);
 }
 private String getPreferenceColourMapChoice() {
   IPreferenceStore preferenceStore = AnalysisRCPActivator.getDefault().getPreferenceStore();
   return preferenceStore.isDefault(PreferenceConstants.IMAGEEXPLORER_COLOURMAP)
       ? preferenceStore.getDefaultString(PreferenceConstants.IMAGEEXPLORER_COLOURMAP)
       : preferenceStore.getString(PreferenceConstants.IMAGEEXPLORER_COLOURMAP);
 }
Esempio n. 13
0
  /** @see IDialogPage#createControl(Composite) */
  @Override
  public void createControl(Composite parent) {

    // Set up the composite to hold all the information
    sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    sc.setLayout(new FillLayout());

    final Composite composite = new Composite(sc, SWT.NULL);
    composite.setLocation(-708, 1);
    composite.setLayout(new GridLayout(2, false));

    // Specify the expansion Adapter
    expansionAdapter =
        new ExpansionAdapter() {
          @Override
          public void expansionStateChanged(ExpansionEvent e) {
            // advanced options expanded, resize
            composite.layout();
            sc.notifyListeners(SWT.Resize, null);

            // force shell resize
            Point size;
            if (e.getState()) size = getShell().computeSize(550, 920);
            else size = getShell().computeSize(550, 400);

            getShell().setSize(size);
          }
        };

    Label lblNewLabel = new Label(composite, SWT.NONE);
    lblNewLabel.setText("&ICAT site ID");

    icatIDCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
    GridData gd_icatIDCombo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_icatIDCombo.widthHint = 269;
    icatIDCombo.setLayoutData(gd_icatIDCombo);
    icatIDCombo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            logger.debug("selection changed: " + icatIDCombo.getText());

            // change remaining parameters
            int index = icatIDCombo.getSelectionIndex();
            icatSiteNameText.setText(
                getToken(index, preferenceStore.getString("ICAT_NAME_PREF"), DELIMITER));
            txtSftpServer.setText(
                getToken(index, preferenceStore.getString("ICAT_SFTPSERVER_PREF"), DELIMITER));
            txtDirectory.setText(
                getToken(index, preferenceStore.getString("ICAT_DOWNLOADDIR_PREF"), DELIMITER));
          }
        });

    /*
     * populate wizard with current ICAT preferences
     */
    icatIDCombo.removeAll();

    String[] tokens = preferenceStore.getDefaultString("ICAT_ID_PREF").split(DELIMITER);

    for (int count = 0; count < tokens.length; count++) {
      icatIDCombo.add(tokens[count]);
    }
    icatIDCombo.select(0);

    int index = icatIDCombo.getSelectionIndex();

    Label lblicatDatabase = new Label(composite, SWT.NONE);
    lblicatDatabase.setText("&ICAT site name:");

    icatSiteNameText = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
    GridData gd_icatSiteNameText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_icatSiteNameText.widthHint = 260;
    icatSiteNameText.setLayoutData(gd_icatSiteNameText);
    icatSiteNameText.setEditable(false);
    icatSiteNameText.setText(
        getToken(index, preferenceStore.getString("ICAT_NAME_PREF"), DELIMITER));
    icatSiteNameText.setBounds(113, 53, 212, 27);

    Label fedidLbl = new Label(composite, SWT.NONE);
    fedidLbl.setText("&FedId:");

    txtFedid = new Text(composite, SWT.BORDER);
    GridData gd_txtFedid = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtFedid.widthHint = 260;
    txtFedid.setLayoutData(gd_txtFedid);
    txtFedid.setText(initFedid);
    txtFedid.addKeyListener(this);

    Label passwordLbl = new Label(composite, SWT.NONE);
    passwordLbl.setBounds(4, 139, 64, 13);
    passwordLbl.setText("&Password:"******"&Project name:");
    txtProject = new Text(composite, SWT.BORDER);
    GridData gd_txtProject = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtProject.widthHint = 260;
    txtProject.setLayoutData(gd_txtProject);
    txtProject.setBounds(113, 173, 212, 27);
    txtProject.setText(initProject);
    txtProject.addKeyListener(this);
    sc.setContent(composite);
    sc.setExpandVertical(true);
    sc.setExpandHorizontal(true);

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);

    /** set-up advanced options GUI elements */
    advancedOptionsExpander = new ExpandableComposite(composite, SWT.NONE);
    GridData gd_advancedOptionsExpander = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_advancedOptionsExpander.widthHint = 242;
    advancedOptionsExpander.setLayoutData(gd_advancedOptionsExpander);
    advancedOptionsExpander.setLayout(new GridLayout(2, false));
    advancedOptionsExpander.setText("Advanced Options");
    advancedOptionsExpander.setExpanded(false);

    Composite optionsComposite = new Composite(advancedOptionsExpander, SWT.NONE);
    optionsComposite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    optionsComposite.setLayout(new GridLayout(3, false));

    Label sftpServerLbl = new Label(optionsComposite, SWT.NONE);
    sftpServerLbl.setText("&SFTP server:");

    txtSftpServer = new Text(optionsComposite, SWT.BORDER);
    GridData gd_txtSftpServer = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtSftpServer.widthHint = 193;
    txtSftpServer.setLayoutData(gd_txtSftpServer);
    txtSftpServer.setEditable(true);
    txtSftpServer.setText(
        getToken(index, preferenceStore.getString("ICAT_SFTPSERVER_PREF"), DELIMITER));

    final Button btnSftpTest = new Button(optionsComposite, SWT.NONE);
    GridData gd_btnSftpTest = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnSftpTest.widthHint = 100;
    btnSftpTest.setLayoutData(gd_btnSftpTest);
    btnSftpTest.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            /*
             * test server using ping
             */
            if (NetworkUtils.isReachable(txtSftpServer.getText())) {
              Image okImage = (ResourceManager.getPluginImage(ICAT_PLUGIN_ID, "icons/ok.png"));
              ;
              btnSftpTest.setImage(okImage);
            } else {
              Image noImage = (ResourceManager.getPluginImage(ICAT_PLUGIN_ID, "icons/no.png"));
              ;
              btnSftpTest.setImage(noImage);
            }
          }
        });
    btnSftpTest.setText("Test");

    txtSftpServer.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            btnSftpTest.setImage(null);
          }
        });

    Label lbldownloadDirectory = new Label(optionsComposite, SWT.NULL);
    lbldownloadDirectory.setText("&Download directory:");

    txtDirectory = new Text(optionsComposite, SWT.BORDER);
    GridData gd_txtDirectory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtDirectory.widthHint = 193;
    txtDirectory.setLayoutData(gd_txtDirectory);
    txtDirectory.setEditable(true);
    txtDirectory.setEnabled(true);

    txtDirectory.setText(
        getToken(index, preferenceStore.getString("ICAT_DOWNLOADDIR_PREF"), DELIMITER));

    Button BtnBrowseDirectory = new Button(optionsComposite, SWT.PUSH);
    GridData gd_BtnBrowseDirectory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_BtnBrowseDirectory.widthHint = 100;
    BtnBrowseDirectory.setLayoutData(gd_BtnBrowseDirectory);
    BtnBrowseDirectory.setText("Browse...");
    BtnBrowseDirectory.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleDownloadDirBrowse();
          }
        });

    Label lbltruststorePath = new Label(optionsComposite, SWT.NONE);
    lbltruststorePath.setBounds(10, 131, 103, 19);
    lbltruststorePath.setText("&Truststore path:");

    txtTruststore = new Text(optionsComposite, SWT.BORDER);
    txtTruststore.setText(
        getToken(index, preferenceStore.getString("ICAT_TRUSTSTORE_PATH_PREF"), DELIMITER));
    GridData gd_txtTruststore = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtTruststore.widthHint = 193;
    txtTruststore.setLayoutData(gd_txtTruststore);
    txtTruststore.setEnabled(true);
    txtTruststore.setEditable(true);

    Button BtnBrowseTruststore = new Button(optionsComposite, SWT.PUSH);
    GridData gd_BtnBrowseTruststore = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_BtnBrowseTruststore.widthHint = 100;
    BtnBrowseTruststore.setLayoutData(gd_BtnBrowseTruststore);
    BtnBrowseTruststore.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleTruststoreBrowse();
          }
        });
    BtnBrowseTruststore.setText("Browse...");

    Label lbltruststorePassword = new Label(optionsComposite, SWT.NONE);
    lbltruststorePassword.setText("&Truststore password:"******"ICAT_TRUSTSTORE_PASS_PREF"), DELIMITER));
    GridData gd_txtTruststorePassword = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtTruststorePassword.widthHint = 193;
    txtTruststorePassword.setLayoutData(gd_txtTruststorePassword);
    txtTruststorePassword.setEnabled(true);
    txtTruststorePassword.addKeyListener(this);

    final Button btnShowPassword = new Button(optionsComposite, SWT.CHECK);
    btnShowPassword.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (btnShowPassword.getSelection()) {
              txtTruststorePassword.setEchoChar((char) 0);
            } else {
              txtTruststorePassword.setEchoChar('*');
            }
          }
        });
    btnShowPassword.setText("Show password");

    // set default FROM date to current date
    Calendar calA = Calendar.getInstance();

    Label lblFrom = new Label(optionsComposite, SWT.TOP);
    lblFrom.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblFrom.setText("Visit StartDate from:");
    dateFrom = new DateTime(optionsComposite, SWT.NONE | SWT.CALENDAR | SWT.DROP_DOWN);
    dateFrom.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_FOREGROUND));
    dateFrom.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    GridData gd_dateFrom = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dateFrom.widthHint = 193;
    dateFrom.setLayoutData(gd_dateFrom);
    dateFrom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // set from date
            setSqlFromDate(dateFrom);
          }
        });

    dateFrom.setYear(2006); // calA.get(Calendar.YEAR));
    dateFrom.setMonth(calA.get(Calendar.MONTH));
    dateFrom.setDay(calA.get(Calendar.DAY_OF_YEAR));
    setSqlFromDate(dateFrom);

    Label lblTo = new Label(optionsComposite, SWT.TOP);
    lblTo.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblTo.setText("Visit StartDate to:");
    dateTo = new DateTime(optionsComposite, SWT.NONE | SWT.CALENDAR | SWT.DROP_DOWN);
    dateTo.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    dateTo.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_FOREGROUND));
    GridData gd_dateTo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dateTo.widthHint = 193;
    dateTo.setLayoutData(gd_dateTo);
    dateTo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // set to date
            setSqlToDate(dateTo);
          }
        });
    // end with current date + 1 month
    dateTo.setYear(calA.get(Calendar.YEAR));
    dateTo.setMonth(calA.get(Calendar.MONTH) + 1);
    dateTo.setDay(calA.get(Calendar.DAY_OF_YEAR));
    setSqlToDate(dateTo);

    advancedOptionsExpander.setClient(optionsComposite);
    new Label(optionsComposite, SWT.NONE);
    new Label(optionsComposite, SWT.NONE);
    new Label(optionsComposite, SWT.NONE);
    advancedOptionsExpander.addExpansionListener(expansionAdapter);
    setControl(composite);

    dialogChanged();

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
  }
  /** The constructor. */
  public ValidateImpexAction() {

    final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    final String hostName = store.getDefaultString(PreferenceConstants.P_HOST_ENDPOINT_STRING);
    this.impexClient = new ImpexHttpClient(hostName);
  }
  @Override
  protected Control createContents(Composite parent) {

    // Overall preference page layout
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    parent.setLayout(gl);
    fPage = new Composite(parent, SWT.NONE);
    fPage.setLayout(new GridLayout());
    fPage.setLayoutData(
        new GridData(
            GridData.GRAB_HORIZONTAL
                | GridData.HORIZONTAL_ALIGN_FILL
                | GridData.GRAB_VERTICAL
                | GridData.VERTICAL_ALIGN_FILL));

    // Example section
    fExampleSection = new Composite(fPage, SWT.NONE);
    fExampleSection.setLayout(new GridLayout(2, false));
    fExampleSection.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label patternLabel = new Label(fExampleSection, SWT.HORIZONTAL);
    patternLabel.setText("Current Format: "); // $NON-NLS-1$
    fPatternDisplay = new Text(fExampleSection, SWT.BORDER | SWT.READ_ONLY);
    fPatternDisplay.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label exampleLabel = new Label(fExampleSection, SWT.NONE);
    exampleLabel.setText("Sample Display: "); // $NON-NLS-1$
    fExampleDisplay = new Text(fExampleSection, SWT.BORDER | SWT.READ_ONLY);
    fExampleDisplay.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label separator = new Label(fPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    separator.setLayoutData(
        new GridData(
            GridData.HORIZONTAL_ALIGN_FILL
                | GridData.GRAB_HORIZONTAL
                | GridData.VERTICAL_ALIGN_FILL));

    // Time Zones
    String[][] timeZoneIntervals = new String[timeZones.length][2];
    timeZoneIntervals[0][0] = timeZones[0];
    timeZoneIntervals[0][1] =
        fPreferenceStore.getDefaultString(ITmfTimePreferencesConstants.TIME_ZONE);
    for (int i = 1; i < timeZones.length; i++) {
      TimeZone tz = null;
      try {
        tz = TimeZone.getTimeZone(timeZones[i]);
        timeZoneIntervals[i][0] = tz.getDisplayName();
        timeZoneIntervals[i][1] = tz.getID();
      } catch (NullPointerException e) {
        Activator.getDefault()
            .logError(
                "TimeZone " + timeZones[i] + " does not exist.", e); // $NON-NLS-1$ //$NON-NLS-2$
      }
    }

    fCombo =
        new ComboFieldEditor(
            ITmfTimePreferencesConstants.TIME_ZONE,
            "Time Zone",
            timeZoneIntervals,
            fPage); //$NON-NLS-1$
    fCombo.setPreferenceStore(fPreferenceStore);
    fCombo.load();
    fCombo.setPropertyChangeListener(this);

    // Date and Time section
    fDateTimeFields =
        new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.DATIME,
            "Date and Time format",
            3,
            fDateTimeFormats,
            fPage,
            true); //$NON-NLS-1$
    fDateTimeFields.setPreferenceStore(fPreferenceStore);
    fDateTimeFields.load();
    fDateTimeFields.setPropertyChangeListener(this);

    // Sub-second section
    fSSecFields =
        new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.SUBSEC,
            "Sub-second format",
            3,
            fSubSecondFormats,
            fPage,
            true); //$NON-NLS-1$
    fSSecFields.setPreferenceStore(fPreferenceStore);
    fSSecFields.load();
    fSSecFields.setPropertyChangeListener(this);

    // Separators section
    fDateFieldDelim =
        new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.DATE_DELIMITER,
            "Date delimiter",
            5,
            fDateTimeDelimiters,
            fPage,
            true); //$NON-NLS-1$
    fDateFieldDelim.setPreferenceStore(fPreferenceStore);
    fDateFieldDelim.load();
    fDateFieldDelim.setPropertyChangeListener(this);

    fTimeFieldDelim =
        new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.TIME_DELIMITER,
            "Time delimiter",
            5,
            fDateTimeDelimiters,
            fPage,
            true); //$NON-NLS-1$
    fTimeFieldDelim.setPreferenceStore(fPreferenceStore);
    fTimeFieldDelim.load();
    fTimeFieldDelim.setPropertyChangeListener(this);

    fSSecFieldDelim =
        new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.SSEC_DELIMITER,
            "Sub-Second Delimiter",
            5,
            fSubSecondDelimiters,
            fPage,
            true); //$NON-NLS-1$
    fSSecFieldDelim.setPreferenceStore(fPreferenceStore);
    fSSecFieldDelim.load();
    fSSecFieldDelim.setPropertyChangeListener(this);

    refresh();
    return fPage;
  }