mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-98563 "Allow running in parallel" for template run configuration
This commit is contained in:
+13
-5
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.impl.ConfigurationSettingsEditorWrapper">
|
||||
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="5" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="124" y="274" width="276" height="150"/>
|
||||
@@ -11,7 +11,7 @@
|
||||
<grid id="c4b52" binding="myComponentPlace" 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/>
|
||||
<border type="none"/>
|
||||
@@ -19,7 +19,7 @@
|
||||
</grid>
|
||||
<grid id="d489d" binding="myBeforeLaunchContainer" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="2" 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="3" 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>
|
||||
@@ -30,7 +30,7 @@
|
||||
</grid>
|
||||
<vspacer id="6092a">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="-1" height="10"/>
|
||||
<preferred-size width="-1" height="10"/>
|
||||
<maximum-size width="-1" height="10"/>
|
||||
@@ -39,9 +39,17 @@
|
||||
</vspacer>
|
||||
<vspacer id="5c515">
|
||||
<constraints>
|
||||
<grid row="3" 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="4" 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>
|
||||
<component id="b3c0d" class="com.intellij.ui.components.JBCheckBox" binding="myIsAllowRunningInParallelCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ExecutionBundle" key="run.configuration.allow.running.parallel"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
+18
-11
@@ -13,6 +13,7 @@ import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.ui.HideableDecorator;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -30,6 +31,7 @@ public class ConfigurationSettingsEditorWrapper extends SettingsEditor<RunnerAnd
|
||||
private JPanel myWholePanel;
|
||||
|
||||
private JPanel myBeforeLaunchContainer;
|
||||
private JBCheckBox myIsAllowRunningInParallelCheckBox;
|
||||
private final BeforeRunStepsPanel myBeforeRunStepsPanel;
|
||||
|
||||
private final ConfigurationSettingsEditor myEditor;
|
||||
@@ -72,6 +74,9 @@ public class ConfigurationSettingsEditorWrapper extends SettingsEditor<RunnerAnd
|
||||
private void doReset(@NotNull RunnerAndConfigurationSettings settings) {
|
||||
myBeforeRunStepsPanel.doReset(settings);
|
||||
myBeforeLaunchContainer.setVisible(!(settings.getConfiguration() instanceof WithoutOwnBeforeRunSteps));
|
||||
|
||||
myIsAllowRunningInParallelCheckBox.setSelected(settings.getConfiguration().isAllowRunningInParallel());
|
||||
myIsAllowRunningInParallelCheckBox.setVisible(settings.isTemplate() && settings.getFactory().getSingletonPolicy().isPolicyConfigurable());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,37 +102,39 @@ public class ConfigurationSettingsEditorWrapper extends SettingsEditor<RunnerAnd
|
||||
@Override
|
||||
public void applyEditorTo(@NotNull final RunnerAndConfigurationSettings settings) throws ConfigurationException {
|
||||
myEditor.applyEditorTo(settings);
|
||||
doApply(settings, false);
|
||||
doApply((RunnerAndConfigurationSettingsImpl)settings, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RunnerAndConfigurationSettings getSnapshot() throws ConfigurationException {
|
||||
RunnerAndConfigurationSettings result = myEditor.getSnapshot();
|
||||
doApply(result, true);
|
||||
doApply((RunnerAndConfigurationSettingsImpl)result, true);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void doApply(@NotNull RunnerAndConfigurationSettings settings, boolean isSnapshot) {
|
||||
private void doApply(@NotNull RunnerAndConfigurationSettingsImpl settings, boolean isSnapshot) {
|
||||
final RunConfiguration runConfiguration = settings.getConfiguration();
|
||||
final RunManagerImpl runManager = ((RunnerAndConfigurationSettingsImpl)settings).getManager();
|
||||
|
||||
List<BeforeRunTask<?>> tasks = ContainerUtil.copyList(myBeforeRunStepsPanel.getTasks());
|
||||
RunnerAndConfigurationSettings settingsToApply = null;
|
||||
if (isSnapshot) {
|
||||
runConfiguration.setBeforeRunTasks(tasks);
|
||||
}
|
||||
else {
|
||||
RunManagerImpl runManager = settings.getManager();
|
||||
runManager.setBeforeRunTasks(runConfiguration, tasks);
|
||||
settingsToApply = runManager.getSettings(runConfiguration);
|
||||
}
|
||||
|
||||
RunnerAndConfigurationSettings runManagerSettings = runManager.getSettings(runConfiguration);
|
||||
if (runManagerSettings != null) {
|
||||
runManagerSettings.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun());
|
||||
runManagerSettings.setActivateToolWindowBeforeRun(myBeforeRunStepsPanel.needActivateToolWindowBeforeRun());
|
||||
if (settingsToApply == null) {
|
||||
settingsToApply = settings;
|
||||
}
|
||||
else {
|
||||
settings.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun());
|
||||
settings.setActivateToolWindowBeforeRun(myBeforeRunStepsPanel.needActivateToolWindowBeforeRun());
|
||||
|
||||
settingsToApply.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun());
|
||||
settingsToApply.setActivateToolWindowBeforeRun(myBeforeRunStepsPanel.needActivateToolWindowBeforeRun());
|
||||
if (myIsAllowRunningInParallelCheckBox.isVisible()) {
|
||||
settings.getConfiguration().setAllowRunningInParallel(myIsAllowRunningInParallelCheckBox.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-9
@@ -184,18 +184,13 @@ class RunnerAndConfigurationSettingsImpl @JvmOverloads constructor(val manager:
|
||||
}
|
||||
|
||||
wasSingletonSpecifiedExplicitly = false
|
||||
if (isTemplate) {
|
||||
val singletonStr = element.getAttributeValue(SINGLETON)
|
||||
if (singletonStr.isNullOrEmpty()) {
|
||||
configuration.isAllowRunningInParallel = factory.singletonPolicy.isAllowRunningInParallel
|
||||
}
|
||||
else {
|
||||
val singletonStr = element.getAttributeValue(SINGLETON)
|
||||
if (singletonStr.isNullOrEmpty()) {
|
||||
configuration.isAllowRunningInParallel = factory.singletonPolicy.isAllowRunningInParallel
|
||||
}
|
||||
else {
|
||||
wasSingletonSpecifiedExplicitly = true
|
||||
configuration.isAllowRunningInParallel = !singletonStr!!.toBoolean()
|
||||
}
|
||||
wasSingletonSpecifiedExplicitly = true
|
||||
configuration.isAllowRunningInParallel = !singletonStr!!.toBoolean()
|
||||
}
|
||||
|
||||
_configuration = configuration
|
||||
|
||||
Reference in New Issue
Block a user