mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
added option to specify context module for JAR application configuration (IDEA-81929)
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.execution.jar.JarApplicationConfigurable">
|
||||
<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="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="530" height="400"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
</component>
|
||||
<vspacer id="9634c">
|
||||
<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="a09fc" class="com.intellij.execution.ui.AlternativeJREPanel" binding="myAlternativeJREPanel">
|
||||
@@ -34,6 +34,16 @@
|
||||
<text value="Path to &JAR"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="6fe96" class="com.intellij.openapi.ui.LabeledComponent" binding="myModuleComponent">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<componentClass value="com.intellij.application.options.ModulesComboBox"/>
|
||||
<labelLocation value="West"/>
|
||||
<text value="Search sources using m&odule's classpath"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.execution.jar;
|
||||
|
||||
import com.intellij.application.options.ModulesComboBox;
|
||||
import com.intellij.execution.ui.AlternativeJREPanel;
|
||||
import com.intellij.execution.ui.CommonJavaParametersPanel;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
@@ -34,6 +35,7 @@ import javax.swing.*;
|
||||
public class JarApplicationConfigurable extends SettingsEditor<JarApplicationConfiguration> implements PanelWithAnchor {
|
||||
private CommonJavaParametersPanel myCommonProgramParameters;
|
||||
private LabeledComponent<TextFieldWithBrowseButton> myJarPathComponent;
|
||||
private LabeledComponent<ModulesComboBox> myModuleComponent;
|
||||
private JPanel myWholePanel;
|
||||
|
||||
private AlternativeJREPanel myAlternativeJREPanel;
|
||||
@@ -43,6 +45,9 @@ public class JarApplicationConfigurable extends SettingsEditor<JarApplicationCon
|
||||
public JarApplicationConfigurable(final Project project) {
|
||||
myProject = project;
|
||||
myAnchor = UIUtil.mergeComponentsWithAnchor(myJarPathComponent, myCommonProgramParameters, myAlternativeJREPanel);
|
||||
ModulesComboBox modulesComboBox = myModuleComponent.getComponent();
|
||||
modulesComboBox.allowEmptySelection("<whole project>");
|
||||
modulesComboBox.fillModules(project);
|
||||
}
|
||||
|
||||
public void applyEditorTo(final JarApplicationConfiguration configuration) throws ConfigurationException {
|
||||
@@ -50,12 +55,14 @@ public class JarApplicationConfigurable extends SettingsEditor<JarApplicationCon
|
||||
configuration.setAlternativeJrePath(myAlternativeJREPanel.getPath());
|
||||
configuration.setAlternativeJrePathEnabled(myAlternativeJREPanel.isPathEnabled());
|
||||
configuration.setJarPath(FileUtil.toSystemIndependentName(myJarPathComponent.getComponent().getText()));
|
||||
configuration.setModule(myModuleComponent.getComponent().getSelectedModule());
|
||||
}
|
||||
|
||||
public void resetEditorFrom(final JarApplicationConfiguration configuration) {
|
||||
myCommonProgramParameters.reset(configuration);
|
||||
myJarPathComponent.getComponent().setText(FileUtil.toSystemDependentName(configuration.getJarPath()));
|
||||
myAlternativeJREPanel.init(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled());
|
||||
myModuleComponent.getComponent().setSelectedModule(configuration.getModule());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+23
-1
@@ -23,6 +23,7 @@ import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.util.JavaParametersUtil;
|
||||
import com.intellij.execution.util.ProgramParametersUtil;
|
||||
import com.intellij.openapi.components.PathMacroManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.SettingsEditorGroup;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -41,13 +42,15 @@ import java.util.Map;
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class JarApplicationConfiguration extends RunConfigurationBase implements CommonJavaRunConfigurationParameters {
|
||||
public class JarApplicationConfiguration extends RunConfigurationBase implements CommonJavaRunConfigurationParameters, SearchScopeProvidingRunProfile {
|
||||
private static final SkipDefaultValuesSerializationFilters SERIALIZATION_FILTERS = new SkipDefaultValuesSerializationFilters();
|
||||
private JarApplicationConfigurationBean myBean = new JarApplicationConfigurationBean();
|
||||
private Map<String, String> myEnvs = new LinkedHashMap<String, String>();
|
||||
private JavaRunConfigurationModule myConfigurationModule;
|
||||
|
||||
public JarApplicationConfiguration(Project project, ConfigurationFactory factory, String name) {
|
||||
super(project, factory, name);
|
||||
myConfigurationModule = new JavaRunConfigurationModule(project, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -67,6 +70,15 @@ public class JarApplicationConfiguration extends RunConfigurationBase implements
|
||||
JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element);
|
||||
XmlSerializer.deserializeInto(myBean, element);
|
||||
EnvironmentVariablesComponent.readExternal(element, getEnvs());
|
||||
myConfigurationModule.readExternal(element);
|
||||
}
|
||||
|
||||
public void setModule(Module module) {
|
||||
myConfigurationModule.setModule(module);
|
||||
}
|
||||
|
||||
public Module getModule() {
|
||||
return myConfigurationModule.getModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,6 +88,9 @@ public class JarApplicationConfiguration extends RunConfigurationBase implements
|
||||
XmlSerializer.serializeInto(myBean, element, SERIALIZATION_FILTERS);
|
||||
EnvironmentVariablesComponent.writeExternal(element, getEnvs());
|
||||
PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element);
|
||||
if (myConfigurationModule.getModule() != null) {
|
||||
myConfigurationModule.writeExternal(element);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,6 +104,13 @@ public class JarApplicationConfiguration extends RunConfigurationBase implements
|
||||
JavaRunConfigurationExtensionManager.checkConfigurationIsValid(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Module[] getModules() {
|
||||
Module module = myConfigurationModule.getModule();
|
||||
return module != null ? new Module[] {module}: Module.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException {
|
||||
|
||||
Reference in New Issue
Block a user