From 14693cda9c68c0fe90839e1413ac55837eaa3432 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Tue, 17 May 2011 12:27:30 +0200 Subject: [PATCH] Platform: Code Style Settings: General Settings page layout --- .../options/GeneralCodeStylePanel.form | 139 ++++++++---------- .../options/GeneralCodeStylePanel.java | 17 +-- .../MultilanguageCodeStyleAbstractPanel.java | 2 - .../src/com/intellij/ui/OptionGroup.java | 12 +- .../src/messages/ApplicationBundle.properties | 2 +- .../options/CodeStyleHtmlPanel.form | 4 +- .../options/CodeStyleXmlPanel.form | 4 +- 7 files changed, 78 insertions(+), 102 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.form b/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.form index 5ebc513da972..0601853c2d04 100644 --- a/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.form +++ b/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.form @@ -1,99 +1,82 @@
- - + - + - + - - - + - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + diff --git a/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.java b/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.java index 9e76d183d11c..1f4075845c8a 100644 --- a/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.java +++ b/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.java @@ -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(); } diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/MultilanguageCodeStyleAbstractPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/MultilanguageCodeStyleAbstractPanel.java index c334789c2ff7..ba3ef50a3abf 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/MultilanguageCodeStyleAbstractPanel.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/MultilanguageCodeStyleAbstractPanel.java @@ -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; } diff --git a/platform/platform-api/src/com/intellij/ui/OptionGroup.java b/platform/platform-api/src/com/intellij/ui/OptionGroup.java index e13e7d31f966..17ca00ff55cb 100644 --- a/platform/platform-api/src/com/intellij/ui/OptionGroup.java +++ b/platform/platform-api/src/com/intellij/ui/OptionGroup.java @@ -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; diff --git a/platform/platform-resources-en/src/messages/ApplicationBundle.properties b/platform/platform-resources-en/src/messages/ApplicationBundle.properties index 54eb4960eebe..e2bfae85d90f 100644 --- a/platform/platform-resources-en/src/messages/ApplicationBundle.properties +++ b/platform/platform-resources-en/src/messages/ApplicationBundle.properties @@ -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): diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.form b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.form index 293a4677aa19..9dab3f92f355 100644 --- a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.form +++ b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.form @@ -3,7 +3,7 @@ - + @@ -297,7 +297,7 @@ - + diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.form b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.form index 9ed4de06b480..1259549892c4 100644 --- a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.form +++ b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.form @@ -3,7 +3,7 @@ - + @@ -14,7 +14,7 @@ - +