Emmet support

- auto insert vendor prefixes
  - configurable for emmet
This commit is contained in:
Alexander Zolotov
2013-02-22 18:23:08 +04:00
parent 91f97dd502
commit 9e6562fbd0
16 changed files with 1060 additions and 96 deletions
@@ -241,10 +241,15 @@ label.text.path.to.profiles.ini=Path to \"profiles.ini\":
label.text.profile=&Profile:
button.text.settings=Settings...
display.name.firefox.settings=Firefox Settings
zen.coding.title=XML Zen Coding
zen.coding.enable.label=Enable Zen Coding
zen.coding.title=Emmet (XML Zen Coding)
emmet.configuration.title=Emmet (Zen Coding)
emmet.auto.insert.vendor.prefixes=Auto insert css vendor prefixes
zen.coding.enable.label=Enable Emmet
emmet.enable.bem.filter=Enable BEM filter by default
zen.coding.enter.abbreviation.dialog.label=Please enter an abbreviation
zen.coding.incorrect.abbreviation.error=Incorrect abbreviation
title.cannot.create.html.file=Cannot create HTML file
new.html.file.action=HTML File
new.html.file.action.description=Creates new HTML file
@@ -149,6 +149,12 @@
serviceImplementation="com.intellij.application.options.editor.WebEditorOptions"/>
<exportable serviceInterface="com.intellij.application.options.editor.WebEditorOptions"/>
<applicationConfigurable provider="com.intellij.application.options.emmet.EmmetConfigurableProvider"/>
<applicationService serviceInterface="com.intellij.application.options.emmet.EmmetOptions"
serviceImplementation="com.intellij.application.options.emmet.EmmetOptions"/>
<exportable serviceInterface="com.intellij.application.options.emmet.EmmetOptions"/>
<applicationService serviceInterface="com.intellij.application.options.editor.XmlFoldingSettings"
serviceImplementation="com.intellij.application.options.editor.XmlFoldingSettings"/>
@@ -109,18 +109,22 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
myAutomaticallyInsertRequiredAttributes = automaticallyInsertRequiredAttributes;
}
/**
* @deprecated use {@link com.intellij.application.options.emmet.EmmetOptions#getEmmetExpandShortcut()}
*/
@Deprecated
public int getZenCodingExpandShortcut() {
return myZenCodingExpandShortcut;
}
public void setZenCodingExpandShortcut(int zenCodingExpandShortcut) {
myZenCodingExpandShortcut = zenCodingExpandShortcut;
}
public boolean isAutomaticallyStartAttribute() {
return myAutomaticallyStartAttribute;
}
/**
* @deprecated use {@link com.intellij.application.options.emmet.EmmetOptions#isEmmetEnabled()}
*/
@Deprecated
public boolean isZenCodingEnabled() {
return myZenCodingEnabled;
}
@@ -129,10 +133,6 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
myAutomaticallyStartAttribute = automaticallyStartAttribute;
}
public void setZenCodingEnabled(boolean zenCodingEnabled) {
myZenCodingEnabled = zenCodingEnabled;
}
public boolean isAutomaticallyInsertRequiredSubTags() {
return myAutomaticallyInsertRequiredSubTags;
}
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="247ce" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="247ce" 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="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
@@ -21,7 +21,7 @@
<children>
<component id="f6c8c" class="javax.swing.JCheckBox" binding="myAutomaticallyInsertClosingTagCheckBox" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" 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 value="Automatically insert closing tag"/>
@@ -29,7 +29,7 @@
</component>
<component id="9f825" class="javax.swing.JCheckBox" binding="myAutomaticallyInsertRequiredAttributesCheckBox" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" 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 value="Automatically insert required attributes"/>
@@ -37,43 +37,16 @@
</component>
<component id="4bf74" class="javax.swing.JCheckBox" binding="myAutomaticallyStartAttributeAfterCheckBox" default-binding="true">
<constraints>
<grid row="3" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" 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>
<selected value="false"/>
<text value="Automatically start attribute"/>
</properties>
</component>
<component id="ba426" class="javax.swing.JCheckBox" binding="myEnableZenCodingCheckBox">
<constraints>
<grid row="4" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Enable Zen Coding"/>
</properties>
</component>
<component id="7c51c" class="javax.swing.JLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="3" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Expand abbreviation with"/>
</properties>
</component>
<component id="ed567" class="javax.swing.JComboBox" binding="myZenCodingExpandShortcutCombo">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<hspacer id="8ee6f">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="c21d3" class="javax.swing.JCheckBox" binding="myAutomaticallyInsertRequiredSubTagsCheckBox" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<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 value="Automatically insert required subtags"/>
@@ -15,15 +15,11 @@
*/
package com.intellij.application.options.editor;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.template.impl.TemplateSettings;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.xml.XmlBundle;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author spleaner
@@ -34,23 +30,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
private JCheckBox myAutomaticallyInsertRequiredAttributesCheckBox;
private JCheckBox myAutomaticallyInsertRequiredSubTagsCheckBox;
private JCheckBox myAutomaticallyStartAttributeAfterCheckBox;
private JCheckBox myEnableZenCodingCheckBox;
private JComboBox myZenCodingExpandShortcutCombo;
private static final String SPACE = CodeInsightBundle.message("template.shortcut.space");
private static final String TAB = CodeInsightBundle.message("template.shortcut.tab");
private static final String ENTER = CodeInsightBundle.message("template.shortcut.enter");
{
myZenCodingExpandShortcutCombo.addItem(SPACE);
myZenCodingExpandShortcutCombo.addItem(TAB);
myZenCodingExpandShortcutCombo.addItem(ENTER);
myEnableZenCodingCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myZenCodingExpandShortcutCombo.setEnabled(myEnableZenCodingCheckBox.isSelected());
}
});
}
public String getDisplayName() {
return XmlBundle.message("web.editor.configuration.title");
@@ -64,24 +44,13 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
return myWholePanel;
}
private char getSelectedZenCodingExpandShortcut() {
Object selectedItem = myZenCodingExpandShortcutCombo.getSelectedItem();
if (TAB.equals(selectedItem)) {
return TemplateSettings.TAB_CHAR;
}
else if (ENTER.equals(selectedItem)) {
return TemplateSettings.ENTER_CHAR;
}
return TemplateSettings.SPACE_CHAR;
}
public boolean isModified() {
final WebEditorOptions xmlEditorOptions = WebEditorOptions.getInstance();
return xmlEditorOptions.isAutomaticallyInsertClosingTag() != myAutomaticallyInsertClosingTagCheckBox.isSelected() ||
xmlEditorOptions.isAutomaticallyInsertRequiredAttributes() != myAutomaticallyInsertRequiredAttributesCheckBox.isSelected() ||
xmlEditorOptions.isAutomaticallyStartAttribute() != myAutomaticallyStartAttributeAfterCheckBox.isSelected() ||
xmlEditorOptions.isZenCodingEnabled() != myEnableZenCodingCheckBox.isSelected() ||
xmlEditorOptions.getZenCodingExpandShortcut() != getSelectedZenCodingExpandShortcut() ||
xmlEditorOptions.isAutomaticallyInsertRequiredSubTags() != myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected();
}
@@ -91,8 +60,6 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
xmlEditorOptions.setAutomaticallyInsertRequiredAttributes(myAutomaticallyInsertRequiredAttributesCheckBox.isSelected());
xmlEditorOptions.setAutomaticallyInsertRequiredSubTags(myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected());
xmlEditorOptions.setAutomaticallyStartAttribute(myAutomaticallyStartAttributeAfterCheckBox.isSelected());
xmlEditorOptions.setZenCodingEnabled(myEnableZenCodingCheckBox.isSelected());
xmlEditorOptions.setZenCodingExpandShortcut(getSelectedZenCodingExpandShortcut());
}
public void reset() {
@@ -101,19 +68,6 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
myAutomaticallyInsertRequiredAttributesCheckBox.setSelected(xmlEditorOptions.isAutomaticallyInsertRequiredAttributes());
myAutomaticallyInsertRequiredSubTagsCheckBox.setSelected(xmlEditorOptions.isAutomaticallyInsertRequiredSubTags());
myAutomaticallyStartAttributeAfterCheckBox.setSelected(xmlEditorOptions.isAutomaticallyStartAttribute());
myEnableZenCodingCheckBox.setSelected(xmlEditorOptions.isZenCodingEnabled());
myZenCodingExpandShortcutCombo.setEnabled(xmlEditorOptions.isZenCodingEnabled());
char shortcut = (char)WebEditorOptions.getInstance().getZenCodingExpandShortcut();
if (shortcut == TemplateSettings.TAB_CHAR) {
myZenCodingExpandShortcutCombo.setSelectedItem(TAB);
}
else if (shortcut == TemplateSettings.ENTER_CHAR) {
myZenCodingExpandShortcutCombo.setSelectedItem(ENTER);
}
else {
myZenCodingExpandShortcutCombo.setSelectedItem(SPACE);
}
}
public void disposeUIResources() {
@@ -0,0 +1,190 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.application.options.emmet;
import com.intellij.openapi.ui.Messages;
import com.intellij.ui.*;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.ui.table.TableView;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.util.ArrayList;
import java.util.List;
/**
* User: zolotov
* Date: 2/20/13
*/
public class CssEditPrefixesListPanel {
private final ListTableModel<CssPrefixInfo> myPrefixesModel;
private final TableView<CssPrefixInfo> myPrefixesTableView;
public CssEditPrefixesListPanel() {
ColumnInfo[] columns = new ColumnInfo[CssPrefix.values().length + 1];
columns[0] = new PropertyColumn();
CssPrefix[] values = CssPrefix.values();
for (int i = 0; i < values.length; i++) {
columns[i + 1] = new PrefixColumnInfo(values[i]);
}
myPrefixesModel = new ListTableModel<CssPrefixInfo>(columns, new ArrayList<CssPrefixInfo>(), 0);
myPrefixesModel.setSortable(true);
myPrefixesTableView = new TableView<CssPrefixInfo>(myPrefixesModel);
myPrefixesTableView.setAutoCreateRowSorter(true);
myPrefixesTableView.setBorder(null);
myPrefixesTableView.getRowSorter().toggleSortOrder(0);
new TableViewSpeedSearch(myPrefixesTableView) {
@Override
protected String getElementText(final Object element) {
CssPrefixInfo prefixInfo = (CssPrefixInfo)element;
return prefixInfo.getPropertyName();
}
};
}
public void setEnabled(boolean value) {
myPrefixesTableView.setEnabled(value);
}
public void setState(List<CssPrefixInfo> prefixInfos) {
myPrefixesModel.setItems(prefixInfos);
}
public List<CssPrefixInfo> getState() {
return myPrefixesModel.getItems();
}
public JPanel createMainComponent() {
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myPrefixesTableView);
decorator.disableUpDownActions();
final JPanel panel = decorator.createPanel();
decorator.setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
TableUtil.stopEditing(myPrefixesTableView);
String propertyName = Messages.showInputDialog(myPrefixesTableView, "Property name:", "New Css Property", null);
if (propertyName != null && !propertyName.isEmpty()) {
List<CssPrefixInfo> items = myPrefixesModel.getItems();
for (CssPrefixInfo state : items) {
if (propertyName.equals(state.getPropertyName())) {
myPrefixesTableView.clearSelection();
myPrefixesTableView.addSelection(state);
scrollToSelection();
return;
}
}
CssPrefixInfo newPrefixInfo = new CssPrefixInfo(propertyName);
myPrefixesModel.addRow(newPrefixInfo);
myPrefixesTableView.clearSelection();
myPrefixesTableView.addSelection(newPrefixInfo);
scrollToSelection();
}
myPrefixesTableView.requestFocus();
}
private void scrollToSelection() {
int selectedRow = myPrefixesTableView.getSelectedRow();
if (selectedRow >= 0) {
myPrefixesTableView.scrollRectToVisible(myPrefixesTableView.getCellRect(selectedRow, 0, true));
}
}
}).setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
TableUtil.stopEditing(myPrefixesTableView);
CssPrefixInfo selectedObject = myPrefixesTableView.getSelectedObject();
int selectedRow = myPrefixesTableView.getSelectedRow();
int index = myPrefixesModel.indexOf(selectedObject);
if (0 <= index && index < myPrefixesModel.getRowCount()) {
myPrefixesModel.removeRow(index);
if (selectedRow < myPrefixesTableView.getRowCount()) {
myPrefixesTableView.setRowSelectionInterval(selectedRow, selectedRow);
}
else {
if (selectedRow > 0) {
myPrefixesTableView.setRowSelectionInterval(selectedRow - 1, selectedRow - 1);
}
}
}
myPrefixesTableView.getParent().repaint();
myPrefixesTableView.requestFocus();
}
});
return panel;
}
private static class PropertyColumn extends ColumnInfo<CssPrefixInfo, String> {
public PropertyColumn() {
super("Property");
}
@Nullable
@Override
public String valueOf(CssPrefixInfo prefixInfo) {
return prefixInfo.getPropertyName();
}
}
private class PrefixColumnInfo extends ColumnInfo<CssPrefixInfo, Boolean> {
private final CssPrefix myPrefix;
private final BooleanTableCellRenderer myCellRenderer = new BooleanTableCellRenderer();
@Nullable
@Override
public TableCellRenderer getRenderer(CssPrefixInfo state) {
return myCellRenderer;
}
public PrefixColumnInfo(CssPrefix prefix) {
super(prefix.getText());
myPrefix = prefix;
}
@Nullable
@Override
public TableCellEditor getEditor(CssPrefixInfo prefixInfo) {
JBCheckBox box = new JBCheckBox();
box.setHorizontalAlignment(SwingConstants.CENTER);
return new DefaultCellEditor(box);
}
@Override
public boolean isCellEditable(CssPrefixInfo prefixInfo) {
return myPrefixesTableView.isEnabled();
}
public final Class<Boolean> getColumnClass() {
return Boolean.class;
}
@Override
public final void setValue(final CssPrefixInfo prefixInfo, final Boolean aValue) {
prefixInfo.setValue(myPrefix, aValue);
}
@Nullable
@Override
public final Boolean valueOf(CssPrefixInfo state) {
return state.getValue(myPrefix);
}
}
}
@@ -0,0 +1,34 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.application.options.emmet;
/**
* User: zolotov
* Date: 2/21/13
*/
public enum CssPrefix {
WEBKIT(0x1), MOZ(0x2), MS(0x4), O(0x8);
final int myIntMask;
CssPrefix(int intMask) {
myIntMask = intMask;
}
public String getText() {
return "-" + toString().toLowerCase();
}
}
@@ -0,0 +1,116 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.application.options.emmet;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newHashSet;
/**
* User: zolotov
* Date: 2/20/13
*/
public class CssPrefixInfo {
@NotNull
private final String myPropertyName;
@NotNull
private final Collection<CssPrefix> myEnabledPrefixes;
public CssPrefixInfo(@NotNull String propertyName, CssPrefix... enabledPrefixes) {
myPropertyName = propertyName;
myEnabledPrefixes = newHashSet(enabledPrefixes);
for (CssPrefix prefix : enabledPrefixes) {
setValue(prefix, true);
}
}
public CssPrefixInfo(@NotNull String propertyName, Collection<CssPrefix> enabledPrefixes) {
myPropertyName = propertyName;
myEnabledPrefixes = newHashSet(enabledPrefixes);
for (CssPrefix prefix : enabledPrefixes) {
setValue(prefix, true);
}
}
@NotNull
public Collection<CssPrefix> getEnabledPrefixes() {
return myEnabledPrefixes;
}
public void setValue(CssPrefix prefix, boolean value) {
if (value) {
myEnabledPrefixes.add(prefix);
} else {
myEnabledPrefixes.remove(prefix);
}
}
public boolean getValue(CssPrefix prefix) {
return myEnabledPrefixes.contains(prefix);
}
@NotNull
public String getPropertyName() {
return myPropertyName;
}
public static CssPrefixInfo fromIntegerValue(String propertyName, Integer value) {
if (value == null) {
return new CssPrefixInfo(propertyName);
}
List<CssPrefix> enabledPrefixes = newArrayList();
for (CssPrefix prefix : CssPrefix.values()) {
if ((value & prefix.myIntMask) > 0) {
enabledPrefixes.add(prefix);
}
}
return new CssPrefixInfo(propertyName, enabledPrefixes);
}
public int toIntegerValue() {
int result = 0;
for (CssPrefix prefix : myEnabledPrefixes) {
if (getValue(prefix)) {
result |= prefix.myIntMask;
}
}
return result;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CssPrefixInfo that = (CssPrefixInfo)o;
if (!myEnabledPrefixes.equals(that.myEnabledPrefixes)) return false;
if (!myPropertyName.equals(that.myPropertyName)) return false;
return true;
}
@Override
public int hashCode() {
int result = myPropertyName.hashCode();
result = 31 * result + myEnabledPrefixes.hashCode();
return result;
}
}
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.emmet.EmmetConfigurable">
<grid id="27dc6" binding="myPanel" 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>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="446a3" class="com.intellij.ui.components.JBCheckBox" binding="myEnableEmmetJBCheckBox" default-binding="true">
<constraints>
<grid row="0" 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>
<text resource-bundle="messages/XmlBundle" key="zen.coding.enable.label"/>
</properties>
</component>
<component id="c71a" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="ce319"/>
<text value="Expand abbreviation with"/>
</properties>
</component>
<component id="59f5a" class="javax.swing.JComboBox" binding="myEmmetExpandShortcutCombo">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<model/>
</properties>
</component>
<grid id="369dc" 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="2" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none" title="XML"/>
<children>
<component id="9ed4c" class="com.intellij.ui.components.JBCheckBox" binding="myEnableBEMFilterJBCheckBox" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XmlBundle" key="emmet.enable.bem.filter"/>
</properties>
</component>
</children>
</grid>
<grid id="bd64d" 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="3" 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/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none" title="CSS"/>
<children>
<component id="65354" class="com.intellij.ui.components.JBCheckBox" binding="myAutoInsertCssVendorJBCheckBox" default-binding="true">
<constraints>
<grid row="0" 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>
<text resource-bundle="messages/XmlBundle" key="emmet.auto.insert.vendor.prefixes"/>
</properties>
</component>
<grid id="612b" binding="myPrefixesPanel" 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="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"/>
<children/>
</grid>
</children>
</grid>
</children>
</grid>
</form>
@@ -0,0 +1,181 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.application.options.emmet;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.template.impl.TemplateSettings;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.xml.XmlBundle;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* User: zolotov
* Date: 2/20/13
*/
public class EmmetConfigurable implements SearchableConfigurable, Disposable, Configurable.NoScroll {
private JBCheckBox myEnableEmmetJBCheckBox;
private JComboBox myEmmetExpandShortcutCombo;
private JBCheckBox myEnableBEMFilterJBCheckBox;
private JBCheckBox myAutoInsertCssVendorJBCheckBox;
private JPanel myPanel;
private JPanel myPrefixesPanel;
private CssEditPrefixesListPanel myCssEditPrefixesListPanel;
private static final String SPACE = CodeInsightBundle.message("template.shortcut.space");
private static final String TAB = CodeInsightBundle.message("template.shortcut.tab");
private static final String ENTER = CodeInsightBundle.message("template.shortcut.enter");
public EmmetConfigurable() {
myEnableEmmetJBCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean selected = myEnableEmmetJBCheckBox.isSelected();
myEmmetExpandShortcutCombo.setEnabled(selected);
//myInsertFallbackGradientColorJBCheckBox.setEnabled(selected);
myAutoInsertCssVendorJBCheckBox.setEnabled(selected);
myCssEditPrefixesListPanel.setEnabled(selected && myAutoInsertCssVendorJBCheckBox.isSelected());
myEnableBEMFilterJBCheckBox.setEnabled(selected);
}
});
myAutoInsertCssVendorJBCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myCssEditPrefixesListPanel.setEnabled(myAutoInsertCssVendorJBCheckBox.isSelected());
}
});
myEmmetExpandShortcutCombo.addItem(SPACE);
myEmmetExpandShortcutCombo.addItem(TAB);
myEmmetExpandShortcutCombo.addItem(ENTER);
}
private char getSelectedEmmetExpandShortcut() {
Object selectedItem = myEmmetExpandShortcutCombo.getSelectedItem();
if (TAB.equals(selectedItem)) {
return TemplateSettings.TAB_CHAR;
}
else if (ENTER.equals(selectedItem)) {
return TemplateSettings.ENTER_CHAR;
}
return TemplateSettings.SPACE_CHAR;
}
@Override
public void dispose() {
}
@NotNull
@Override
public String getId() {
return "reference.settingsdialog.emmet";
}
@Nullable
@Override
public Runnable enableSearch(String option) {
return null;
}
@Nls
@Override
public String getDisplayName() {
return XmlBundle.message("emmet.configuration.title");
}
@Nullable
@Override
public String getHelpTopic() {
return getId();
}
@Nullable
@Override
public JComponent createComponent() {
return myPanel;
}
@Override
public boolean isModified() {
EmmetOptions emmetOptions = EmmetOptions.getInstance();
return emmetOptions.isEmmetEnabled() != myEnableEmmetJBCheckBox.isSelected() ||
emmetOptions.isBemFilterEnabledByDefault() != myEnableBEMFilterJBCheckBox.isSelected() ||
emmetOptions.isAutoInsertCssPrefixedEnabled() != myAutoInsertCssVendorJBCheckBox.isSelected() ||
!emmetOptions.getAllPrefixInfo().equals(myCssEditPrefixesListPanel.getState()) ||
emmetOptions.getEmmetExpandShortcut() != getSelectedEmmetExpandShortcut();
}
@Override
public void apply() throws ConfigurationException {
EmmetOptions emmetOptions = EmmetOptions.getInstance();
emmetOptions.setEmmetEnabled(myEnableEmmetJBCheckBox.isSelected());
emmetOptions.setEnableBemFilterByDefault(myEnableBEMFilterJBCheckBox.isSelected());
emmetOptions.setEmmetExpandShortcut(getSelectedEmmetExpandShortcut());
emmetOptions.setAutoInsertCssPrefixedEnabled(myAutoInsertCssVendorJBCheckBox.isSelected());
emmetOptions.setPrefixInfo(myCssEditPrefixesListPanel.getState());
}
@Override
public void reset() {
EmmetOptions emmetOptions = EmmetOptions.getInstance();
myEnableEmmetJBCheckBox.setSelected(emmetOptions.isEmmetEnabled());
myEnableBEMFilterJBCheckBox.setEnabled(emmetOptions.isEmmetEnabled());
myEnableBEMFilterJBCheckBox.setSelected(emmetOptions.isBemFilterEnabledByDefault());
myEmmetExpandShortcutCombo.setEnabled(emmetOptions.isEmmetEnabled());
myAutoInsertCssVendorJBCheckBox.setEnabled(emmetOptions.isEmmetEnabled());
myAutoInsertCssVendorJBCheckBox.setSelected(emmetOptions.isAutoInsertCssPrefixedEnabled());
//myInsertFallbackGradientColorJBCheckBox.setEnabled(emmetOptions.isEmmetEnabled());
//myInsertFallbackGradientColorJBCheckBox.setSelected(emmetOptions.isInsertFallbackGradientColorEnabled());
myCssEditPrefixesListPanel.setEnabled(emmetOptions.isEmmetEnabled() && emmetOptions.isAutoInsertCssPrefixedEnabled());
myCssEditPrefixesListPanel.setState(emmetOptions.getAllPrefixInfo());
char shortcut = (char)emmetOptions.getEmmetExpandShortcut();
if (shortcut == TemplateSettings.TAB_CHAR) {
myEmmetExpandShortcutCombo.setSelectedItem(TAB);
}
else if (shortcut == TemplateSettings.ENTER_CHAR) {
myEmmetExpandShortcutCombo.setSelectedItem(ENTER);
}
else {
myEmmetExpandShortcutCombo.setSelectedItem(SPACE);
}
}
@Override
public void disposeUIResources() {
myCssEditPrefixesListPanel = null;
myPrefixesPanel = null;
}
private void createUIComponents() {
myCssEditPrefixesListPanel = new CssEditPrefixesListPanel();
myPrefixesPanel = myCssEditPrefixesListPanel.createMainComponent();
myPrefixesPanel.setEnabled(true);
}
}
@@ -0,0 +1,32 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.application.options.emmet;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurableProvider;
import org.jetbrains.annotations.Nullable;
/**
* User: zolotov
* Date: 2/20/13
*/
public class EmmetConfigurableProvider extends ConfigurableProvider {
@Nullable
@Override
public Configurable createConfigurable() {
return new EmmetConfigurable();
}
}
@@ -0,0 +1,169 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.application.options.emmet;
import com.intellij.application.options.editor.WebEditorOptions;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.xmlb.XmlSerializerUtil;
import com.intellij.xml.XmlBundle;
import org.jdom.Document;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.List;
import java.util.Map;
import static com.google.common.collect.Lists.newLinkedList;
import static com.google.common.collect.Maps.newHashMap;
import static com.google.common.io.Resources.getResource;
/**
* User: zolotov
* Date: 2/20/13
*/
@State(
name = "EmmetOptions",
storages = {
@Storage(
file = StoragePathMacros.APP_CONFIG + "/emmet.xml"
)}
)
public class EmmetOptions implements PersistentStateComponent<EmmetOptions>, ExportableComponent {
private boolean myEnableBemFilterByDefault = false;
private boolean myEmmetEnabled = WebEditorOptions.getInstance().isZenCodingEnabled();
private int myEmmetExpandShortcut = WebEditorOptions.getInstance().getZenCodingExpandShortcut();
private boolean myAutoInsertCssPrefixedEnabled = true;
@Nullable
private Map<String, Integer> prefixes = null;
public void setPrefixInfo(List<CssPrefixInfo> prefixInfos) {
prefixes = newHashMap();
for (CssPrefixInfo state : prefixInfos) {
prefixes.put(state.getPropertyName(), state.toIntegerValue());
}
}
public CssPrefixInfo getPrefixStateForProperty(String propertyName) {
return CssPrefixInfo.fromIntegerValue(propertyName, getPrefixes().get(propertyName));
}
public List<CssPrefixInfo> getAllPrefixInfo() {
List<CssPrefixInfo> result = newLinkedList();
for (Map.Entry<String, Integer> entry : getPrefixes().entrySet()) {
result.add(CssPrefixInfo.fromIntegerValue(entry.getKey(), entry.getValue()));
}
return result;
}
public boolean isBemFilterEnabledByDefault() {
return myEnableBemFilterByDefault;
}
public void setEnableBemFilterByDefault(boolean enableBemFilterByDefault) {
myEnableBemFilterByDefault = enableBemFilterByDefault;
}
public void setEmmetExpandShortcut(int emmetExpandShortcut) {
myEmmetExpandShortcut = emmetExpandShortcut;
}
public int getEmmetExpandShortcut() {
return myEmmetExpandShortcut;
}
public boolean isEmmetEnabled() {
return myEmmetEnabled;
}
public void setEmmetEnabled(boolean emmetEnabled) {
myEmmetEnabled = emmetEnabled;
}
public boolean isAutoInsertCssPrefixedEnabled() {
return myAutoInsertCssPrefixedEnabled;
}
public void setAutoInsertCssPrefixedEnabled(boolean autoInsertCssPrefixedEnabled) {
myAutoInsertCssPrefixedEnabled = autoInsertCssPrefixedEnabled;
}
@NotNull
@Override
public File[] getExportFiles() {
return new File[]{PathManager.getOptionsFile("emmet")};
}
@NotNull
@Override
public String getPresentableName() {
return XmlBundle.message("emmet.configuration.title");
}
@Nullable
@Override
public EmmetOptions getState() {
return this;
}
public void loadState(final EmmetOptions state) {
XmlSerializerUtil.copyBean(state, this);
}
public static EmmetOptions getInstance() {
return ServiceManager.getService(EmmetOptions.class);
}
@SuppressWarnings("UnusedDeclaration")
@NotNull
public Map<String, Integer> getPrefixes() {
if (prefixes == null) {
prefixes = loadDefaultPrefixes();
}
return prefixes;
}
@SuppressWarnings("UnusedDeclaration")
public void setPrefixes(@Nullable Map<String, Integer> prefixes) {
this.prefixes = prefixes;
}
public static Map<String, Integer> loadDefaultPrefixes() {
Map<String, Integer> result = newHashMap();
try {
Document document = JDOMUtil.loadDocument(getResource(EmmetOptions.class, "emmet_default_options.xml"));
Element prefixesElement = document.getRootElement().getChild("prefixes");
if (prefixesElement != null) {
for (Object entry : prefixesElement.getChildren("entry")) {
Element entryElement = (Element)entry;
String propertyName = entryElement.getAttributeValue("key");
Integer value = StringUtil.parseInt(entryElement.getAttributeValue("value"), 0);
result.put(propertyName, value);
}
}
}
catch (Exception e) {
Logger.getInstance(EmmetOptions.class).warn(e);
return result;
}
return result;
}
}
@@ -0,0 +1,216 @@
<DefaultEmmetOptions>
<prefixes>
<entry key="accelerator" value="4"/>
<entry key="accesskey" value="8"/>
<entry key="animation" value="9"/>
<entry key="animation-delay" value="11"/>
<entry key="animation-direction" value="11"/>
<entry key="animation-duration" value="11"/>
<entry key="animation-fill-mode" value="11"/>
<entry key="animation-iteration-count" value="11"/>
<entry key="animation-name" value="11"/>
<entry key="animation-play-state" value="11"/>
<entry key="animation-timing-function" value="11"/>
<entry key="appearance" value="3"/>
<entry key="backface-visibility" value="7"/>
<entry key="background-clip" value="3"/>
<entry key="background-composite" value="1"/>
<entry key="background-inline-policy" value="2"/>
<entry key="background-origin" value="1"/>
<entry key="background-position-x" value="4"/>
<entry key="background-position-y" value="4"/>
<entry key="background-size" value="1"/>
<entry key="behavior" value="4"/>
<entry key="binding" value="2"/>
<entry key="block-progression" value="4"/>
<entry key="border-bottom-colors" value="2"/>
<entry key="border-fit" value="1"/>
<entry key="border-horizontal-spacing" value="1"/>
<entry key="border-image" value="11"/>
<entry key="border-left-colors" value="2"/>
<entry key="border-radius" value="3"/>
<entry key="border-right-colors" value="2"/>
<entry key="border-top-colors" value="2"/>
<entry key="border-vertical-spacing" value="1"/>
<entry key="box-align" value="7"/>
<entry key="box-direction" value="7"/>
<entry key="box-flex" value="7"/>
<entry key="box-flex-group" value="1"/>
<entry key="box-line-progression" value="4"/>
<entry key="box-lines" value="5"/>
<entry key="box-ordinal-group" value="7"/>
<entry key="box-orient" value="7"/>
<entry key="box-pack" value="7"/>
<entry key="box-reflect" value="1"/>
<entry key="box-shadow" value="3"/>
<entry key="box-sizing" value="3"/>
<entry key="color-correction" value="1"/>
<entry key="column-break-after" value="1"/>
<entry key="column-break-before" value="1"/>
<entry key="column-break-inside" value="1"/>
<entry key="column-count" value="3"/>
<entry key="column-gap" value="3"/>
<entry key="column-rule-color" value="3"/>
<entry key="column-rule-style" value="3"/>
<entry key="column-rule-width" value="3"/>
<entry key="column-span" value="1"/>
<entry key="column-width" value="3"/>
<entry key="content-zoom-boundary" value="4"/>
<entry key="content-zoom-boundary-max" value="4"/>
<entry key="content-zoom-boundary-min" value="4"/>
<entry key="content-zoom-chaining" value="4"/>
<entry key="content-zoom-snap" value="4"/>
<entry key="content-zoom-snap-points" value="4"/>
<entry key="content-zoom-snap-type" value="4"/>
<entry key="content-zooming" value="4"/>
<entry key="dashboard-region" value="9"/>
<entry key="filter" value="4"/>
<entry key="float-edge" value="2"/>
<entry key="flow-from" value="4"/>
<entry key="flow-into" value="4"/>
<entry key="font-feature-settings" value="6"/>
<entry key="font-language-override" value="2"/>
<entry key="font-smoothing" value="1"/>
<entry key="force-broken-image-icon" value="2"/>
<entry key="grid-column" value="4"/>
<entry key="grid-column-align" value="4"/>
<entry key="grid-column-span" value="4"/>
<entry key="grid-columns" value="4"/>
<entry key="grid-layer" value="4"/>
<entry key="grid-row" value="4"/>
<entry key="grid-row-align" value="4"/>
<entry key="grid-row-span" value="4"/>
<entry key="grid-rows" value="4"/>
<entry key="high-contrast-adjust" value="4"/>
<entry key="highlight" value="1"/>
<entry key="hyphenate-character" value="1"/>
<entry key="hyphenate-limit-after" value="1"/>
<entry key="hyphenate-limit-before" value="1"/>
<entry key="hyphenate-limit-chars" value="4"/>
<entry key="hyphenate-limit-lines" value="4"/>
<entry key="hyphenate-limit-zone" value="4"/>
<entry key="hyphens" value="7"/>
<entry key="image-region" value="2"/>
<entry key="ime-mode" value="4"/>
<entry key="input-format" value="8"/>
<entry key="input-required" value="8"/>
<entry key="interpolation-mode" value="4"/>
<entry key="layout-flow" value="4"/>
<entry key="layout-grid" value="4"/>
<entry key="layout-grid-char" value="4"/>
<entry key="layout-grid-line" value="4"/>
<entry key="layout-grid-mode" value="4"/>
<entry key="layout-grid-type" value="4"/>
<entry key="line-box-contain" value="1"/>
<entry key="line-break" value="5"/>
<entry key="line-clamp" value="1"/>
<entry key="link" value="8"/>
<entry key="link-source" value="8"/>
<entry key="locale" value="1"/>
<entry key="margin-after-collapse" value="1"/>
<entry key="margin-before-collapse" value="1"/>
<entry key="marquee-dir" value="8"/>
<entry key="marquee-direction" value="1"/>
<entry key="marquee-increment" value="1"/>
<entry key="marquee-loop" value="8"/>
<entry key="marquee-repetition" value="1"/>
<entry key="marquee-speed" value="8"/>
<entry key="marquee-style" value="9"/>
<entry key="mask-attachment" value="1"/>
<entry key="mask-box-image" value="1"/>
<entry key="mask-box-image-outset" value="1"/>
<entry key="mask-box-image-repeat" value="1"/>
<entry key="mask-box-image-slice" value="1"/>
<entry key="mask-box-image-source" value="1"/>
<entry key="mask-box-image-width" value="1"/>
<entry key="mask-clip" value="1"/>
<entry key="mask-composite" value="1"/>
<entry key="mask-image" value="1"/>
<entry key="mask-origin" value="1"/>
<entry key="mask-position" value="1"/>
<entry key="mask-repeat" value="1"/>
<entry key="mask-size" value="1"/>
<entry key="nbsp-mode" value="1"/>
<entry key="object-fit" value="8"/>
<entry key="object-position" value="8"/>
<entry key="orient" value="2"/>
<entry key="outline-radius-bottomleft" value="2"/>
<entry key="outline-radius-bottomright" value="2"/>
<entry key="outline-radius-topleft" value="2"/>
<entry key="outline-radius-topright" value="2"/>
<entry key="overflow-style" value="4"/>
<entry key="perspective" value="7"/>
<entry key="perspective-origin" value="7"/>
<entry key="perspective-origin-x" value="4"/>
<entry key="perspective-origin-y" value="4"/>
<entry key="rtl-ordering" value="1"/>
<entry key="scroll-boundary" value="4"/>
<entry key="scroll-boundary-bottom" value="4"/>
<entry key="scroll-boundary-left" value="4"/>
<entry key="scroll-boundary-right" value="4"/>
<entry key="scroll-boundary-top" value="4"/>
<entry key="scroll-chaining" value="4"/>
<entry key="scroll-rails" value="4"/>
<entry key="scroll-snap-points-x" value="4"/>
<entry key="scroll-snap-points-y" value="4"/>
<entry key="scroll-snap-type" value="4"/>
<entry key="scroll-snap-x" value="4"/>
<entry key="scroll-snap-y" value="4"/>
<entry key="scrollbar-arrow-color" value="4"/>
<entry key="scrollbar-base-color" value="4"/>
<entry key="scrollbar-darkshadow-color" value="4"/>
<entry key="scrollbar-face-color" value="4"/>
<entry key="scrollbar-highlight-color" value="4"/>
<entry key="scrollbar-shadow-color" value="4"/>
<entry key="scrollbar-track-color" value="4"/>
<entry key="stack-sizing" value="2"/>
<entry key="svg-shadow" value="1"/>
<entry key="tab-size" value="10"/>
<entry key="table-baseline" value="8"/>
<entry key="text-align-last" value="4"/>
<entry key="text-autospace" value="4"/>
<entry key="text-blink" value="2"/>
<entry key="text-combine" value="1"/>
<entry key="text-decoration-color" value="2"/>
<entry key="text-decoration-line" value="2"/>
<entry key="text-decoration-style" value="2"/>
<entry key="text-decorations-in-effect" value="1"/>
<entry key="text-emphasis-color" value="1"/>
<entry key="text-emphasis-position" value="1"/>
<entry key="text-emphasis-style" value="1"/>
<entry key="text-fill-color" value="1"/>
<entry key="text-justify" value="4"/>
<entry key="text-kashida-space" value="4"/>
<entry key="text-orientation" value="1"/>
<entry key="text-overflow" value="4"/>
<entry key="text-security" value="1"/>
<entry key="text-size-adjust" value="6"/>
<entry key="text-stroke-color" value="1"/>
<entry key="text-stroke-width" value="1"/>
<entry key="text-underline-position" value="4"/>
<entry key="touch-action" value="4"/>
<entry key="transform" value="15"/>
<entry key="transform-origin" value="15"/>
<entry key="transform-origin-x" value="4"/>
<entry key="transform-origin-y" value="4"/>
<entry key="transform-origin-z" value="4"/>
<entry key="transform-style" value="7"/>
<entry key="transition" value="15"/>
<entry key="transition-delay" value="15"/>
<entry key="transition-duration" value="15"/>
<entry key="transition-property" value="15"/>
<entry key="transition-timing-function" value="15"/>
<entry key="user-drag" value="1"/>
<entry key="user-focus" value="2"/>
<entry key="user-input" value="2"/>
<entry key="user-modify" value="3"/>
<entry key="user-select" value="7"/>
<entry key="window-shadow" value="2"/>
<entry key="word-break" value="4"/>
<entry key="word-wrap" value="4"/>
<entry key="wrap-flow" value="4"/>
<entry key="wrap-margin" value="4"/>
<entry key="wrap-through" value="4"/>
<entry key="writing-mode" value="5"/>
</prefixes>
</DefaultEmmetOptions>
@@ -15,7 +15,7 @@
*/
package com.intellij.codeInsight.template.emmet;
import com.intellij.application.options.editor.WebEditorOptions;
import com.intellij.application.options.emmet.EmmetOptions;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.template.*;
import com.intellij.codeInsight.template.emmet.filters.SingleLineEmmetFilter;
@@ -276,8 +276,8 @@ public class ZenCodingTemplate implements CustomLiveTemplate {
}
public boolean isApplicable(PsiFile file, int offset, boolean wrapping) {
WebEditorOptions webEditorOptions = WebEditorOptions.getInstance();
if (!webEditorOptions.isZenCodingEnabled()) {
EmmetOptions emmetOptions = EmmetOptions.getInstance();
if (!emmetOptions.isEmmetEnabled()) {
return false;
}
if (file == null) {
@@ -320,7 +320,7 @@ public class ZenCodingTemplate implements CustomLiveTemplate {
}
public char getShortcut() {
return (char)WebEditorOptions.getInstance().getZenCodingExpandShortcut();
return (char)EmmetOptions.getInstance().getEmmetExpandShortcut();
}
public String computeTemplateKey(@NotNull CustomTemplateCallback callback) {
@@ -20,6 +20,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.intellij.application.options.emmet.EmmetOptions;
import com.intellij.codeInsight.template.emmet.nodes.GenerationNode;
import com.intellij.lang.xml.XMLLanguage;
import com.intellij.openapi.util.Key;
@@ -94,7 +95,7 @@ public class BemEmmetFilter extends ZenCodingFilter {
@Override
public boolean isAppliedByDefault(@NotNull PsiElement context) {
return false; //todo: add setting for enabling this filter by default
return EmmetOptions.getInstance().isBemFilterEnabledByDefault();
}
@Override
@@ -17,7 +17,6 @@ package com.intellij.xml.util;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.SoftFactoryMap;
import com.intellij.util.containers.WeakFactoryMap;
import com.intellij.util.ui.EmptyIcon;
import org.jetbrains.annotations.NotNull;
@@ -44,7 +43,6 @@ public class ColorIconCache {
return INSTANCE;
}
@SuppressWarnings({"MethodMayBeStatic"})
public Icon getIcon(@NotNull final Color color, final int size) {
Icon icon = ourCache.get(color).get(size);
if (icon == null) {