mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Use separate class to store xml folding settings state
this is required for proper merging Css and Xml folding settings
This commit is contained in:
+3
-3
@@ -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 @@ package com.intellij.application.options.editor;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.options.BeanConfigurable;
|
||||
|
||||
public class XmlCodeFoldingOptionsProvider extends BeanConfigurable<XmlFoldingSettings> implements CodeFoldingOptionsProvider {
|
||||
public class XmlCodeFoldingOptionsProvider extends BeanConfigurable<XmlFoldingSettings.State> 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"));
|
||||
|
||||
+20
-32
@@ -20,54 +20,42 @@ 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;
|
||||
|
||||
@State(
|
||||
name = "XmlFoldingSettings",
|
||||
storages = @Storage("editor.codeinsight.xml")
|
||||
)
|
||||
public class XmlFoldingSettings implements XmlCodeFoldingSettings, PersistentStateComponent<XmlFoldingSettings> {
|
||||
@State(name = "XmlFoldingSettings", storages = @Storage("editor.codeinsight.xml"))
|
||||
public class XmlFoldingSettings implements XmlCodeFoldingSettings, PersistentStateComponent<XmlFoldingSettings.State> {
|
||||
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;
|
||||
}
|
||||
|
||||
public void setCollapseHtmlStyleAttribute(boolean value) {
|
||||
this.COLLAPSE_HTML_STYLE_ATTRIBUTE = value;
|
||||
}
|
||||
|
||||
@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;
|
||||
return myState.COLLAPSE_ENTITIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(final XmlFoldingSettings state) {
|
||||
XmlSerializerUtil.copyBean(state, this);
|
||||
public State getState() {
|
||||
return myState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(State state) {
|
||||
myState = state;
|
||||
}
|
||||
|
||||
public static final class State {
|
||||
public boolean COLLAPSE_XML_TAGS = false;
|
||||
public boolean COLLAPSE_HTML_STYLE_ATTRIBUTE = true;
|
||||
public boolean COLLAPSE_ENTITIES = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user