diff --git a/xml/impl/src/com/intellij/application/options/editor/XmlCodeFoldingOptionsProvider.java b/xml/impl/src/com/intellij/application/options/editor/XmlCodeFoldingOptionsProvider.java index a31aff914c6a7..abdb42ee438b8 100644 --- a/xml/impl/src/com/intellij/application/options/editor/XmlCodeFoldingOptionsProvider.java +++ b/xml/impl/src/com/intellij/application/options/editor/XmlCodeFoldingOptionsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -23,9 +23,9 @@ import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.options.BeanConfigurable; -public class XmlCodeFoldingOptionsProvider extends BeanConfigurable implements CodeFoldingOptionsProvider { +public class XmlCodeFoldingOptionsProvider extends BeanConfigurable implements CodeFoldingOptionsProvider { public XmlCodeFoldingOptionsProvider() { - super(XmlFoldingSettings.getInstance()); + super(XmlFoldingSettings.getInstance().getState()); checkBox("COLLAPSE_XML_TAGS", ApplicationBundle.message("checkbox.collapse.xml.tags")); checkBox("COLLAPSE_HTML_STYLE_ATTRIBUTE", ApplicationBundle.message("checkbox.collapse.html.style.attribute")); checkBox("COLLAPSE_ENTITIES", ApplicationBundle.message("checkbox.collapse.entities")); diff --git a/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java b/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java index 6d06f8670640c..70ad3b4fad575 100644 --- a/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java +++ b/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java @@ -20,54 +20,42 @@ import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.util.xmlb.XmlSerializerUtil; -@State( - name = "XmlFoldingSettings", - storages = @Storage("editor.codeinsight.xml") -) -public class XmlFoldingSettings implements XmlCodeFoldingSettings, PersistentStateComponent { +@State(name = "XmlFoldingSettings", storages = @Storage("editor.codeinsight.xml")) +public class XmlFoldingSettings implements XmlCodeFoldingSettings, PersistentStateComponent { + private XmlFoldingSettings.State myState; + public static XmlFoldingSettings getInstance() { return ServiceManager.getService(XmlFoldingSettings.class); } @Override public boolean isCollapseXmlTags() { - return COLLAPSE_XML_TAGS; - } - - public void setCollapseXmlTags(boolean value) { - COLLAPSE_XML_TAGS = value; + return myState.COLLAPSE_XML_TAGS; } @Override public boolean isCollapseHtmlStyleAttribute() { - return COLLAPSE_HTML_STYLE_ATTRIBUTE; + return myState.COLLAPSE_HTML_STYLE_ATTRIBUTE; } public boolean isCollapseEntities() { - return COLLAPSE_ENTITIES; - } - - public void setCollapseEntities(boolean COLLAPSE_ENTITIES) { - this.COLLAPSE_ENTITIES = COLLAPSE_ENTITIES; + return myState.COLLAPSE_ENTITIES; } - public void setCollapseHtmlStyleAttribute(boolean value) { - this.COLLAPSE_HTML_STYLE_ATTRIBUTE = value; + @Override + public State getState() { + return myState; } - @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_XML_TAGS = false; - @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_HTML_STYLE_ATTRIBUTE = true; - @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_ENTITIES = true; - @Override - public XmlFoldingSettings getState() { - return this; + public void loadState(State state) { + myState = state; } - @Override - public void loadState(final XmlFoldingSettings state) { - XmlSerializerUtil.copyBean(state, this); + public static final class State { + public boolean COLLAPSE_XML_TAGS = false; + public boolean COLLAPSE_HTML_STYLE_ATTRIBUTE = true; + public boolean COLLAPSE_ENTITIES = true; } } \ No newline at end of file