run configurations layout with anchors

This commit is contained in:
Evgeny Zakrevsky
2011-09-01 23:20:36 +04:00
parent 55a9c61513
commit 904e525a0b
36 changed files with 546 additions and 290 deletions
@@ -43,7 +43,6 @@
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelInsets top="0" left="0" bottom="0" right="0"/>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.policy.file.label"/>
</properties>
</component>
@@ -57,7 +56,6 @@
<componentClass value="com.intellij.ui.RawCommandLineEditor"/>
<labelInsets top="0" left="0" bottom="0" right="0"/>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.vm.parameters.for.appletviewer.label"/>
</properties>
</component>
@@ -67,9 +65,7 @@
</constraints>
<properties>
<componentClass value="javax.swing.JComboBox"/>
<labelInsets top="0" left="0" bottom="0" right="0"/>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.use.classpath.and.jdk.of.module.label"/>
</properties>
</component>
@@ -92,7 +88,7 @@
</clientProperties>
<border type="none"/>
<children>
<component id="a2b70" class="javax.swing.JLabel" binding="myHtmlFileLabel">
<component id="a2b70" class="com.intellij.ui.components.JBLabel" binding="myHtmlFileLabel">
<constraints>
<grid row="0" 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>
@@ -110,7 +106,7 @@
</component>
</children>
</grid>
<grid id="71bb1" binding="myClassOptions" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="71bb1" binding="myClassOptions" layout-manager="GridLayoutManager" row-count="4" 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>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
@@ -123,58 +119,10 @@
</clientProperties>
<border type="none"/>
<children>
<grid id="9c777" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="575e9" class="javax.swing.JTextField" binding="myWidth">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="60aa" class="javax.swing.JLabel" binding="myWidthLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="52" height="-1"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.width.label"/>
</properties>
</component>
<component id="3cd8" class="javax.swing.JLabel" binding="myHeightLabel">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.height.label"/>
</properties>
</component>
<component id="16d37" class="javax.swing.JTextField" binding="myHeight">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
</children>
</grid>
<grid id="32908" layout-manager="GridLayoutManager" row-count="1" 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>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
@@ -226,32 +174,58 @@
</xy>
</children>
</grid>
<grid id="d9c99" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="5">
<margin top="0" left="0" bottom="0" right="0"/>
<component id="36125" class="com.intellij.ui.components.JBLabel" binding="myClassNameLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" 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/>
<border type="none"/>
<children>
<component id="36125" class="javax.swing.JLabel" binding="myClassNameLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.applet.class.label"/>
</properties>
</component>
<component id="70a46" class="com.intellij.ui.EditorTextFieldWithBrowseButton" binding="myClassName" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
</children>
</grid>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="applet.configuration.applet.class.label"/>
</properties>
</component>
<component id="70a46" class="com.intellij.ui.EditorTextFieldWithBrowseButton" binding="myClassName" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="60aa" class="com.intellij.ui.components.JBLabel" binding="myWidthLabel">
<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 resource-bundle="messages/ExecutionBundle" key="applet.configuration.width.label"/>
</properties>
</component>
<component id="575e9" class="javax.swing.JTextField" binding="myWidth">
<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">
<preferred-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="3cd8" class="javax.swing.JLabel" binding="myHeightLabel">
<constraints>
<grid row="2" 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="messages/ExecutionBundle" key="applet.configuration.height.label"/>
</properties>
</component>
<component id="16d37" class="javax.swing.JTextField" binding="myHeight">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
</children>
</grid>
</children>
@@ -271,9 +245,7 @@
<constraints>
<grid row="6" 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>
<checkBoxPreferredSize width="215" height="23"/>
</properties>
<properties/>
</component>
</children>
</grid>
@@ -27,8 +27,10 @@ import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.EditorTextFieldWithBrowseButton;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.table.TableView;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
@@ -43,7 +45,8 @@ import java.io.File;
import java.util.*;
import java.util.List;
public class AppletConfigurable extends SettingsEditor<AppletConfiguration> implements CheckableRunConfigurationEditor<AppletConfiguration>{
public class AppletConfigurable extends SettingsEditor<AppletConfiguration> implements CheckableRunConfigurationEditor<AppletConfiguration>,
ComponentWithAnchor {
private JPanel myWholePanel;
private JRadioButton myMainClass;
private JRadioButton myURL;
@@ -59,12 +62,13 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
private JPanel myTablePlace;
private JButton myAddButton;
private JButton myRemoveButton;
private JLabel myHtmlFileLabel;
private JLabel myClassNameLabel;
private JLabel myWidthLabel;
private JBLabel myHtmlFileLabel;
private JBLabel myClassNameLabel;
private JBLabel myWidthLabel;
private JLabel myHeightLabel;
private AlternativeJREPanel myAlternativeJREPanel;
private final ButtonGroup myAppletRadioButtonGroup;
private JComponent anchor;
private final Project myProject;
private final ConfigurationModuleSelector myModuleSelector;
@@ -153,6 +157,8 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
removeParameter();
}
});
setAnchor(myModule.getLabel());
}
private void removeParameter() {
@@ -285,6 +291,21 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
myClassName = new EditorTextFieldWithBrowseButton(myProject, true);
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myModule.setAnchor(anchor);
myPolicyFile.setAnchor(anchor);
myVMParameters.setAnchor(anchor);
myAlternativeJREPanel.setAnchor(anchor);
myHtmlFileLabel.setAnchor(anchor);
}
private static abstract class MyColumnInfo extends ColumnInfo<AppletConfiguration.AppletParameter, String> {
public MyColumnInfo(final String name) {
super(name);
@@ -1,63 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.application.ApplicationConfigurable">
<grid id="93687" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="93687" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="8" 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="53" y="36" width="708" height="433"/>
<xy x="53" y="36" width="708" height="319"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="eeb03">
<constraints>
<grid row="5" 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="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="50b09" class="com.intellij.execution.ui.CommonJavaParametersPanel" binding="myCommonProgramParameters">
<constraints>
<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"/>
</constraints>
<properties>
<labelsPreferredSize width="215" height="16"/>
</properties>
<properties/>
</component>
<component id="50d08" class="com.intellij.openapi.ui.LabeledComponent" binding="myMainClass" custom-create="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="20"/>
</grid>
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="22"/>
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.main.class.label"/>
</properties>
</component>
<component id="c45d2" class="com.intellij.openapi.ui.LabeledComponent" binding="myModule">
<constraints>
<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"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="javax.swing.JComboBox"/>
<labelLocation value="West"/>
<labelPreferredSize width="215" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.use.classpath.and.jdk.of.module.label"/>
</properties>
</component>
<component id="e88bd" class="com.intellij.execution.ui.AlternativeJREPanel" binding="myAlternativeJREPanel">
<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"/>
<grid row="4" 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>
<checkBoxPreferredSize width="215" height="23"/>
</properties>
<properties/>
</component>
<component id="b45cf" class="javax.swing.JCheckBox" binding="myShowSwingInspectorCheckbox">
<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="6" 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 resource-bundle="messages/ExecutionBundle" key="show.swing.inspector"/>
</properties>
</component>
<vspacer id="f4215">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="10"/>
</grid>
</constraints>
</vspacer>
<vspacer id="7cceb">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="10"/>
</grid>
</constraints>
</vspacer>
</children>
</grid>
</form>
@@ -26,7 +26,6 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.psi.JavaCodeFragment;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
@@ -61,6 +60,17 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
});
ClassBrowser.createApplicationClassBrowser(project, myModuleSelector).setField(getMainClassField());
myVersionDetector = new JreVersionDetector();
settingAnchors();
}
private void settingAnchors() {
JComponent anchor = myCommonProgramParameters.getAnchor();
myMainClass.setAnchor(anchor);
myCommonProgramParameters.setAnchor(anchor);
anchor = myModule.getLabel();
myAlternativeJREPanel.setAnchor(anchor);
}
public void applyEditorTo(final ApplicationConfiguration configuration) throws ConfigurationException {
@@ -24,7 +24,9 @@ import com.intellij.openapi.ui.TextComponentAccessor;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.ui.GuiUtils;
import com.intellij.ui.InsertPathAction;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.TextFieldWithHistory;
import com.intellij.ui.components.JBCheckBox;
import javax.swing.*;
import java.awt.*;
@@ -36,15 +38,15 @@ import java.util.ArrayList;
* User: anna
* Date: Jun 21, 2005
*/
public class AlternativeJREPanel extends JPanel {
public class AlternativeJREPanel extends JPanel implements ComponentWithAnchor {
private final ComponentWithBrowseButton<TextFieldWithHistory> myPathField;
private final JCheckBox myCbEnabled;
private final JBCheckBox myCbEnabled;
final TextFieldWithHistory myFieldWithHistory;
public AlternativeJREPanel() {
super(new GridBagLayout());
myCbEnabled = new JCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));
myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));
final GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
add(myCbEnabled, gc);
@@ -77,6 +79,7 @@ public class AlternativeJREPanel extends JPanel {
}
});
enabledChanged();
updateUI();
}
private void enabledChanged() {
@@ -106,12 +109,18 @@ public class AlternativeJREPanel extends JPanel {
setPathEnabled(isEnabled);
setPath(path);
}
public void setCheckBoxPreferredSize(Dimension d) {
myCbEnabled.setPreferredSize(d);
@Override
public JComponent getAnchor() {
return myCbEnabled.getAnchor();
}
public Dimension getCheckBoxPreferredSize() {
return myCbEnabled.getPreferredSize();
@Override
public void setAnchor(JComponent anchor) {
myCbEnabled.setAnchor(anchor);
}
public JBCheckBox getCbEnabled() {
return myCbEnabled;
}
}
@@ -19,12 +19,12 @@ import com.intellij.execution.CommonJavaRunConfigurationParameters;
import com.intellij.execution.ExecutionBundle;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.ui.RawCommandLineEditor;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
public class CommonJavaParametersPanel extends CommonProgramParametersPanel {
private LabeledComponent<RawCommandLineEditor> myVMParameters;
private LabeledComponent<RawCommandLineEditor> myVMParametersComponent;
public CommonJavaParametersPanel() {
super();
@@ -32,28 +32,28 @@ public class CommonJavaParametersPanel extends CommonProgramParametersPanel {
@Override
protected void addComponents() {
myVMParameters = LabeledComponent.create(new RawCommandLineEditor(),
myVMParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
ExecutionBundle.message("run.configuration.java.vm.parameters.label"));
copyDialogCaption(myVMParameters);
copyDialogCaption(myVMParametersComponent);
myVMParameters.setLabelLocation(BorderLayout.WEST);
myVMParametersComponent.setLabelLocation(BorderLayout.WEST);
add(myVMParameters);
add(myVMParametersComponent);
super.addComponents();
}
@Override
public void setLabelsPreferredSize(Dimension d) {
super.setLabelsPreferredSize(d);
myVMParameters.setLabelPreferredSize(d);
}
public void setVMParameters(String text) {
myVMParameters.getComponent().setText(text);
myVMParametersComponent.getComponent().setText(text);
}
public String getVMParameters() {
return myVMParameters.getComponent().getText();
return myVMParametersComponent.getComponent().getText();
}
@Override
public void setAnchor(JComponent labelAnchor) {
super.setAnchor(labelAnchor);
myVMParametersComponent.setAnchor(labelAnchor);
}
public void applyTo(CommonJavaRunConfigurationParameters configuration) {
@@ -44,8 +44,9 @@
<vspacer id="6092a">
<constraints>
<grid row="1" column="0" 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="30"/>
<preferred-size width="-1" height="30"/>
<minimum-size width="-1" height="15"/>
<preferred-size width="-1" height="15"/>
<maximum-size width="-1" height="15"/>
</grid>
</constraints>
</vspacer>
@@ -32,11 +32,10 @@ import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.components.JBList;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -45,19 +44,18 @@ import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public class CommonProgramParametersPanel extends JPanel {
public class CommonProgramParametersPanel extends JPanel implements ComponentWithAnchor {
private static final Icon ICON = IconLoader.getIcon("/runConfigurations/variables.png");
private LabeledComponent<RawCommandLineEditor> myProgramParametersComponent;
private LabeledComponent<JPanel> myWorkingDirectoryComponent;
private TextFieldWithBrowseButton myWorkingDirectoryField;
private EnvironmentVariablesComponent myEnvVariablesComponent;
protected JComponent anchor;
private Module myModuleContext = null;
private boolean myHaveModuleContext = false;
protected static final Dimension notSpecifiedSize = new Dimension(-1, -1);
protected Dimension labelsPreferredSize = notSpecifiedSize;
public CommonProgramParametersPanel() {
super();
@@ -65,6 +63,7 @@ public class CommonProgramParametersPanel extends JPanel {
initComponents();
copyDialogCaption(myProgramParametersComponent);
updateUI();
}
protected void initComponents() {
@@ -116,6 +115,8 @@ public class CommonProgramParametersPanel extends JPanel {
addComponents();
setPreferredSize(new Dimension(10, 10));
setAnchor(myEnvVariablesComponent.getLabel());
}
protected void addComponents() {
@@ -135,10 +136,6 @@ public class CommonProgramParametersPanel extends JPanel {
copyDialogCaption(myProgramParametersComponent);
}
public String getProgramParametersLabel() {
return myProgramParametersComponent.getText();
}
public void setProgramParameters(String params) {
myProgramParametersComponent.getComponent().setText(params);
}
@@ -156,6 +153,17 @@ public class CommonProgramParametersPanel extends JPanel {
return myProgramParametersComponent;
}
public JComponent getAnchor() {
return anchor;
}
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myProgramParametersComponent.setAnchor(anchor);
myWorkingDirectoryComponent.setAnchor(anchor);
myEnvVariablesComponent.setAnchor(anchor);
}
public void applyTo(CommonProgramRunConfigurationParameters configuration) {
configuration.setProgramParameters(myProgramParametersComponent.getComponent().getText());
configuration.setWorkingDirectory(myWorkingDirectoryField.getText());
@@ -171,19 +179,4 @@ public class CommonProgramParametersPanel extends JPanel {
myEnvVariablesComponent.setEnvs(configuration.getEnvs());
myEnvVariablesComponent.setPassParentEnvs(configuration.isPassParentEnvs());
}
public void setLabelsPreferredSize(Dimension d) {
if (notSpecifiedSize.equals(d)) {
d = null;
}
labelsPreferredSize = d;
myEnvVariablesComponent.setLabelPreferredSize(d);
myProgramParametersComponent.setLabelPreferredSize(d);
myWorkingDirectoryComponent.setLabelPreferredSize(d);
}
@Nullable
public Dimension getLabelsPreferredSize() {
return labelsPreferredSize;
}
}
@@ -18,22 +18,20 @@ package com.intellij.openapi.ui;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.components.JBLabel;
import com.intellij.uiDesigner.core.AbstractLayout;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.text.JTextComponent;
import java.awt.*;
public class LabeledComponent<Comp extends JComponent> extends JPanel {
private final JLabel myLabel = new JLabel();
public class LabeledComponent<Comp extends JComponent> extends JPanel implements ComponentWithAnchor {
private final JBLabel myLabel = new JBLabel();
private Comp myComponent;
private String myLabelConstraints = BorderLayout.NORTH;
private static final Dimension notSpecifiedSize = new Dimension(-1, -1);
private Dimension labelPreferredSize = notSpecifiedSize;
public LabeledComponent() {
super(new BorderLayout(AbstractLayout.DEFAULT_HGAP, AbstractLayout.DEFAULT_VGAP));
insertLabel();
@@ -52,18 +50,6 @@ public class LabeledComponent<Comp extends JComponent> extends JPanel {
add(myLabel, myLabelConstraints);
}
public void setLabelPreferredSize(Dimension d) {
if (notSpecifiedSize.equals(d)) {
d = null;
}
labelPreferredSize = d;
myLabel.setPreferredSize(d);
}
public Dimension getLabelPreferredSize() {
return labelPreferredSize;
}
public void setText(String textWithMnemonic) {
if (!StringUtil.endsWithChar(textWithMnemonic, ':')) textWithMnemonic += ":";
TextWithMnemonic withMnemonic = TextWithMnemonic.fromTextWithMnemonic(textWithMnemonic);
@@ -109,6 +95,7 @@ public class LabeledComponent<Comp extends JComponent> extends JPanel {
return myComponent;
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (myComponent != null) myComponent.setEnabled(enabled);
@@ -148,10 +135,20 @@ public class LabeledComponent<Comp extends JComponent> extends JPanel {
return myLabel.getText().replace("\u001B", "");
}
public JLabel getLabel() {
public JBLabel getLabel() {
return myLabel;
}
@Override
public JComponent getAnchor() {
return myLabel.getAnchor();
}
@Override
public void setAnchor(JComponent labelAnchor) {
myLabel.setAnchor(labelAnchor);
}
public static class TextWithMnemonic {
private final String myText;
private final int myMnemoniIndex;
@@ -0,0 +1,12 @@
package com.intellij.ui;
import javax.swing.*;
/**
* @author evgeny.zakrevsky
*/
public interface ComponentWithAnchor {
JComponent getAnchor();
void setAnchor(JComponent anchor);
}
@@ -0,0 +1,63 @@
package com.intellij.ui.components;
import com.intellij.ui.ComponentWithAnchor;
import javax.swing.*;
import java.awt.*;
/**
* @author evgeny.zakrevsky
*/
public class JBCheckBox extends JCheckBox implements ComponentWithAnchor {
private JComponent anchor;
public JBCheckBox() {
super();
}
public JBCheckBox(Icon icon) {
super(icon);
}
public JBCheckBox(Icon icon, boolean selected) {
super(icon, selected);
}
public JBCheckBox(String text) {
super(text);
}
public JBCheckBox(Action a) {
super(a);
}
public JBCheckBox(String text, boolean selected) {
super(text, selected);
}
public JBCheckBox(String text, Icon icon) {
super(text, icon);
}
public JBCheckBox(String text, Icon icon, boolean selected) {
super(text, icon, selected);
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
if (anchor != this) {
this.anchor = anchor;
}
}
@Override
public Dimension getPreferredSize() {
return anchor == null ? super.getPreferredSize() : anchor.getPreferredSize();
}
}
@@ -15,6 +15,7 @@
*/
package com.intellij.ui.components;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -22,9 +23,10 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
public class JBLabel extends JLabel {
public class JBLabel extends JLabel implements ComponentWithAnchor {
private UIUtil.ComponentStyle myComponentStyle = UIUtil.ComponentStyle.REGULAR;
private UIUtil.FontColor myFontColor = UIUtil.FontColor.NORMAL;
private JComponent anchor;
public JBLabel() {
}
@@ -58,6 +60,14 @@ public class JBLabel extends JLabel {
super(text, icon, horizontalAlignment);
}
@Override
public void updateUI() {
super.updateUI();
if (myComponentStyle != null) {
UIUtil.applyStyle(myComponentStyle, this);
}
}
public void setComponentStyle(@NotNull UIUtil.ComponentStyle componentStyle) {
myComponentStyle = componentStyle;
UIUtil.applyStyle(componentStyle, this);
@@ -80,4 +90,21 @@ public class JBLabel extends JLabel {
public void setForeground(Color fg) {
super.setForeground(UIUtil.getLabelFontColor(myFontColor));
}
@Override
public void setAnchor(JComponent anchor) {
if (anchor != this) {
this.anchor = anchor;
}
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public Dimension getPreferredSize() {
return anchor == null ? super.getPreferredSize() : anchor.getPreferredSize();
}
}
@@ -56,7 +56,7 @@ error.report.title=Error Report
log.monitor.no.files=No log files attached
log.monitor.remove.button=&Remove
log.monitor.add.button=A&dd
log.monitor.group=Log Files To Be Shown In Console
log.monitor.group=Log Files to Be Shown in Console
log.monitor.log.file.column=Log File Entry
log.monitor.is.active.column=Is Active
log.monitor.is.skipped.column=Skip Content
@@ -19,13 +19,11 @@
*/
package com.intellij.util.ui;
import com.intellij.openapi.util.SystemInfo;
import javax.swing.*;
import java.awt.*;
public class FormBuilder {
private static final boolean ALIGN_LABELS_TO_RIGHT = SystemInfo.isMac;
private static final boolean ALIGN_LABELS_TO_RIGHT = UIUtil.isUnderAquaLookAndFeel();
private int line = 0;
private int indent;
@@ -32,7 +32,7 @@
<properties/>
<border type="none"/>
<children>
<component id="7f548" class="javax.swing.JLabel">
<component id="7f548" class="com.intellij.ui.components.JBLabel" binding="myModuleJBLabel">
<constraints>
<grid row="0" 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>
@@ -62,7 +62,7 @@
</component>
<component id="6765c" class="com.intellij.openapi.ui.LabeledComponent" binding="myChooseAvdComponent">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="com.intellij.ui.ComboboxWithBrowseButton"/>
@@ -29,7 +29,9 @@ import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.Messages;
import com.intellij.ui.ComboboxWithBrowseButton;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.components.JBLabel;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.facet.AvdsNotSupportedException;
import org.jetbrains.android.util.AndroidBundle;
@@ -43,7 +45,7 @@ import java.awt.event.ActionListener;
/**
* @author yole
*/
public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase> extends SettingsEditor<T> {
public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase> extends SettingsEditor<T> implements ComponentWithAnchor {
private JPanel myPanel;
private JComboBox myModulesComboBox;
private JCheckBox myChooseDeviceManually;
@@ -56,9 +58,11 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
private JCheckBox myDisableBootAnimationCombo;
private JCheckBox myClearLogCheckBox;
private JTabbedPane myTabbedPane;
private JBLabel myModuleJBLabel;
private ComboboxWithBrowseButton myAvdBox;
private RawCommandLineEditor myCommandLineField;
private String incorrectPreferredAvd;
private JComponent anchor;
@NonNls private final static String[] NETWORK_SPEEDS = new String[]{"Full", "GSM", "HSCSD", "GPRS", "EDGE", "UMTS", "HSPDA"};
@NonNls private final static String[] NETWORK_LATENCIES = new String[]{"None", "GPRS", "EDGE", "UMTS"};
@@ -69,6 +73,7 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
public void setConfigurationSpecificEditor(ConfigurationSpecificEditor<T> configurationSpecificEditor) {
myConfigurationSpecificEditor = configurationSpecificEditor;
myConfigurationSpecificPanel.add(configurationSpecificEditor.getComponent());
setAnchor(myConfigurationSpecificEditor.getAnchor());
}
public AndroidRunConfigurationEditor(final Project project) {
@@ -144,6 +149,17 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
myAvdBox.getComboBox().setSelectedItem(selected);
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myModuleJBLabel.setAnchor(anchor);
}
private static boolean containsItem(JComboBox combo, @NotNull Object item) {
for (int i = 0, n = combo.getItemCount(); i < n; i++) {
if (item.equals(combo.getItemAt(i))) {
@@ -118,4 +118,13 @@ class ApplicationRunParameters implements ConfigurationSpecificEditor<AndroidRun
}
configuration.DEPLOY = myDeployAndInstallCheckBox.isSelected();
}
@Override
public JComponent getAnchor() {
return null;
}
@Override
public void setAnchor(JComponent anchor) {
}
}
@@ -16,6 +16,8 @@
package org.jetbrains.android.run;
import com.intellij.ui.ComponentWithAnchor;
import java.awt.*;
/**
@@ -25,7 +27,7 @@ import java.awt.*;
* Time: 7:22:44 PM
* To change this template use File | Settings | File Templates.
*/
public interface ConfigurationSpecificEditor<T> {
public interface ConfigurationSpecificEditor<T> extends ComponentWithAnchor {
void applyTo(T t);
void resetFrom(T t);
Component getComponent();
@@ -3,7 +3,7 @@
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="6" 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="475" height="187"/>
<xy x="20" y="20" width="475" height="159"/>
</constraints>
<properties/>
<border type="none"/>
@@ -38,11 +38,9 @@
<text resource-bundle="messages/AndroidBundle" key="android.run.configuration.method.radio"/>
</properties>
</component>
<component id="23c94" class="javax.swing.JLabel">
<component id="23c94" class="com.intellij.ui.components.JBLabel" binding="myLabelTest">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="29" height="30"/>
</grid>
<grid row="0" 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>
<horizontalAlignment value="2"/>
@@ -81,7 +79,6 @@
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="55" height="16"/>
<text resource-bundle="messages/AndroidBundle" key="android.run.configuration.class.label"/>
</properties>
</component>
@@ -92,7 +89,6 @@
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="55" height="16"/>
<text resource-bundle="messages/AndroidBundle" key="android.run.configuration.method.label"/>
</properties>
</component>
@@ -30,6 +30,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiPackage;
import com.intellij.ui.components.JBLabel;
import org.jetbrains.android.run.AndroidClassBrowser;
import org.jetbrains.android.run.ConfigurationSpecificEditor;
import org.jetbrains.android.util.AndroidBundle;
@@ -61,10 +62,12 @@ class TestRunParameters implements ConfigurationSpecificEditor<AndroidTestRunCon
private LabeledComponent<TextFieldWithBrowseButton> myMethodComponent;
private JPanel myPanel;
private LabeledComponent<TextFieldWithBrowseButton> myRunnerComponent;
private JBLabel myLabelTest;
private final JRadioButton[] myTestingType2RadioButton = new JRadioButton[4];
private final Project myProject;
private final ConfigurationModuleSelector myModuleSelector;
private JComponent anchor;
TestRunParameters(Project project, ConfigurationModuleSelector moduleSelector) {
myProject = project;
@@ -81,6 +84,8 @@ class TestRunParameters implements ConfigurationSpecificEditor<AndroidTestRunCon
addTestingType(TEST_ALL_IN_PACKAGE, myAllInPackageButton);
addTestingType(TEST_CLASS, myClassButton);
addTestingType(TEST_METHOD, myTestMethodButton);
setAnchor(myPackageComponent.getLabel());
}
private void addTestingType(final int type, JRadioButton button) {
@@ -92,6 +97,20 @@ class TestRunParameters implements ConfigurationSpecificEditor<AndroidTestRunCon
});
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myPackageComponent.setAnchor(anchor);
myClassComponent.setAnchor(anchor);
myMethodComponent.setAnchor(anchor);
myLabelTest.setAnchor(anchor);
}
private static void bind(final LabeledComponent<TextFieldWithBrowseButton> labeledComponent, BrowseModuleValueActionListener browser) {
browser.setField(labeledComponent.getComponent());
}
@@ -136,16 +136,13 @@ public class PluginRunConfigurationEditor extends SettingsEditor<PluginRunConfig
myVMParameters.setComponent(new RawCommandLineEditor());
myVMParameters.getComponent().setDialogCaption(myVMParameters.getRawText());
myVMParameters.setLabelLocation(BorderLayout.WEST);
myVMParameters.setAnchor(myProgramParameters.getLabel());
myProgramParameters.setText(DevKitBundle.message("program.parameters"));
myProgramParameters.setComponent(new RawCommandLineEditor());
myProgramParameters.getComponent().setDialogCaption(myProgramParameters.getRawText());
myProgramParameters.setLabelLocation(BorderLayout.WEST);
myProgramParameters.setLabelPreferredSize(myProgramParameters.getLabelPreferredSize());
myVMParameters.setLabelPreferredSize(myProgramParameters.getLabelPreferredSize());
GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0);
wholePanel.add(myVMParameters, gc);
wholePanel.add(myProgramParameters, gc);
@@ -157,6 +154,7 @@ public class PluginRunConfigurationEditor extends SettingsEditor<PluginRunConfig
gc.weighty = 1;
gc.gridx = 1;
gc.weightx = 1;
gc.insets.left = 10;
wholePanel.add(myModules, gc);
return wholePanel;
}
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<component id="c5c05" class="javax.swing.JLabel" binding="myVMParamsLabel">
<component id="c5c05" class="com.intellij.ui.components.JBLabel" binding="myVMParamsLabel">
<constraints>
<grid row="2" 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>
@@ -18,9 +18,7 @@
</component>
<component id="bb2b7" class="javax.swing.JLabel">
<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">
<preferred-size width="145" height="-1"/>
</grid>
<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>
<labelFor value="25c6f"/>
@@ -79,7 +77,6 @@
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="145" height="16"/>
</properties>
</component>
</children>
@@ -21,8 +21,10 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.components.JBLabel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.mvc.util.ModuleCellRenderer;
@@ -32,17 +34,18 @@ import java.awt.*;
import java.io.File;
import java.util.HashMap;
public class MvcRunConfigurationEditor<T extends MvcRunConfiguration> extends SettingsEditor<T> {
public class MvcRunConfigurationEditor<T extends MvcRunConfiguration> extends SettingsEditor<T> implements ComponentWithAnchor {
private DefaultComboBoxModel myModulesModel;
protected JComboBox myModulesBox;
private JPanel myMainPanel;
private RawCommandLineEditor myVMParameters;
private JTextField myCommandLine;
private JLabel myVMParamsLabel;
private JBLabel myVMParamsLabel;
private JPanel myExtensionPanel;
protected JCheckBox myDepsClasspath;
private EnvironmentVariablesComponent myEnvVariablesComponent;
private MvcFramework myFramework;
private JComponent anchor;
public MvcRunConfigurationEditor() {
myCommandLine.getDocument().addDocumentListener(new DocumentAdapter() {
@@ -51,6 +54,8 @@ public class MvcRunConfigurationEditor<T extends MvcRunConfiguration> extends Se
commandLineChanged(getCommandLine());
}
});
setAnchor(myEnvVariablesComponent.getLabel());
}
protected void resetEditorFrom(T configuration) {
@@ -95,6 +100,18 @@ public class MvcRunConfigurationEditor<T extends MvcRunConfiguration> extends Se
myDepsClasspath.setToolTipText("<html>&nbsp;" + StringUtil.replace(depsClasspath, File.pathSeparator, "<br>&nbsp;") + "</html>");
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myVMParamsLabel.setAnchor(anchor);
myEnvVariablesComponent.setAnchor(anchor);
}
protected static void setCBEnabled(boolean enabled, final JCheckBox checkBox) {
final boolean wasEnabled = checkBox.isEnabled();
checkBox.setEnabled(enabled);
@@ -35,45 +35,21 @@
</grid>
<grid id="4852" binding="workDirPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="5" column="1" 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"/>
<children/>
</grid>
<grid id="ee314" layout-manager="GridLayoutManager" row-count="1" 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>
<grid row="5" 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"/>
<children>
<component id="c934c" class="javax.swing.JCheckBox" binding="myDebugCB" default-binding="true">
<constraints>
<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>
<selected value="false"/>
</properties>
</component>
<hspacer id="317a0">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
<component id="39213" class="com.intellij.execution.configuration.EnvironmentVariablesComponent" binding="myEnvVariables">
<constraints>
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="145" height="16"/>
</properties>
</component>
<component id="5f62b" class="javax.swing.JLabel">
<component id="5f62b" class="com.intellij.ui.components.JBLabel" binding="myScriptParametersLabel">
<constraints>
<grid row="3" 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>
@@ -106,9 +82,7 @@
</component>
<component id="5194" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="145" height="-1"/>
</grid>
<grid row="0" 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="Script path:"/>
@@ -116,12 +90,21 @@
</component>
<component id="ae9d1" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<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>
<text value="Working directory:"/>
</properties>
</component>
<component id="c934c" class="javax.swing.JCheckBox" binding="myDebugCB" default-binding="true">
<constraints>
<grid row="6" 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>
<selected value="false"/>
<text resource-bundle="org/jetbrains/plugins/groovy/GroovyBundle" key="debug.option"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -27,8 +27,10 @@ import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.roots.ui.configuration.ModulesAlphaComparator;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ComboboxSpeedSearch;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.FieldPanel;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.components.JBLabel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.GroovyFileType;
@@ -37,7 +39,7 @@ import java.awt.*;
import java.util.*;
import java.util.List;
public class GroovyRunConfigurationEditor extends SettingsEditor<GroovyScriptRunConfiguration> {
public class GroovyRunConfigurationEditor extends SettingsEditor<GroovyScriptRunConfiguration> implements ComponentWithAnchor {
private DefaultComboBoxModel myModulesModel;
private JComboBox myModulesBox;
private JPanel myMainPanel;
@@ -47,8 +49,10 @@ public class GroovyRunConfigurationEditor extends SettingsEditor<GroovyScriptRun
private JPanel workDirPanel;
private JCheckBox myDebugCB;
private EnvironmentVariablesComponent myEnvVariables;
private JBLabel myScriptParametersLabel;
private final JTextField scriptPathField;
private final JTextField workDirField;
private JComponent anchor;
public GroovyRunConfigurationEditor() {
@@ -73,6 +77,8 @@ public class GroovyRunConfigurationEditor extends SettingsEditor<GroovyScriptRun
final FieldPanel workDirFieldPanel = new FieldPanel(workDirField, null, null, workDirBrowseFilesListener, null);
workDirPanel.setLayout(new BorderLayout());
workDirPanel.add(workDirFieldPanel, BorderLayout.CENTER);
setAnchor(myEnvVariables.getLabel());
}
public void resetEditorFrom(GroovyScriptRunConfiguration configuration) {
@@ -137,4 +143,16 @@ public class GroovyRunConfigurationEditor extends SettingsEditor<GroovyScriptRun
public void disposeEditor() {
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myScriptParametersLabel.setAnchor(anchor);
myEnvVariables.setAnchor(anchor);
}
}
@@ -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.junit2.configuration.JUnitConfigurable">
<grid id="ece1c" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="5">
<grid id="ece1c" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="5" 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="28" width="722" height="548"/>
@@ -45,7 +45,7 @@
<text resource-bundle="messages/ExecutionBundle" key="junit.configuration.method.radio"/>
</properties>
</component>
<component id="52bca" class="javax.swing.JLabel">
<component id="52bca" class="com.intellij.ui.components.JBLabel" binding="myTestLabel">
<constraints>
<grid row="0" 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>
@@ -97,7 +97,6 @@
<properties>
<enabled value="true"/>
<labelLocation value="West"/>
<labelPreferredSize width="62" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="junit.configuration.method.label"/>
</properties>
</component>
@@ -121,12 +120,11 @@
<properties>
<enabled value="true"/>
<labelLocation value="West"/>
<labelPreferredSize width="62" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="junit.configuration.package.label"/>
<visible value="true"/>
</properties>
</component>
<grid id="c9a5f" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="c9a5f" layout-manager="GridLayoutManager" row-count="1" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<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"/>
@@ -166,6 +164,11 @@
<text resource-bundle="messages/ExecutionBundle" key="junit.configuration.across.module.dependencies.radio"/>
</properties>
</component>
<hspacer id="c14ec">
<constraints>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</children>
@@ -177,7 +180,6 @@
<properties>
<componentClass value="javax.swing.JPanel"/>
<labelLocation value="West"/>
<labelPreferredSize width="62" height="16"/>
<text value="Pattern"/>
<visible value="true"/>
</properties>
@@ -188,7 +190,6 @@
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="62" height="16"/>
<text resource-bundle="messages/ExecutionBundle" key="junit.configuration.class.label"/>
</properties>
</component>
@@ -199,7 +200,6 @@
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="62" height="16"/>
<text value="Directory"/>
</properties>
</component>
@@ -212,8 +212,8 @@
<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>
<grid id="92997" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="10">
<margin top="5" left="0" bottom="5" right="0"/>
<grid id="92997" layout-manager="GridLayoutManager" row-count="4" 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="3" 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>
@@ -224,31 +224,32 @@
<constraints>
<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"/>
</constraints>
<properties>
<labelsPreferredSize width="213" height="16"/>
</properties>
<properties/>
</component>
<component id="350c9" class="com.intellij.openapi.ui.LabeledComponent" binding="myModule">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="javax.swing.JComboBox"/>
<enabled value="true"/>
<labelInsets top="7" left="0" bottom="2" right="0"/>
<labelLocation value="West"/>
<labelPreferredSize width="213" height="25"/>
<text resource-bundle="messages/ExecutionBundle" key="junit.configuration.use.classpath.and.jdk.of.module.label"/>
</properties>
</component>
<component id="e5163" class="com.intellij.execution.ui.AlternativeJREPanel" binding="myAlternativeJREPanel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" 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="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<checkBoxPreferredSize width="213" height="23"/>
</properties>
<properties/>
</component>
<vspacer id="5d352">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="15"/>
</grid>
</constraints>
</vspacer>
</children>
</grid>
<grid id="ca987" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -46,9 +46,11 @@ import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.EditorTextField;
import com.intellij.ui.EditorTextFieldWithBrowseButton;
import com.intellij.ui.InsertPathAction;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.PlatformIcons;
import com.intellij.util.TextFieldCompletionProvider;
import gnu.trove.TIntArrayList;
@@ -66,7 +68,7 @@ import java.awt.event.ActionListener;
import java.util.Arrays;
import java.util.List;
public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> {
public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implements ComponentWithAnchor {
private static final List<TIntArrayList> ourEnabledFields = Arrays.asList(
new TIntArrayList(new int[]{0}),
new TIntArrayList(new int[]{1}),
@@ -105,12 +107,14 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> {
private final BrowseModuleValueActionListener[] myBrowsers;
private AlternativeJREPanel myAlternativeJREPanel;
private JComboBox myForkCb;
private JBLabel myTestLabel;
@NonNls private static final String NONE = "none";
@NonNls private static final String METHOD = "method";
@NonNls private static final String KLASS = "class";
private static final String[] FORK_MODE_ALL = {NONE, METHOD, KLASS};
private static final String[] FORK_MODE = {NONE, METHOD};
private Project myProject;
private JComponent anchor;
public JUnitConfigurable(final Project project) {
myProject = project;
@@ -197,6 +201,9 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> {
});
myCommonJavaParameters.getProgramParametersComponent().setVisible(false);
setAnchor(myDir.getLabel());
myAlternativeJREPanel.setAnchor(myModule.getLabel());
}
public void applyEditorTo(final JUnitConfiguration configuration) {
@@ -372,6 +379,22 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> {
myMethod.setComponent(textFieldWithBrowseButton);
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myTestLabel.setAnchor(anchor);
myClass.setAnchor(anchor);
myDir.setAnchor(anchor);
myMethod.setAnchor(anchor);
myPattern.setAnchor(anchor);
myPackage.setAnchor(anchor);
}
private static void addRadioButtonsListeners(final JRadioButton[] radioButtons, ChangeListener listener) {
final ButtonGroup group = new ButtonGroup();
for (final JRadioButton radioButton : radioButtons) {
@@ -63,6 +63,7 @@ public abstract class MavenRunnerConfigurable implements SearchableConfigurable
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.WEST;
c.insets.bottom = 5;
myRunInBackgroundCheckbox = new JCheckBox("Run in background");
myRunInBackgroundCheckbox.setMnemonic('b');
@@ -15,7 +15,7 @@
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="195" height="16"/>
<text value="Working &amp;directory"/>
</properties>
</component>
@@ -32,7 +32,7 @@
<componentClass value="javax.swing.JTextField"/>
<labelInsets top="0" left="0" bottom="0" right="0"/>
<labelLocation value="West"/>
<labelPreferredSize width="195" height="16"/>
<text value="&amp;Goals (separated with space)"/>
</properties>
</component>
@@ -43,7 +43,7 @@
<properties>
<componentClass value="javax.swing.JTextField"/>
<labelLocation value="West"/>
<labelPreferredSize width="195" height="16"/>
<text value="&amp;Profiles (separated with space)"/>
</properties>
</component>
@@ -21,6 +21,7 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ComponentWithAnchor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.model.MavenConstants;
@@ -31,11 +32,12 @@ import javax.swing.*;
/**
* @author Vladislav.Kaznacheev
*/
public abstract class MavenRunnerParametersConfigurable implements Configurable {
public abstract class MavenRunnerParametersConfigurable implements Configurable, ComponentWithAnchor {
private JPanel panel;
protected LabeledComponent<TextFieldWithBrowseButton> workingDirComponent;
protected LabeledComponent<JTextField> goalsComponent;
private LabeledComponent<JTextField> profilesComponent;
private JComponent anchor;
public MavenRunnerParametersConfigurable() {
workingDirComponent.getComponent().addBrowseFolderListener(
@@ -47,6 +49,8 @@ public abstract class MavenRunnerParametersConfigurable implements Configurable
return file.findChild(MavenConstants.POM_XML) != null;
}
});
setAnchor(profilesComponent.getLabel());
}
public JComponent createComponent() {
@@ -98,4 +102,17 @@ public abstract class MavenRunnerParametersConfigurable implements Configurable
}
protected abstract MavenRunnerParameters getParameters();
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
workingDirComponent.setAnchor(anchor);
goalsComponent.setAnchor(anchor);
profilesComponent.setAnchor(anchor);
}
}
@@ -15,7 +15,6 @@
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="190" height="16"/>
<text value="User &amp;settings file"/>
</properties>
</component>
@@ -27,14 +26,6 @@
<text value="Override"/>
</properties>
</component>
<component id="b0be5" class="javax.swing.JCheckBox" binding="mavenHomeOverrideCheckBox" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="6" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Override"/>
</properties>
</component>
<vspacer id="9e56d">
<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"/>
@@ -47,7 +38,6 @@
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="190" height="16"/>
<text value="Local &amp;repository"/>
</properties>
</component>
@@ -59,10 +49,10 @@
<text value="Override"/>
</properties>
</component>
<grid id="d6902" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<grid id="d6902" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<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="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"/>
@@ -74,7 +64,6 @@
<properties>
<componentClass value="com.intellij.openapi.ui.TextFieldWithBrowseButton"/>
<labelLocation value="West"/>
<labelPreferredSize width="190" height="16"/>
<text value="Maven &amp;home directory"/>
</properties>
</component>
@@ -90,6 +79,14 @@
<verticalTextPosition value="1"/>
</properties>
</component>
<component id="b0be5" class="javax.swing.JCheckBox" binding="mavenHomeOverrideCheckBox" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="6" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Override"/>
</properties>
</component>
</children>
</grid>
</children>
@@ -22,6 +22,7 @@ import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.DocumentAdapter;
import com.intellij.util.Alarm;
import com.intellij.util.ui.UIUtil;
@@ -35,7 +36,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
public class MavenEnvironmentForm {
public class MavenEnvironmentForm implements ComponentWithAnchor {
private JPanel panel;
private LabeledComponent<TextFieldWithBrowseButton> mavenHomeComponent;
private LabeledComponent<TextFieldWithBrowseButton> settingsFileComponent;
@@ -43,6 +44,7 @@ public class MavenEnvironmentForm {
private JCheckBox mavenHomeOverrideCheckBox;
private JCheckBox settingsOverrideCheckBox;
private JCheckBox localRepositoryOverrideCheckBox;
private JComponent anchor;
private final PathOverrider mavenHomeOverrider;
private final PathOverrider userSettingsFileOverrider;
@@ -95,6 +97,8 @@ public class MavenEnvironmentForm {
settingsFileComponent.getComponent().getText());
}
});
setAnchor(mavenHomeComponent.getLabel());
}
public boolean isModified(MavenGeneralSettings data) {
@@ -126,6 +130,19 @@ public class MavenEnvironmentForm {
return panel;
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
mavenHomeComponent.setAnchor(anchor);
settingsFileComponent.setAnchor(anchor);
localRepositoryComponent.setAnchor(anchor);
}
private static abstract class PathProvider {
public String getPath() {
final File file = getFile();
@@ -40,12 +40,9 @@
</constraints>
<properties/>
</component>
<component id="83fac" class="javax.swing.JLabel">
<component id="83fac" class="com.intellij.ui.components.JBLabel" binding="myMultiprojectBuildFailPolicyLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="190" height="-1"/>
<preferred-size width="190" height="-1"/>
</grid>
<grid row="6" 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="c58ed"/>
@@ -19,6 +19,8 @@ package org.jetbrains.idea.maven.project;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.Function;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
@@ -33,7 +35,7 @@ import java.util.Arrays;
/**
* @author Ralf Quebbemann (ralfq@codehaus.org)
*/
public abstract class MavenGeneralConfigurable implements SearchableConfigurable {
public abstract class MavenGeneralConfigurable implements SearchableConfigurable, ComponentWithAnchor {
private JCheckBox checkboxWorkOffline;
private JPanel panel;
private JComboBox outputLevelCombo;
@@ -45,11 +47,13 @@ public abstract class MavenGeneralConfigurable implements SearchableConfigurable
private JCheckBox checkboxRecursive;
private MavenEnvironmentForm mavenPathsForm;
private JComboBox snapshotUpdatePolicyCombo;
private JBLabel myMultiprojectBuildFailPolicyLabel;
private final DefaultComboBoxModel outputLevelComboModel = new DefaultComboBoxModel();
private final DefaultComboBoxModel checksumPolicyComboModel = new DefaultComboBoxModel();
private final DefaultComboBoxModel failPolicyComboModel = new DefaultComboBoxModel();
private final DefaultComboBoxModel snapshotUpdatePolicyComboModel = new DefaultComboBoxModel();
private final DefaultComboBoxModel pluginUpdatePolicyComboModel = new DefaultComboBoxModel();
private JComponent anchor;
protected abstract MavenGeneralSettings getState();
@@ -59,6 +63,8 @@ public abstract class MavenGeneralConfigurable implements SearchableConfigurable
fillFailureBehaviorCombobox();
fillPluginUpdatePolicyCombobox();
fillSnapshotUpdatePolicyCombobox();
setAnchor(myMultiprojectBuildFailPolicyLabel);
}
private void fillOutputLevelCombobox() {
@@ -192,4 +198,16 @@ public abstract class MavenGeneralConfigurable implements SearchableConfigurable
public Runnable enableSearch(String option) {
return null;
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
myMultiprojectBuildFailPolicyLabel.setAnchor(anchor);
mavenPathsForm.setAnchor(anchor);
}
}
@@ -49,7 +49,6 @@
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="109" height="16"/>
<text value="M&amp;ethod"/>
</properties>
</component>
@@ -59,7 +58,6 @@
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="109" height="16"/>
<text value="&amp;Suite"/>
</properties>
</component>
@@ -85,7 +83,6 @@
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="109" height="16"/>
<text value="Packa&amp;ge"/>
</properties>
</component>
@@ -124,7 +121,6 @@
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="109" height="16"/>
<text value="&amp;Class"/>
</properties>
</component>
@@ -134,7 +130,6 @@
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="109" height="16"/>
<text value="&amp;Output directory"/>
</properties>
</component>
@@ -144,7 +139,6 @@
</constraints>
<properties>
<labelLocation value="West"/>
<labelPreferredSize width="109" height="16"/>
<text value="&amp;Group"/>
</properties>
</component>
@@ -159,7 +153,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="fab89" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="fab89" 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>
<tabbedpane title="JDK Settings"/>
@@ -169,21 +163,18 @@
<children>
<component id="6ab4" class="com.intellij.openapi.ui.LabeledComponent" binding="moduleClasspath">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="2" 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>
<labelLocation value="West"/>
<labelPreferredSize width="213" height="16"/>
<text value="Use classpath and JDK of m&amp;odule"/>
</properties>
</component>
<component id="baac2" class="com.intellij.execution.ui.AlternativeJREPanel" binding="alternateJDK">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" 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="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<checkBoxPreferredSize width="213" height="23"/>
</properties>
<properties/>
</component>
<grid id="f5de" binding="commonParametersPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
@@ -195,7 +186,14 @@
</grid>
<vspacer id="15fd">
<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>
<vspacer id="348fc">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="15"/>
</grid>
</constraints>
</vspacer>
</children>
@@ -48,6 +48,7 @@ import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.ComponentWithAnchor;
import com.intellij.ui.EditorTextFieldWithBrowseButton;
import com.intellij.ui.table.TableView;
import com.intellij.util.TextFieldCompletionProvider;
@@ -68,8 +69,7 @@ import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Map;
public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguration>
{
public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguration> implements ComponentWithAnchor {
//private static final Logger LOGGER = Logger.getInstance("TestNG Runner");
private final Project project;
@@ -89,6 +89,7 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
private LabeledComponent<EditorTextFieldWithBrowseButton> packageField;
private LabeledComponent<TextFieldWithBrowseButton.NoPathCompletion> groupField;
private LabeledComponent<TextFieldWithBrowseButton> suiteField;
private JComponent anchor;
private JRadioButton packagesInProject;
private JRadioButton packagesInModule;
private JRadioButton packagesAcrossModules;
@@ -119,7 +120,6 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
createView();
moduleSelector = new ConfigurationModuleSelector(project, getModulesComponent());
commonJavaParameters.setModuleContext(moduleSelector.getModule());
commonJavaParameters.setLabelsPreferredSize(moduleClasspath.getLabelPreferredSize());
moduleClasspath.getComponent().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
commonJavaParameters.setModuleContext(moduleSelector.getModule());
@@ -181,6 +181,9 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
outputDirectory.getComponent().getTextField().setDocument(model.getOutputDirectoryDocument());
commonJavaParameters.setProgramParametersLabel(ExecutionBundle.message("junit.configuration.test.runner.parameters.label"));
setAnchor(outputDirectory.getLabel());
alternateJDK.setAnchor(moduleClasspath.getLabel());
}
private void evaluateModuleClassPath() {
@@ -293,6 +296,22 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
return panel;
}
@Override
public JComponent getAnchor() {
return anchor;
}
@Override
public void setAnchor(JComponent anchor) {
this.anchor = anchor;
methodField.setAnchor(anchor);
packageField.setAnchor(anchor);
groupField.setAnchor(anchor);
suiteField.setAnchor(anchor);
outputDirectory.setAnchor(anchor);
classField.setAnchor(anchor);
}
private static void registerListener(JRadioButton[] buttons, ChangeListener changelistener) {
ButtonGroup buttongroup = new ButtonGroup();
for (JRadioButton button : buttons) {