mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
use module dir as working directory checkbox
This commit is contained in:
+13
-9
@@ -1,18 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.junit2.configuration.CommonJavaParameters">
|
||||
<grid id="d88e6" binding="myWholePanel" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="10">
|
||||
<grid id="d88e6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="10">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="64" y="62" width="431" height="137"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
|
||||
<xy x="64" y="62" width="431" height="215"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="6e486" class="com.intellij.openapi.ui.LabeledComponent" binding="myVMParameters">
|
||||
<constraints>
|
||||
<xy x="0" y="9" width="431" height="16"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1">
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="0" height="-1"/>
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
@@ -24,8 +22,7 @@
|
||||
</component>
|
||||
<component id="acecf" class="com.intellij.openapi.ui.LabeledComponent" binding="myProgramParameters">
|
||||
<constraints>
|
||||
<xy x="0" y="53" width="431" height="16"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1">
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="0" height="-1"/>
|
||||
<preferred-size width="400" height="-1"/>
|
||||
</grid>
|
||||
@@ -37,8 +34,7 @@
|
||||
</component>
|
||||
<component id="8c18f" class="com.intellij.openapi.ui.LabeledComponent" binding="myWorkingDirectory">
|
||||
<constraints>
|
||||
<xy x="0" y="94" width="431" height="36"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1">
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="0" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -48,6 +44,14 @@
|
||||
<text resource-bundle="messages/ExecutionBundle" key="junit.configuration.working.directory.label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="dd2ea" class="javax.swing.JCheckBox" binding="myUseModuleDirectoryAsCheckBox" default-binding="true">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Use Module Directory as a Working Directory"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
+17
@@ -45,6 +45,7 @@ public class CommonJavaParameters extends JPanel {
|
||||
private LabeledComponent<TextFieldWithBrowseButton> myWorkingDirectory;
|
||||
private LabeledComponent<RawCommandLineEditor> myProgramParameters;
|
||||
private LabeledComponent<RawCommandLineEditor> myVMParameters;
|
||||
private JCheckBox myUseModuleDirectoryAsCheckBox;
|
||||
|
||||
private final LabeledComponent[] myFields = new LabeledComponent[3];
|
||||
private Module myModule = null;
|
||||
@@ -69,6 +70,13 @@ public class CommonJavaParameters extends JPanel {
|
||||
myFields[RunJavaConfiguration.PROGRAM_PARAMETERS_PROPERTY] = myProgramParameters;
|
||||
myFields[RunJavaConfiguration.VM_PARAMETERS_PROPERTY] = myVMParameters;
|
||||
myFields[RunJavaConfiguration.WORKING_DIRECTORY_PROPERTY] = myWorkingDirectory;
|
||||
|
||||
myUseModuleDirectoryAsCheckBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final boolean selected = ((JCheckBox)e.getSource()).isSelected();
|
||||
myWorkingDirectory.getComponent().setEnabled(!selected);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void copyDialogCaption(final LabeledComponent<RawCommandLineEditor> component) {
|
||||
@@ -99,6 +107,11 @@ public class CommonJavaParameters extends JPanel {
|
||||
}
|
||||
|
||||
public void setText(final int property, final String value) {
|
||||
if (RunJavaConfiguration.WORKING_DIRECTORY_PROPERTY == property && value != null && "$MODULE_DIR$".equals(value.trim())) {
|
||||
myUseModuleDirectoryAsCheckBox.setSelected(true);
|
||||
myWorkingDirectory.getComponent().setEnabled(false);
|
||||
}
|
||||
|
||||
final JComponent component = getLabeledComponent(property).getComponent();
|
||||
if (component instanceof TextFieldWithBrowseButton)
|
||||
((TextFieldWithBrowseButton)component).setText(value);
|
||||
@@ -108,6 +121,10 @@ public class CommonJavaParameters extends JPanel {
|
||||
}
|
||||
|
||||
public String getText(final int property) {
|
||||
if (RunJavaConfiguration.WORKING_DIRECTORY_PROPERTY == property && myUseModuleDirectoryAsCheckBox.isSelected()) {
|
||||
return "$MODULE_DIR$";
|
||||
}
|
||||
|
||||
final JComponent component = getLabeledComponent(property).getComponent();
|
||||
if (component instanceof TextFieldWithBrowseButton)
|
||||
return ((TextFieldWithBrowseButton)component).getText();
|
||||
|
||||
Reference in New Issue
Block a user