mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Right margin option UI for XML
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -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;
|
||||
@@ -40,6 +41,14 @@ public class XmlLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSetti
|
||||
return "";
|
||||
}
|
||||
|
||||
@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());
|
||||
|
||||
Reference in New Issue
Block a user