diff options
Diffstat (limited to 'xml/impl/src/com/intellij/application/options')
6 files changed, 66 insertions, 12 deletions
diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.form b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.form index 01f7df00f6bd..0ddd4cf577f3 100644 --- a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.form +++ b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.form @@ -17,7 +17,7 @@ <border type="none"/> <children/> </xy> - <grid id="1b801" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <grid id="1b801" 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"/> <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"/> @@ -27,14 +27,14 @@ <children> <scrollpane id="3e3f1" class="com.intellij.ui.components.JBScrollPane" binding="myJBScrollPane" custom-create="true"> <constraints> - <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/> + <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <horizontalScrollBarPolicy value="31"/> </properties> <border type="empty"/> <children> - <grid id="b4cfb" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <grid id="b4cfb" 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/> <properties/> @@ -43,7 +43,7 @@ <grid id="ca5bb" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <margin top="0" left="0" bottom="0" right="0"/> <constraints> - <grid row="2" 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="3" 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> <properties/> <border type="none"/> @@ -185,7 +185,7 @@ <grid id="b8acc" 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="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"/> + <grid row="2" 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> <properties/> <border type="none"/> @@ -277,7 +277,7 @@ <grid id="6dece" 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="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="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"/> </constraints> <properties/> <border type="none"/> @@ -336,6 +336,15 @@ </component> </children> </grid> + <grid id="eb695" binding="myRightMarginPanel" custom-create="true" 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="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + </constraints> + <properties/> + <border type="none"/> + <children/> + </grid> </children> </grid> </children> diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java index ba5a72a80beb..476181ff256d 100644 --- a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java +++ b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java @@ -15,6 +15,7 @@ */ package com.intellij.application.options; +import com.intellij.application.options.codeStyle.RightMarginForm; import com.intellij.ide.highlighter.XmlHighlighterFactory; import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.editor.colors.EditorColorsScheme; @@ -30,6 +31,7 @@ import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.ui.components.JBScrollPane; import com.intellij.util.ArrayUtil; import com.intellij.util.PlatformIcons; +import com.intellij.util.ui.Centerizer; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -64,6 +66,8 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { private JCheckBox myShouldKeepLineBreaksInText; private TextFieldWithBrowseButton myDontBreakIfInlineContent; private JBScrollPane myJBScrollPane; + private JPanel myRightMarginPanel; + private RightMarginForm myRightMarginForm; public CodeStyleHtmlPanel(CodeStyleSettings settings) { super(settings); @@ -95,6 +99,8 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { } private void createUIComponents() { + myRightMarginForm = new RightMarginForm(StdFileTypes.HTML.getLanguage(), getSettings()); + myRightMarginPanel = myRightMarginForm.getTopPanel(); myJBScrollPane = new JBScrollPane() { @Override public Dimension getPreferredSize() { @@ -158,6 +164,7 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { settings.HTML_KEEP_WHITESPACES_INSIDE = myKeepWhiteSpacesTagNames.getText(); settings.HTML_KEEP_LINE_BREAKS = myShouldKeepBlankLines.isSelected(); settings.HTML_KEEP_LINE_BREAKS_IN_TEXT = myShouldKeepLineBreaksInText.isSelected(); + myRightMarginForm.apply(settings); } private static int getIntValue(JTextField keepBlankLines) { @@ -190,6 +197,7 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { myInlineElementsTagNames.setText(settings.HTML_INLINE_ELEMENTS); myDontBreakIfInlineContent.setText(settings.HTML_DONT_ADD_BREAKS_IF_INLINE_CONTENT); myKeepWhiteSpacesTagNames.setText(settings.HTML_KEEP_WHITESPACES_INSIDE); + myRightMarginForm.reset(settings); } @Override @@ -260,7 +268,7 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { return true; } - return false; + return myRightMarginForm.isModified(settings); } @Override diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.form b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.form index 28d48d089cc1..c7895930be0f 100644 --- a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.form +++ b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.form @@ -17,7 +17,7 @@ </properties> <border type="empty"/> <children> - <grid id="265f" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <grid id="265f" 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/> <properties/> @@ -26,7 +26,7 @@ <grid id="417cd" 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"/> <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"/> + <grid row="2" 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> <properties/> <border type="none"/> @@ -114,7 +114,7 @@ <grid id="e7045" 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="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="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"/> </constraints> <properties/> <border type="none"/> @@ -176,7 +176,7 @@ <grid id="bcc6c" layout-manager="GridLayoutManager" row-count="2" 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="3" hsize-policy="3" anchor="0" fill="3" 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="3" indent="0" use-parent-layout="false"/> </constraints> <properties/> <clientProperties> @@ -215,6 +215,15 @@ </component> </children> </grid> + <grid id="3d661" binding="myRightMarginPanel" custom-create="true" 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="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + </constraints> + <properties/> + <border type="none"/> + <children/> + </grid> </children> </grid> </children> diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java index ab3126162dde..8767e00de1ec 100644 --- a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java +++ b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java @@ -15,6 +15,7 @@ */ package com.intellij.application.options; +import com.intellij.application.options.codeStyle.RightMarginForm; import com.intellij.ide.highlighter.XmlHighlighterFactory; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.highlighter.EditorHighlighter; @@ -25,6 +26,7 @@ import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.formatter.xml.XmlCodeStyleSettings; import com.intellij.ui.components.JBScrollPane; +import org.apache.xmlbeans.XmlLanguage; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -48,6 +50,8 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ private JComboBox myWhiteSpaceAroundCDATA; private JCheckBox myKeepWhitespaceInsideCDATACheckBox; private JBScrollPane myJBScrollPane; + private JPanel myRightMarginPanel; + private RightMarginForm myRightMarginForm; public CodeStyleXmlPanel(CodeStyleSettings settings) { super(settings); @@ -83,6 +87,7 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = myInEmptyTag.isSelected(); xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = myWhiteSpaceAroundCDATA.getSelectedIndex(); xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA = myKeepWhitespaceInsideCDATACheckBox.isSelected(); + myRightMarginForm.apply(settings); } private int getIntValue(JTextField keepBlankLines) { @@ -109,6 +114,7 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ myWrapText.setSelected(wrapText(settings)); myWhiteSpaceAroundCDATA.setSelectedIndex(xmlSettings.XML_WHITE_SPACE_AROUND_CDATA); myKeepWhitespaceInsideCDATACheckBox.setSelected(xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA); + myRightMarginForm.reset(settings); } @Override @@ -156,7 +162,7 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ return true; } - return false; + return myRightMarginForm.isModified(settings); } private boolean wrapText(final CodeStyleSettings settings) { @@ -193,5 +199,7 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ return new Dimension(prefSize.width + 15, prefSize.height); } }; + myRightMarginForm = new RightMarginForm(StdFileTypes.XML.getLanguage(), getSettings()); + myRightMarginPanel = myRightMarginForm.getTopPanel(); } } diff --git a/xml/impl/src/com/intellij/application/options/HtmlLanguageCodeStyleSettings.java b/xml/impl/src/com/intellij/application/options/HtmlLanguageCodeStyleSettings.java index aa36d1b9aa60..d970ee5008cf 100644 --- a/xml/impl/src/com/intellij/application/options/HtmlLanguageCodeStyleSettings.java +++ b/xml/impl/src/com/intellij/application/options/HtmlLanguageCodeStyleSettings.java @@ -17,10 +17,13 @@ package com.intellij.application.options; import com.intellij.lang.Language; import com.intellij.lang.html.HTMLLanguage; +import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider; import org.jetbrains.annotations.NotNull; +import java.util.Set; + /** * @author Rustam Vishnyakov */ @@ -37,6 +40,14 @@ public class HtmlLanguageCodeStyleSettings extends LanguageCodeStyleSettingsProv } @Override + public void customizeSettings(@NotNull CodeStyleSettingsCustomizable consumer, + @NotNull SettingsType settingsType) { + if (settingsType == SettingsType.WRAPPING_AND_BRACES_SETTINGS) { + consumer.showStandardOptions("RIGHT_MARGIN"); + } + } + + @Override public CommonCodeStyleSettings getDefaultCommonSettings() { CommonCodeStyleSettings defaultSettings = new CommonCodeStyleSettings(HTMLLanguage.INSTANCE); defaultSettings.initIndentOptions(); diff --git a/xml/impl/src/com/intellij/application/options/XmlLanguageCodeStyleSettingsProvider.java b/xml/impl/src/com/intellij/application/options/XmlLanguageCodeStyleSettingsProvider.java index 651c71e7ee7d..89311331d59b 100644 --- a/xml/impl/src/com/intellij/application/options/XmlLanguageCodeStyleSettingsProvider.java +++ b/xml/impl/src/com/intellij/application/options/XmlLanguageCodeStyleSettingsProvider.java @@ -17,6 +17,7 @@ package com.intellij.application.options; import com.intellij.lang.Language; import com.intellij.lang.xml.XMLLanguage; +import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider; import com.intellij.util.PlatformUtils; @@ -41,6 +42,14 @@ public class XmlLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSetti } @Override + public void customizeSettings(@NotNull CodeStyleSettingsCustomizable consumer, + @NotNull SettingsType settingsType) { + if (settingsType == SettingsType.WRAPPING_AND_BRACES_SETTINGS) { + consumer.showStandardOptions("RIGHT_MARGIN"); + } + } + + @Override public CommonCodeStyleSettings getDefaultCommonSettings() { CommonCodeStyleSettings xmlSettings = new CommonCodeStyleSettings(getLanguage()); CommonCodeStyleSettings.IndentOptions indentOptions = xmlSettings.initIndentOptions(); |