Emmet: add 'allow compact attributes' option in UI

This commit is contained in:
Alexander Zolotov
2014-12-19 21:25:50 +03:00
parent 9e16b71a2d
commit 1400e9cfa8
3 changed files with 19 additions and 3 deletions
@@ -217,6 +217,8 @@ emmet.configuration.title=Emmet
emmet.enable.label=&Enable XML Emmet
emmet.filters.enabled.by.default=Filters enabled by default
emmet.enable.preview=Enable &abbreviation preview
emmet.allow.compact.boolean.attributes=Allow &compact boolean attributes in HTML (use <div attr> instead of <div attr="attr">)
emmet.boolean.attributes=Boolean attributes
emmet.expand.abbreviation.with=Expand &abbreviation with
title.cannot.create.html.file=Cannot create HTML file
@@ -3,12 +3,12 @@
<grid id="27dc6" binding="myPanel" 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>
<xy x="20" y="20" width="500" height="130"/>
<xy x="20" y="20" width="999" height="135"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="369dc" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="369dc" 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="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -38,7 +38,7 @@
<grid id="cdbb7" binding="myFiltersListPanel" 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="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" 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="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -51,6 +51,14 @@
</component>
</children>
</grid>
<component id="3bd4e" class="com.intellij.ui.components.JBCheckBox" binding="myAllowCompactBooleanAttributesJBCheckBox" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XmlBundle" key="emmet.allow.compact.boolean.attributes"/>
</properties>
</component>
</children>
</grid>
</children>
@@ -40,6 +40,7 @@ public class XmlEmmetConfigurable implements UnnamedConfigurable, Disposable, Co
private JBCheckBox myEnablePreviewJBCheckBox;
private CheckBoxList<ZenCodingFilter> myFiltersCheckBoxList;
private JPanel myFiltersListPanel;
private JBCheckBox myAllowCompactBooleanAttributesJBCheckBox;
public XmlEmmetConfigurable() {
myEnableEmmetJBCheckBox.addActionListener(new ActionListener() {
@@ -47,6 +48,7 @@ public class XmlEmmetConfigurable implements UnnamedConfigurable, Disposable, Co
public void actionPerformed(ActionEvent e) {
boolean selected = myEnableEmmetJBCheckBox.isSelected();
myEnablePreviewJBCheckBox.setEnabled(selected);
myAllowCompactBooleanAttributesJBCheckBox.setEnabled(selected);
myFiltersCheckBoxList.setEnabled(selected);
}
});
@@ -74,6 +76,7 @@ public class XmlEmmetConfigurable implements UnnamedConfigurable, Disposable, Co
EmmetOptions emmetOptions = EmmetOptions.getInstance();
return emmetOptions.isEmmetEnabled() != myEnableEmmetJBCheckBox.isSelected() ||
emmetOptions.isPreviewEnabled() != myEnablePreviewJBCheckBox.isSelected() ||
emmetOptions.isCompactBooleanAllowed() != myAllowCompactBooleanAttributesJBCheckBox.isSelected() ||
!emmetOptions.getFiltersEnabledByDefault().equals(enabledFilters());
}
@@ -82,6 +85,7 @@ public class XmlEmmetConfigurable implements UnnamedConfigurable, Disposable, Co
EmmetOptions emmetOptions = EmmetOptions.getInstance();
emmetOptions.setEmmetEnabled(myEnableEmmetJBCheckBox.isSelected());
emmetOptions.setPreviewEnabled(myEnablePreviewJBCheckBox.isSelected());
emmetOptions.setCompactBooleanAllowed(myAllowCompactBooleanAttributesJBCheckBox.isSelected());
emmetOptions.setFiltersEnabledByDefault(enabledFilters());
}
@@ -92,6 +96,8 @@ public class XmlEmmetConfigurable implements UnnamedConfigurable, Disposable, Co
myEnableEmmetJBCheckBox.setSelected(emmetOptions.isEmmetEnabled());
myEnablePreviewJBCheckBox.setEnabled(emmetOptions.isEmmetEnabled());
myEnablePreviewJBCheckBox.setSelected(emmetOptions.isPreviewEnabled());
myAllowCompactBooleanAttributesJBCheckBox.setEnabled(emmetOptions.isEmmetEnabled());
myAllowCompactBooleanAttributesJBCheckBox.setSelected(emmetOptions.isCompactBooleanAllowed());
Set<String> enabledByDefault = emmetOptions.getFiltersEnabledByDefault();
for (ZenCodingFilter filter : ZenCodingFilter.getInstances()) {