コード例 #1
0
  private void fillLanguageDropDown() {
    Locale guiLocale = Settings.getInstance().getLanguage();
    DisplayLocale currentSortLocale =
        new DisplayLocale(new WbLocale(Settings.getInstance().getSortLocale()));

    Locale[] locales = readLocales();

    localeDropDown.removeAllItems();
    localeDropDown.addItem(new DisplayLocale(null));

    int index = 1; // 1 because we have already added a locale
    int currentIndex = -1;

    for (Locale ls : locales) {
      DisplayLocale wl = new DisplayLocale(new WbLocale(ls));
      wl.setDisplayLocale(guiLocale);
      localeDropDown.addItem(wl);
      if (wl.equals(currentSortLocale)) currentIndex = index;
      index++;
    }

    if (currentIndex != -1) {
      localeDropDown.setSelectedIndex(currentIndex);
    }
  }
コード例 #2
0
 @Override
 public void saveSettings() {
   int value = StringUtil.getIntValue(multiLineThreshold.getText(), -1);
   if (value > 0) GuiSettings.setMultiLineThreshold(value);
   GuiSettings.setAllowRowHeightResizing(rowHeightResize.isSelected());
   GuiSettings.setMaxColumnWidth(((NumberField) this.maxColSizeField).getValue());
   GuiSettings.setMinColumnWidth(((NumberField) this.minColSizeField).getValue());
   GuiSettings.setAutomaticOptimalWidth(autoColWidth.isSelected());
   GuiSettings.setIncludeHeaderInOptimalWidth(includeHeaderWidth.isSelected());
   GuiSettings.setAutomaticOptimalRowHeight(autoRowHeight.isSelected());
   GuiSettings.setAutRowHeightMaxLines(((NumberField) this.maxRowHeight).getValue());
   GuiSettings.setIgnoreWhitespaceForAutoRowHeight(ignoreEmptyRows.isSelected());
   GuiSettings.setShowSelectionSummary(selectSummary.isSelected());
   GuiSettings.setDefaultMaxRows(StringUtil.getIntValue(defMaxRows.getText(), 0));
   GuiSettings.setRetrieveQueryComments(retrieveComments.isSelected());
   GuiSettings.setShowTableRowNumbers(showRowNumbers.isSelected());
   GuiSettings.setShowMaxRowsReached(showMaxRowsWarn.isSelected());
   GuiSettings.setDisplayNullString(nullString.getText());
   GuiSettings.setShowResultSQL(showGeneratingSQL.isSelected());
   GuiSettings.setShowTableHeaderInBold(boldHeader.isSelected());
   GuiSettings.setWrapMultilineEditor(wrapMultlineEdit.isSelected());
   GuiSettings.setWrapMultilineRenderer(wrapMultineRender.isSelected());
   GuiSettings.setShowMaxRowsTooltip(showMaxRowsTooltip.isSelected());
   GuiSettings.setDefaultAppendResults(appendResults.isSelected());
   GuiSettings.setUseTablenameAsResultName(useTableName.isSelected());
   DisplayLocale dl = (DisplayLocale) localeDropDown.getSelectedItem();
   Settings.getInstance().setSortLocale(dl.getLocale());
   if (alignmentDropDown.getSelectedIndex() == 1) {
     GuiSettings.setNumberDataAlignment("left");
   } else {
     GuiSettings.setNumberDataAlignment("right");
   }
 }