public void apply(CodeStyleSettings settings) {
    stopTableEditing();

    settings.LAYOUT_STATIC_IMPORTS_SEPARATELY = myImportLayoutPanel.areStaticImportsEnabled();
    settings.USE_FQ_CLASS_NAMES = myCbUseFQClassNames.isSelected();
    settings.USE_SINGLE_CLASS_IMPORTS = myCbUseSingleClassImports.isSelected();
    settings.INSERT_INNER_CLASS_IMPORTS = myCbInsertInnerClassImports.isSelected();
    try {
      settings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND = Integer.parseInt(myClassCountField.getText());
    } catch (NumberFormatException e) {
      // just a bad number
    }
    try {
      settings.NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND = Integer.parseInt(myNamesCountField.getText());
    } catch (NumberFormatException e) {
      // just a bad number
    }

    final PackageEntryTable list = myImportLayoutPanel.getImportLayoutList();
    list.removeEmptyPackages();
    settings.IMPORT_LAYOUT_TABLE.copyFrom(list);

    myPackageList.removeEmptyPackages();
    settings.PACKAGES_TO_USE_IMPORT_ON_DEMAND.copyFrom(myPackageList);

    myFqnInJavadocOption.apply(settings);
  }
 private static boolean isModified(JTextField textField, int value) {
   try {
     int fieldValue = Integer.parseInt(textField.getText().trim());
     return fieldValue != value;
   } catch (NumberFormatException e) {
     return false;
   }
 }
Пример #3
0
 @Override
 public boolean stopCellEditing() {
   if (myValue != null) {
     if (myValue.isBoolean()) {
       myValue.setValue(myCheckBox.isSelected());
     } else {
       myValue.setValue(myField.getText().trim());
     }
   }
   revaliateActions();
   return super.stopCellEditing();
 }
 private void updateCurrentRule() {
   if (myLastSelected >= 0 && myLastSelected < myRulesModel.getSize()) {
     LibraryBundlificationRule newRule = new LibraryBundlificationRule();
     newRule.setRuleRegex(myLibraryRegex.getText().trim());
     newRule.setAdditionalProperties(myManifestEditor.getText().trim());
     newRule.setDoNotBundle(myNeverBundle.isSelected());
     newRule.setStopAfterThisRule(myStopAfterThisRule.isSelected());
     if (!newRule.equals(myRulesModel.getElementAt(myLastSelected))) {
       myRulesModel.setElementAt(newRule, myLastSelected);
     }
   }
 }
 @Override
 public JComponent getPreferredFocusedComponent() {
   if (myNameField.getText().length() == 0) {
     return myNameField;
   } else if (myValueField.isVisible()) {
     return myValueField;
   } else if (myModuleCombo.isVisible()) {
     return myModuleCombo;
   } else {
     return myFileNameCombo;
   }
 }
Пример #6
0
 private static void setupSelectionOnPreferredComponent(final JComponent component) {
   if (component instanceof JTextField) {
     JTextField field = (JTextField) component;
     String text = field.getText();
     if (text != null && field.getClientProperty(HAVE_INITIAL_SELECTION) == null) {
       field.setSelectionStart(0);
       field.setSelectionEnd(text.length());
     }
   } else if (component instanceof JComboBox) {
     JComboBox combobox = (JComboBox) component;
     combobox.getEditor().selectAll();
   }
 }
 @NotNull
 public String getValue() {
   return myValueField.getText().trim();
 }
 @NotNull
 public String getName() {
   return myNameField.getText().trim();
 }
 private String getBaseName() {
   return myResourceBundle == null
       ? myResourceBundleBaseNameTextField.getText()
       : myResourceBundle.getBaseName();
 }