mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
optianally disable automake when a run configuration is active
This commit is contained in:
@@ -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.compiler.options.CompilerUIConfigurable">
|
||||
<grid id="1663f" binding="myPanel" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="1663f" binding="myPanel" layout-manager="GridLayoutManager" row-count="8" 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>
|
||||
<xy x="28" y="24" width="883" height="379"/>
|
||||
@@ -10,13 +10,13 @@
|
||||
<children>
|
||||
<vspacer id="67edf">
|
||||
<constraints>
|
||||
<grid row="6" 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="7" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="b341d" 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="5" 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="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -55,7 +55,7 @@
|
||||
</grid>
|
||||
<component id="889a8" class="javax.swing.JCheckBox" binding="myCbClearOutputDirectory">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" 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 resource-bundle="messages/CompilerBundle" key="label.option.clear.output.directory.on.rebuild"/>
|
||||
@@ -63,7 +63,7 @@
|
||||
</component>
|
||||
<component id="366e" class="javax.swing.JCheckBox" binding="myCbAssertNotNull">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" 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 resource-bundle="messages/CompilerBundle" key="add.notnull.assertions"/>
|
||||
@@ -71,7 +71,7 @@
|
||||
</component>
|
||||
<component id="348ee" class="javax.swing.JCheckBox" binding="myCbAutoShowFirstError">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="3" 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 resource-bundle="messages/CompilerBundle" key="label.option.autoshow.first.error"/>
|
||||
@@ -79,7 +79,7 @@
|
||||
</component>
|
||||
<component id="ce617" class="javax.swing.JCheckBox" binding="myCbUseCompileServer" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" 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="Use out-of-process build for project compilation"/>
|
||||
@@ -93,6 +93,14 @@
|
||||
<text value="Make project automatically"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="dd48b" class="javax.swing.JCheckBox" binding="myCbAllowAutomakeWhileRunningApplication">
|
||||
<constraints>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Allow auto-make while run configuration is active"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
@@ -45,12 +45,14 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
|
||||
private JCheckBox myCbAutoShowFirstError;
|
||||
private JCheckBox myCbUseCompileServer;
|
||||
private JCheckBox myCbMakeProjectOnSave;
|
||||
private JCheckBox myCbAllowAutomakeWhileRunningApplication;
|
||||
|
||||
public CompilerUIConfigurable(final Project project) {
|
||||
myProject = project;
|
||||
final boolean isServerOptionEnabled = Registry.is("compiler.out-of-process.build.enabled") || ApplicationManager.getApplication().isInternal();
|
||||
myCbUseCompileServer.setVisible(isServerOptionEnabled);
|
||||
myCbMakeProjectOnSave.setVisible(isServerOptionEnabled);
|
||||
myCbAllowAutomakeWhileRunningApplication.setVisible(isServerOptionEnabled);
|
||||
|
||||
myPatternLegendLabel.setText("<html>" +
|
||||
"Use <b>;</b> to separate patterns and <b>!</b> to negate a pattern. " +
|
||||
@@ -61,7 +63,9 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
|
||||
myCbUseCompileServer.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
myCbMakeProjectOnSave.setEnabled(myCbUseCompileServer.isSelected());
|
||||
final boolean enabled = myCbUseCompileServer.isSelected();
|
||||
myCbMakeProjectOnSave.setEnabled(enabled);
|
||||
myCbAllowAutomakeWhileRunningApplication.setEnabled(enabled);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -75,7 +79,7 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
|
||||
myCbAssertNotNull.setSelected(configuration.isAddNotNullAssertions());
|
||||
myCbUseCompileServer.setSelected(workspaceConfiguration.USE_COMPILE_SERVER);
|
||||
myCbMakeProjectOnSave.setSelected(workspaceConfiguration.MAKE_PROJECT_ON_SAVE);
|
||||
myCbMakeProjectOnSave.setEnabled(workspaceConfiguration.USE_COMPILE_SERVER);
|
||||
myCbAllowAutomakeWhileRunningApplication.setEnabled(workspaceConfiguration.USE_COMPILE_SERVER);
|
||||
|
||||
configuration.convertPatterns();
|
||||
|
||||
@@ -102,6 +106,7 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
|
||||
boolean wasUsing = workspaceConfiguration.USE_COMPILE_SERVER;
|
||||
workspaceConfiguration.USE_COMPILE_SERVER = myCbUseCompileServer.isSelected();
|
||||
workspaceConfiguration.MAKE_PROJECT_ON_SAVE = myCbMakeProjectOnSave.isSelected();
|
||||
workspaceConfiguration.ALLOW_AUTOMAKE_WHILE_RUNNING_APPLICATION = myCbAllowAutomakeWhileRunningApplication.isSelected();
|
||||
|
||||
configuration.setAddNotNullAssertions(myCbAssertNotNull.isSelected());
|
||||
configuration.removeResourceFilePatterns();
|
||||
@@ -165,6 +170,7 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
|
||||
isModified |= ComparingUtils.isModified(myCbAutoShowFirstError, workspaceConfiguration.AUTO_SHOW_ERRORS_IN_EDITOR);
|
||||
isModified |= ComparingUtils.isModified(myCbUseCompileServer, workspaceConfiguration.USE_COMPILE_SERVER);
|
||||
isModified |= ComparingUtils.isModified(myCbMakeProjectOnSave, workspaceConfiguration.MAKE_PROJECT_ON_SAVE);
|
||||
isModified |= ComparingUtils.isModified(myCbAllowAutomakeWhileRunningApplication, workspaceConfiguration.ALLOW_AUTOMAKE_WHILE_RUNNING_APPLICATION);
|
||||
|
||||
final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
|
||||
isModified |= ComparingUtils.isModified(myCbAssertNotNull, compilerConfiguration.isAddNotNullAssertions());
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.intellij.execution.ExecutionManager;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.RunProfile;
|
||||
import com.intellij.execution.process.*;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.RunContentManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
@@ -292,6 +294,21 @@ public class BuildManager implements ApplicationComponent{
|
||||
if (!config.useOutOfProcessBuild() || !config.MAKE_PROJECT_ON_SAVE) {
|
||||
continue;
|
||||
}
|
||||
if (!config.ALLOW_AUTOMAKE_WHILE_RUNNING_APPLICATION) {
|
||||
final RunContentManager contentManager = ExecutionManager.getInstance(project).getContentManager();
|
||||
boolean hasRunningProcesses = false;
|
||||
for (RunContentDescriptor descriptor : contentManager.getAllDescriptors()) {
|
||||
final ProcessHandler handler = descriptor.getProcessHandler();
|
||||
if (handler != null && !handler.isProcessTerminated()) { // active process
|
||||
hasRunningProcesses = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasRunningProcesses) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
final List<String> emptyList = Collections.emptyList();
|
||||
final RequestFuture future = scheduleBuild(
|
||||
project, false, true, emptyList, emptyList, emptyList, Collections.<String, String>emptyMap(), new AutoMakeMessageHandler(project)
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.intellij.compiler;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.components.StoragePathMacros;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
@@ -40,6 +39,7 @@ public class CompilerWorkspaceConfiguration implements PersistentStateComponent<
|
||||
public boolean CLEAR_OUTPUT_DIRECTORY = true;
|
||||
public boolean USE_COMPILE_SERVER = false;
|
||||
public boolean MAKE_PROJECT_ON_SAVE = false;
|
||||
public boolean ALLOW_AUTOMAKE_WHILE_RUNNING_APPLICATION = false;
|
||||
|
||||
public static CompilerWorkspaceConfiguration getInstance(Project project) {
|
||||
return ServiceManager.getService(project, CompilerWorkspaceConfiguration.class);
|
||||
|
||||
Reference in New Issue
Block a user