Platform: Code Style Settings: General Settings page layout

This commit is contained in:
Anton Makeev
2011-05-18 13:28:36 +02:00
parent e884f7e97a
commit 14693cda9c
7 changed files with 78 additions and 102 deletions
@@ -1,99 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.GeneralCodeStylePanel">
<grid id="56a6e" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<grid id="56a6e" binding="myPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<xy x="35" y="113" width="445" height="202"/>
<xy x="35" y="113" width="703" height="502"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="aeec3" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="6a116" 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>
<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"/>
</constraints>
<constraints border-constraint="West"/>
<properties/>
<border type="none"/>
<children>
<grid id="6a116" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="8" bottom="0" right="0"/>
<component id="612e6" class="javax.swing.JComboBox" binding="myLineSeparatorCombo">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="0" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="100" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="b1e0c" class="javax.swing.JLabel">
<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>
<labelFor value="535f"/>
<text resource-bundle="messages/ApplicationBundle" key="editbox.right.margin.columns"/>
</properties>
</component>
<component id="535f" class="javax.swing.JTextField" binding="myRightMarginField">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="5"/>
</properties>
</component>
<component id="15ab4" 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"/>
</constraints>
<properties>
<labelFor value="612e6"/>
<text resource-bundle="messages/ApplicationBundle" key="combobox.line.separator.for.new.files"/>
</properties>
</component>
<component id="4104b" class="javax.swing.JCheckBox" binding="myCbWrapWhenTypingReachesRightMargin" default-binding="true">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.wrap.typing.on.right.margin"/>
</properties>
</component>
<vspacer id="f290d">
<constraints>
<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="23b0" binding="myIndentPanel" 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>
<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"/>
<children>
<component id="612e6" class="javax.swing.JComboBox" binding="myLineSeparatorCombo">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="100" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="b1e0c" 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"/>
</constraints>
<properties>
<labelFor value="535f"/>
<text resource-bundle="messages/ApplicationBundle" key="editbox.right.margin.columns"/>
</properties>
</component>
<component id="535f" class="javax.swing.JTextField" binding="myRightMarginField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="50" height="-1"/>
<maximum-size width="50" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="15ab4" class="javax.swing.JLabel">
<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>
<labelFor value="612e6"/>
<text resource-bundle="messages/ApplicationBundle" key="combobox.line.separator.for.new.files"/>
</properties>
</component>
<component id="4104b" class="javax.swing.JCheckBox" binding="myCbWrapWhenTypingReachesRightMargin" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.wrap.typing.on.right.margin"/>
</properties>
</component>
</children>
<children/>
</grid>
<xy id="fda61" binding="myIndentPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<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="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</xy>
<xy id="7f33f" binding="myPreviewPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="etched" title-resource-bundle="messages/ApplicationBundle" title-key="title.preview"/>
<children/>
</xy>
</children>
</grid>
<vspacer id="d3c83">
<constraints>
<grid row="1" 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="7f33f" binding="myPreviewPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
</form>
@@ -41,8 +41,10 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import java.awt.*;
import java.util.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class GeneralCodeStylePanel extends CodeStyleAbstractPanel {
private static final Logger LOG = Logger.getInstance("#com.intellij.application.options.GeneralCodeStylePanel");
@@ -127,10 +129,7 @@ public class GeneralCodeStylePanel extends CodeStyleAbstractPanel {
}
private JPanel createTabOptionsPanel() {
OptionGroup optionGroup = new OptionGroup(ApplicationBundle.message("group.tabs.and.indents"));
myCbUseSameIndents = new JCheckBox(ApplicationBundle.message("checkbox.indent.use.same.settings.for.all.file.types"));
optionGroup.add(myCbUseSameIndents);
OptionGroup optionGroup = new OptionGroup(null);
myIndentOptionsTabs = new TabbedPaneWrapper(this);
@@ -162,12 +161,8 @@ public class GeneralCodeStylePanel extends CodeStyleAbstractPanel {
optionGroup.add(myIndentOptionsTabs.getComponent());
/*
UiNotifyConnector.doWhenFirstShown(myPanel, new Runnable() {
public void run() {
updatePreviewEditor();
}
});*/
myCbUseSameIndents = new JCheckBox(ApplicationBundle.message("checkbox.indent.use.same.settings.for.all.file.types"));
optionGroup.add(myCbUseSameIndents, true);
return optionGroup.createPanel();
}
@@ -34,7 +34,6 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable;
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
@@ -193,7 +192,6 @@ public abstract class MultilanguageCodeStyleAbstractPanel extends CodeStyleAbstr
protected static JPanel createPreviewPanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(IdeBorderFactory.createTitledBorder("Preview"));
panel.setPreferredSize(new Dimension(200, 0));
return panel;
}
@@ -69,7 +69,6 @@ public class OptionGroup {
panel.setLayout(new GridBagLayout());
for (int i = 0; i < myOptions.size(); i++) {
int weighty = 0;
int leftInset = Boolean.TRUE.equals(myIsShifted.get(i)) ? 15 : 5;
if (myTitle == null) {
leftInset -= 4;
@@ -79,27 +78,28 @@ public class OptionGroup {
JComponent component = (JComponent)option;
int verticalInset = component instanceof JLabel || component instanceof JTextField ? 2 : 0;
panel.add(component,
new GridBagConstraints(0, i, 2, 1, 1, weighty, GridBagConstraints.NORTHWEST, getFill(component),
new GridBagConstraints(0, i, GridBagConstraints.REMAINDER , 1, 1, 0, GridBagConstraints.NORTHWEST, getFill(component),
new Insets(verticalInset, leftInset, verticalInset, 5), 0, 0));
}
else {
Pair pair = (Pair)option;
JComponent firstComponent = (JComponent)pair.first;
int verticalInset = firstComponent instanceof JLabel || firstComponent instanceof JTextField ? 2 : 0;
int verticalInset = firstComponent instanceof JLabel || firstComponent instanceof JTextField ? 1 : 0;
panel.add(firstComponent,
new GridBagConstraints(0, i, 1, 1, 1, weighty, GridBagConstraints.WEST, getFill(firstComponent),
new GridBagConstraints(0, i, 1, 1, 1, 0, GridBagConstraints.WEST, getFill(firstComponent),
new Insets(verticalInset, leftInset, verticalInset, 5), 0, 0));
JComponent secondComponent = (JComponent)pair.second;
verticalInset = secondComponent instanceof JLabel || secondComponent instanceof JTextField ? 2 : 0;
panel.add(secondComponent,
new GridBagConstraints(1, i, 1, 1, 0, weighty, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL,
new GridBagConstraints(1, i, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL,
new Insets(verticalInset, 5, verticalInset, 5), 0, 0));
}
}
JPanel p = new JPanel();
p.setPreferredSize(new Dimension(0, 0));
panel.add(p,
new GridBagConstraints(0, myOptions.size(), 2, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL,
new GridBagConstraints(0, myOptions.size(), GridBagConstraints.REMAINDER, 1, 0, 1,
GridBagConstraints.NORTH, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
return panel;
@@ -413,7 +413,7 @@ combobox.crlf.unix=Unix \n
combobox.crlf.windows=Windows \r\n
combobox.crlf.mac=Mac \r
group.tabs.and.indents=Tabs and Indents
checkbox.indent.use.same.settings.for.all.file.types=Use same settings for all file types
checkbox.indent.use.same.settings.for.all.file.types=Use same indentation for all file types
tab.indent.other=Other
combobox.line.separator.for.new.files=Line separator (for new files):
editbox.right.margin.columns=Right margin (columns):
@@ -3,7 +3,7 @@
<grid id="97358" binding="myPanel" 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>
<xy x="4" y="8" width="552" height="441"/>
<xy x="4" y="8" width="552" height="486"/>
</constraints>
<properties/>
<border type="none"/>
@@ -297,7 +297,7 @@
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="etched" title-resource-bundle="messages/ApplicationBundle" title-key="title.preview"/>
<border type="none"/>
<children/>
</xy>
</children>
@@ -3,7 +3,7 @@
<grid id="634cb" binding="myPanel" 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>
<xy x="12" y="7" width="394" height="417"/>
<xy x="12" y="7" width="454" height="436"/>
</constraints>
<properties/>
<border type="none"/>
@@ -14,7 +14,7 @@
<grid row="0" 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="etched" title-resource-bundle="messages/ApplicationBundle" title-key="title.preview"/>
<border type="none"/>
<children/>
</xy>
<grid id="ec55b" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">