List of usage examples for com.intellij.openapi.options SettingsEditor getSnapshot
@NotNull public Settings getSnapshot() throws ConfigurationException
From source file:com.intellij.execution.impl.RunConfigurable.java
License:Apache License
private void installUpdateListeners(final SingleConfigurationConfigurable<RunConfiguration> info) { final boolean[] changed = new boolean[] { false }; info.getEditor().addSettingsEditorListener(new SettingsEditorListener<RunnerAndConfigurationSettings>() { @Override/* ww w. j a v a 2 s. c o m*/ public void stateChanged(final SettingsEditor<RunnerAndConfigurationSettings> editor) { update(); final RunConfiguration configuration = info.getConfiguration(); if (configuration instanceof LocatableConfiguration) { final LocatableConfiguration runtimeConfiguration = (LocatableConfiguration) configuration; if (runtimeConfiguration.isGeneratedName() && !changed[0]) { try { final LocatableConfiguration snapshot = (LocatableConfiguration) editor.getSnapshot() .getConfiguration(); final String generatedName = snapshot.suggestedName(); if (generatedName != null && generatedName.length() > 0) { info.setNameText(generatedName); changed[0] = false; } } catch (ConfigurationException ignore) { } } } setupDialogBounds(); } }); info.addNameListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { changed[0] = true; update(); } }); info.addSharedListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { changed[0] = true; update(); } }); }
From source file:com.intellij.execution.impl.SingleConfigurationConfigurable.java
License:Apache License
public RunnerAndConfigurationSettings getSnapshot() throws ConfigurationException { final SettingsEditor<RunnerAndConfigurationSettings> editor = getEditor(); return editor == null ? null : editor.getSnapshot(); }