Move option for auto-reloading script dependencies to 'Kotlin Scripting' page
This commit is contained in:
+5
-13
@@ -150,7 +150,7 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="483d4" binding="scriptPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="483d4" binding="scriptPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="9" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="true"/>
|
||||
@@ -165,7 +165,7 @@
|
||||
<children>
|
||||
<component id="71c3f" class="javax.swing.JTextField" binding="scriptTemplatesField">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -173,7 +173,7 @@
|
||||
</component>
|
||||
<component id="56390" class="javax.swing.JLabel" binding="scriptTemplatesClasspathLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<labelFor value="644d9"/>
|
||||
@@ -182,23 +182,15 @@
|
||||
</component>
|
||||
<component id="644d9" class="javax.swing.JTextField" binding="scriptTemplatesClasspathField">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="9b5f1" class="javax.swing.JCheckBox" binding="scriptDependenciesAutoReload">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Reload script dependencies on file change"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ae60b" class="javax.swing.JLabel" binding="scriptTemplatesLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="true"/>
|
||||
|
||||
-11
@@ -37,7 +37,6 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants;
|
||||
import org.jetbrains.kotlin.config.*;
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle;
|
||||
import org.jetbrains.kotlin.idea.PluginStartupComponent;
|
||||
import org.jetbrains.kotlin.idea.core.script.settings.KotlinScriptingSettings;
|
||||
import org.jetbrains.kotlin.idea.facet.DescriptionListCellRenderer;
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet;
|
||||
import org.jetbrains.kotlin.idea.roots.RootUtilsKt;
|
||||
@@ -95,7 +94,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
private JCheckBox enableIncrementalCompilationForJvmCheckBox;
|
||||
private JCheckBox enableIncrementalCompilationForJsCheckBox;
|
||||
private JComboBox moduleKindComboBox;
|
||||
private JCheckBox scriptDependenciesAutoReload;
|
||||
private JTextField scriptTemplatesField;
|
||||
private JTextField scriptTemplatesClasspathField;
|
||||
private JLabel scriptTemplatesLabel;
|
||||
@@ -443,7 +441,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
!getSelectedAPIVersionView().equals(KotlinFacetSettingsKt.getApiVersionView(commonCompilerArguments)) ||
|
||||
!getSelectedCoroutineState().equals(commonCompilerArguments.getCoroutinesState()) ||
|
||||
!additionalArgsOptionsField.getText().equals(compilerSettings.getAdditionalArguments()) ||
|
||||
isModified(scriptDependenciesAutoReload, getScriptingSettings().isAutoReloadEnabled()) ||
|
||||
isModified(scriptTemplatesField, compilerSettings.getScriptTemplates()) ||
|
||||
isModified(scriptTemplatesClasspathField, compilerSettings.getScriptTemplatesClasspath()) ||
|
||||
isModified(copyRuntimeFilesCheckBox, compilerSettings.getCopyJsLibraryFiles()) ||
|
||||
@@ -544,8 +541,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
compilerSettings.setCopyJsLibraryFiles(copyRuntimeFilesCheckBox.isSelected());
|
||||
compilerSettings.setOutputDirectoryForJsLibraryFiles(outputDirectory.getText());
|
||||
|
||||
getScriptingSettings().setAutoReloadEnabled(scriptDependenciesAutoReload.isSelected());
|
||||
|
||||
if (compilerWorkspaceSettings != null) {
|
||||
compilerWorkspaceSettings.setPreciseIncrementalEnabled(enableIncrementalCompilationForJvmCheckBox.isSelected());
|
||||
compilerWorkspaceSettings.setIncrementalCompilationForJsEnabled(enableIncrementalCompilationForJsCheckBox.isSelected());
|
||||
@@ -592,7 +587,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
apiVersionComboBox.setSelectedItem(KotlinFacetSettingsKt.getApiVersionView(commonCompilerArguments));
|
||||
coroutineSupportComboBox.setSelectedItem(CoroutineSupport.byCompilerArguments(commonCompilerArguments));
|
||||
additionalArgsOptionsField.setText(compilerSettings.getAdditionalArguments());
|
||||
scriptDependenciesAutoReload.setSelected(getScriptingSettings().isAutoReloadEnabled());
|
||||
scriptTemplatesField.setText(compilerSettings.getScriptTemplates());
|
||||
scriptTemplatesClasspathField.setText(compilerSettings.getScriptTemplatesClasspath());
|
||||
copyRuntimeFilesCheckBox.setSelected(compilerSettings.getCopyJsLibraryFiles());
|
||||
@@ -729,11 +723,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
this.compilerSettings = compilerSettings;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private KotlinScriptingSettings getScriptingSettings() {
|
||||
return KotlinScriptingSettings.Companion.getInstance(project);
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
// Workaround: ThreeStateCheckBox doesn't send suitable notification on state change
|
||||
// TODO: replace with PropertyChangerListener after fix is available in IDEA
|
||||
|
||||
+21
-17
@@ -8,7 +8,7 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="6126a" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="6126a" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -18,41 +18,45 @@
|
||||
<children>
|
||||
<vspacer id="7a19">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="b9ce9" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="b9ce9" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<clientProperties>
|
||||
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
|
||||
</clientProperties>
|
||||
<border type="etched" title="Script definitions" noi18n="true"/>
|
||||
<border type="etched" title="Manage script definitions" noi18n="true"/>
|
||||
<children>
|
||||
<grid id="5ec35" binding="panelScriptDefinitionsChooser" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
<children>
|
||||
<vspacer id="a58a1">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="9988" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<componentStyle value="SMALL"/>
|
||||
<fontColor value="BRIGHTER"/>
|
||||
<text value="Manage script definitions" noi18n="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="cc285" class="javax.swing.JCheckBox" binding="scriptDependenciesAutoReload">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Reload script dependencies on file change"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
|
||||
+11
-2
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionsManager;
|
||||
import org.jetbrains.kotlin.idea.core.script.settings.KotlinScriptingSettings;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -21,13 +22,16 @@ import java.awt.*;
|
||||
public class KotlinScriptingSettingsConfigurable implements SearchableConfigurable, Configurable.NoScroll {
|
||||
private JPanel root;
|
||||
private JPanel panelScriptDefinitionsChooser;
|
||||
private JCheckBox scriptDependenciesAutoReload;
|
||||
|
||||
private KotlinScriptDefinitionsModel model;
|
||||
|
||||
private final ScriptDefinitionsManager manager;
|
||||
private final KotlinScriptingSettings settings;
|
||||
|
||||
public KotlinScriptingSettingsConfigurable(Project project) {
|
||||
manager = ScriptDefinitionsManager.Companion.getInstance(project);
|
||||
settings = KotlinScriptingSettings.Companion.getInstance(project);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -48,20 +52,25 @@ public class KotlinScriptingSettingsConfigurable implements SearchableConfigurab
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return !model.getItems().equals(manager.getAllDefinitions());
|
||||
return isModified(scriptDependenciesAutoReload, settings.isAutoReloadEnabled())
|
||||
|| !model.getItems().equals(manager.getAllDefinitions());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
settings.setAutoReloadEnabled(scriptDependenciesAutoReload.isSelected());
|
||||
|
||||
|
||||
// todo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
scriptDependenciesAutoReload.setSelected(settings.isAutoReloadEnabled());
|
||||
|
||||
// todo
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Nls
|
||||
public String getDisplayName() {
|
||||
|
||||
Reference in New Issue
Block a user