improved usability for run/debug configuration panel

hideable Environment panel, proper order for django server configuration fields
This commit is contained in:
Ekaterina Tuzova
2013-02-27 16:59:28 +04:00
parent f87645a412
commit 02e70bb0df
6 changed files with 134 additions and 96 deletions
@@ -1,104 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.python.run.PyPluginCommonOptionsForm">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="8816" binding="myHideablePanel" 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>
<xy x="20" y="20" width="429" height="182"/>
<xy x="20" y="20" width="447" height="197"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c3528" class="com.intellij.ui.components.JBLabel" binding="myWorkingDirectoryJBLabel">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="5" 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=""/>
<text resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.labels.working_directory"/>
</properties>
</component>
<component id="78c75" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myWorkingDirectoryTextField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="32654" class="com.intellij.execution.configuration.EnvironmentVariablesComponent" binding="myEnvsComponent">
<constraints>
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelLocation value="West"/>
<text resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.labels.environment_variables"/>
</properties>
</component>
<component id="cdd29" class="com.intellij.ui.components.JBLabel" binding="myInterpreterOptionsJBLabel">
<constraints>
<grid row="4" 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>
<text resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.labels.interpreter_options"/>
</properties>
</component>
<component id="1a856" class="com.intellij.ui.RawCommandLineEditor" binding="myInterpreterOptionsTextField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="2" 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>
<dialogCaption resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.captions.interpreter_options_dialog"/>
<text value=""/>
</properties>
</component>
<component id="a4f87" class="com.intellij.ui.components.JBLabel" binding="myPythonInterpreterJBLabel">
<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"/>
</constraints>
<properties>
<text value="Python Interpreter:"/>
</properties>
</component>
<component id="64e87" class="javax.swing.JRadioButton" binding="myUseModuleSdkRadioButton" default-binding="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Use SDK of module:"/>
</properties>
</component>
<component id="5f300" class="javax.swing.JComboBox" binding="myModuleComboBox">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="b7269" class="javax.swing.JRadioButton" binding="myUseSpecifiedSdkRadioButton">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.labels.interpreter"/>
</properties>
</component>
<component id="fc9a3" class="javax.swing.JComboBox" binding="myInterpreterComboBox" default-binding="true">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<vspacer id="a3bda">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
<minimum-size width="-1" height="15"/>
<preferred-size width="-1" height="15"/>
<maximum-size width="-1" height="15"/>
</grid>
</constraints>
</vspacer>
<border type="none"/>
<children>
<component id="c3528" class="com.intellij.ui.components.JBLabel" binding="myWorkingDirectoryJBLabel">
<constraints>
<grid row="5" 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=""/>
<text resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.labels.working_directory"/>
</properties>
</component>
<component id="78c75" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myWorkingDirectoryTextField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="2" 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="32654" class="com.intellij.execution.configuration.EnvironmentVariablesComponent" binding="myEnvsComponent">
<constraints>
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelLocation value="West"/>
<text resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.labels.environment_variables"/>
</properties>
</component>
<component id="cdd29" class="com.intellij.ui.components.JBLabel" binding="myInterpreterOptionsJBLabel">
<constraints>
<grid row="4" 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>
<text resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.labels.interpreter_options"/>
</properties>
</component>
<component id="1a856" class="com.intellij.ui.RawCommandLineEditor" binding="myInterpreterOptionsTextField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="2" 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>
<dialogCaption resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.captions.interpreter_options_dialog"/>
<text value=""/>
</properties>
</component>
<component id="a4f87" class="com.intellij.ui.components.JBLabel" binding="myPythonInterpreterJBLabel">
<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"/>
</constraints>
<properties>
<text value="Python Interpreter:"/>
</properties>
</component>
<component id="64e87" class="javax.swing.JRadioButton" binding="myUseModuleSdkRadioButton" default-binding="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Use SDK of module:"/>
</properties>
</component>
<component id="5f300" class="javax.swing.JComboBox" binding="myModuleComboBox">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="b7269" class="javax.swing.JRadioButton" binding="myUseSpecifiedSdkRadioButton">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="com/jetbrains/python/PyBundle" key="runcfg.labels.interpreter"/>
</properties>
</component>
<component id="fc9a3" class="javax.swing.JComboBox" binding="myInterpreterComboBox" default-binding="true">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<vspacer id="a3bda">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
<minimum-size width="-1" height="15"/>
<preferred-size width="-1" height="15"/>
<maximum-size width="-1" height="15"/>
</grid>
</constraints>
</vspacer>
</children>
</grid>
</children>
</grid>
<buttonGroups>
@@ -1,6 +1,7 @@
package com.jetbrains.python.run;
import com.intellij.execution.configuration.EnvironmentVariablesComponent;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.Sdk;
@@ -9,10 +10,12 @@ import com.intellij.openapi.roots.ui.configuration.ModulesAlphaComparator;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.ui.CollectionComboBoxModel;
import com.intellij.ui.HideableDecorator;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.PathMappingSettings;
import com.jetbrains.python.sdk.PythonSdkType;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -38,7 +41,9 @@ public class PyPluginCommonOptionsForm implements AbstractPyCommonOptionsForm {
private JBLabel myPythonInterpreterJBLabel;
private JBLabel myInterpreterOptionsJBLabel;
private JBLabel myWorkingDirectoryJBLabel;
private JPanel myHideablePanel;
private JComponent labelAnchor;
private final HideableDecorator myDecorator;
public PyPluginCommonOptionsForm(PyCommonOptionsFormData data) {
// setting modules
@@ -61,6 +66,26 @@ public class PyPluginCommonOptionsForm implements AbstractPyCommonOptionsForm {
myUseModuleSdkRadioButton.addActionListener(listener);
setAnchor(myEnvsComponent.getLabel());
myDecorator = new HideableDecorator(myHideablePanel, "Environment", false) {
@Override
protected void on() {
super.on();
storeState();
}
@Override
protected void off() {
super.off();
storeState();
}
private void storeState() {
PropertiesComponent.getInstance().setValue(EXPAND_PROPERTY_KEY, String.valueOf(isExpanded()));
}
};
myDecorator.setOn(PropertiesComponent.getInstance().getBoolean(EXPAND_PROPERTY_KEY, true));
myDecorator.setContentComponent(myMainPanel);
}
private void updateControls() {
@@ -69,7 +94,7 @@ public class PyPluginCommonOptionsForm implements AbstractPyCommonOptionsForm {
}
public JPanel getMainPanel() {
return myMainPanel;
return myHideablePanel;
}
@Override
@@ -39,7 +39,7 @@
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none" title="Interpreter"/>
<border type="none"/>
<children/>
</grid>
</children>
@@ -1,6 +1,7 @@
package com.jetbrains.python.run;
import com.intellij.ui.PanelWithAnchor;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
import java.awt.event.ActionListener;
@@ -9,6 +10,8 @@ import java.awt.event.ActionListener;
* @author yole
*/
public interface AbstractPyCommonOptionsForm extends AbstractPythonRunConfigurationParams, PanelWithAnchor {
@NonNls String EXPAND_PROPERTY_KEY = "ExpandEnvironmentPanel";
JComponent getMainPanel();
void subscribe();
@@ -2,7 +2,7 @@
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.python.testing.PythonTestRunConfigurationForm">
<grid id="aecbe" layout-manager="CardLayout" hgap="0" vgap="0">
<constraints>
<xy x="20" y="20" width="611" height="351"/>
<xy x="20" y="20" width="647" height="373"/>
</constraints>
<properties/>
<border type="none"/>
@@ -219,7 +219,7 @@
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
<html.disable class="java.lang.Boolean" value="false"/>
</clientProperties>
<border type="none" title="Interpreter"/>
<border type="none"/>
<children/>
</grid>
<vspacer id="f093d">
@@ -2,7 +2,7 @@
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.python.testing.pytest.PyTestConfigurationEditor">
<grid id="dbdd7" layout-manager="CardLayout" hgap="0" vgap="0">
<constraints>
<xy x="20" y="214" width="495" height="206"/>
<xy x="20" y="214" width="495" height="212"/>
</constraints>
<properties/>
<border type="none"/>
@@ -101,7 +101,7 @@
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none" title="Interpreter"/>
<border type="none"/>
<children/>
</grid>
<vspacer id="979d9">