private void updateFields() { int index = myRulesList.getSelectedIndex(); if (index >= 0 && index != myLastSelected) { final LibraryBundlificationRule rule = myRulesModel.getElementAt(index); myLibraryRegex.setText(rule.getRuleRegex()); UIUtil.invokeLaterIfNeeded(() -> myManifestEditor.setText(rule.getAdditionalProperties())); myNeverBundle.setSelected(rule.isDoNotBundle()); myStopAfterThisRule.setSelected(rule.isStopAfterThisRule()); myLastSelected = index; } myLibraryRegex.setEnabled(index >= 0); myManifestEditor.setEnabled(index >= 0); myNeverBundle.setEnabled(index >= 0); myStopAfterThisRule.setEnabled(index >= 0); }
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); } } }