label.text.profile=&Profile:
button.text.settings=Settings...
display.name.firefox.settings=Firefox Settings
+zen.coding.settings=XML Zen Coding
+zen.coding.enable.label=Enable Zen Coding
<applicationService serviceInterface="com.intellij.application.options.editor.XmlFoldingSettings"
serviceImplementation="com.intellij.application.options.editor.XmlFoldingSettings"/>
+
+ <applicationService serviceInterface="com.intellij.codeInsight.template.ZenCodingSettings"
+ serviceImplementation="com.intellij.codeInsight.template.ZenCodingSettings"/>
+
<exportable serviceInterface="com.intellij.application.options.editor.XmlFoldingSettings"/>
<applicationService serviceInterface="com.intellij.application.options.XmlSettings"
<basicWordSelectionFilter implementation="com.intellij.codeInsight.editorActions.XmlBasicWordSelectionFilter"/>
<defaultLiveTemplatesProvider implementation="com.intellij.codeInsight.template.XmlDefaultLiveTemplatesProvider"/>
<customLiveTemplate implementation="com.intellij.codeInsight.template.XmlCustomLiveTemplate"/>
+ <applicationConfigurable implementation="com.intellij.codeInsight.template.ZenCodingSettingsConfigurable"/>
<productivityFeaturesProvider implementation="com.intellij.featureStatistics.XmlProductivityFeatureProvider"/>
<idIndexer filetype="XML" implementationClass="com.intellij.psi.impl.cache.impl.idCache.XmlIdIndexer"/>
}
public String computeTemplateKey(@NotNull CustomTemplateCallback callback) {
+ ZenCodingSettings settings = ZenCodingSettings.getInstance();
+ if (!settings.ENABLED) {
+ return null;
+ }
PsiFile file = callback.getFile();
if (file.getLanguage() instanceof XMLLanguage) {
Editor editor = callback.getEditor();
--- /dev/null
+/*
+ * Copyright 2000-2010 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.codeInsight.template;
+
+import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.components.State;
+import com.intellij.openapi.components.Storage;
+import com.intellij.util.xmlb.XmlSerializerUtil;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+@State(
+ name="DuplocatorSettings",
+ storages = {
+ @Storage(
+ id="DuplocatorSettings",
+ file="$APP_CONFIG$/other.xml"
+ )}
+)
+public class ZenCodingSettings implements PersistentStateComponent<ZenCodingSettings> {
+ public boolean ENABLED = true;
+
+ public static ZenCodingSettings getInstance() {
+ return ServiceManager.getService(ZenCodingSettings.class);
+ }
+
+ public ZenCodingSettings getState() {
+ return this;
+ }
+
+ public void loadState(ZenCodingSettings state) {
+ XmlSerializerUtil.copyBean(state, this);
+ }
+}
--- /dev/null
+/*
+ * Copyright 2000-2010 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.codeInsight.template;
+
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.xml.XmlBundle;
+import org.jetbrains.annotations.Nls;
+
+import javax.swing.*;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public class ZenCodingSettingsConfigurable implements SearchableConfigurable {
+ private ZenCodingSettingsPanel myPanel;
+
+ public String getId() {
+ return getHelpTopic();
+ }
+
+ public Runnable enableSearch(String option) {
+ return null;
+ }
+
+ @Nls
+ public String getDisplayName() {
+ return XmlBundle.message("zen.coding.settings");
+ }
+
+ public Icon getIcon() {
+ return null;
+ }
+
+ public String getHelpTopic() {
+ return null;
+ }
+
+ public JComponent createComponent() {
+ if (myPanel == null) {
+ myPanel = new ZenCodingSettingsPanel();
+ }
+ return myPanel.getComponent();
+ }
+
+ public boolean isModified() {
+ return myPanel != null && myPanel.isModified();
+ }
+
+ public void apply() throws ConfigurationException {
+ if (myPanel != null) {
+ myPanel.apply();
+ }
+ }
+
+ public void reset() {
+ if (myPanel != null) {
+ myPanel.reset();
+ }
+ }
+
+ public void disposeUIResources() {
+ myPanel = null;
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.codeInsight.template.ZenCodingSettingsPanel">
+ <grid id="27dc6" binding="myPanel" 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>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="3be87" class="javax.swing.JCheckBox" binding="myEnableZenCodingCheckBox">
+ <constraints>
+ <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 resource-bundle="messages/XmlBundle" key="zen.coding.enable.label"/>
+ </properties>
+ </component>
+ <vspacer id="c2c50">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ </children>
+ </grid>
+</form>
--- /dev/null
+/*
+ * Copyright 2000-2010 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.codeInsight.template;
+
+import javax.swing.*;
+
+/**
+ * @author Eugene.Kudelevsky
+ */
+public class ZenCodingSettingsPanel {
+ private JPanel myPanel;
+ private JCheckBox myEnableZenCodingCheckBox;
+
+ public JPanel getComponent() {
+ return myPanel;
+ }
+
+ public boolean isModified() {
+ ZenCodingSettings settings = ZenCodingSettings.getInstance();
+ return settings.ENABLED != myEnableZenCodingCheckBox.isSelected();
+ }
+
+ public void apply() {
+ ZenCodingSettings settings = ZenCodingSettings.getInstance();
+ settings.ENABLED = myEnableZenCodingCheckBox.isSelected();
+ }
+
+ public void reset() {
+ ZenCodingSettings settings = ZenCodingSettings.getInstance();
+ myEnableZenCodingCheckBox.setSelected(settings.ENABLED);
+ }
+}