config: Save textareas on debounce instead of on focus lost (#1317)
This commit is contained in:
@@ -852,27 +852,25 @@ public class ConfigPanel extends PluginPanel
|
|||||||
textField.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
textField.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||||
textField.setText(configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName()));
|
textField.setText(configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName()));
|
||||||
|
|
||||||
textField.addFocusListener(new FocusAdapter()
|
DeferredDocumentChangedListener listener = new DeferredDocumentChangedListener();
|
||||||
|
listener.addChangeListener(e ->
|
||||||
{
|
{
|
||||||
@Override
|
ConfigItem configItem = cid.getItem();
|
||||||
public void focusLost(FocusEvent e)
|
if (configItem.parse())
|
||||||
{
|
{
|
||||||
ConfigItem item = cid.getItem();
|
Boolean result = parse(configItem, textField.getText());
|
||||||
if (item.parse())
|
|
||||||
{
|
|
||||||
Boolean result = parse(item, textField.getText());
|
|
||||||
|
|
||||||
if (result != null && result)
|
if (result != null && result)
|
||||||
{
|
|
||||||
changeConfiguration(listItem, config, textField, cd, cid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
changeConfiguration(listItem, config, textField, cd, cid);
|
changeConfiguration(listItem, config, textField, cd, cid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
changeConfiguration(listItem, config, textField, cd, cid);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
textField.getDocument().addDocumentListener(listener);
|
||||||
|
|
||||||
if (cid.getItem().parse())
|
if (cid.getItem().parse())
|
||||||
{
|
{
|
||||||
@@ -880,7 +878,7 @@ public class ConfigPanel extends PluginPanel
|
|||||||
parsingLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
parsingLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
parsingLabel.setPreferredSize(new Dimension(PANEL_WIDTH, 15));
|
parsingLabel.setPreferredSize(new Dimension(PANEL_WIDTH, 15));
|
||||||
|
|
||||||
DeferredDocumentChangedListener listener = new DeferredDocumentChangedListener();
|
listener = new DeferredDocumentChangedListener();
|
||||||
listener.addChangeListener(e ->
|
listener.addChangeListener(e ->
|
||||||
{
|
{
|
||||||
if (cid.getItem().parse())
|
if (cid.getItem().parse())
|
||||||
|
|||||||
Reference in New Issue
Block a user