update copyright
[fedora-idea.git] / xml / impl / src / com / intellij / application / options / editor / WebEditorOptions.java
blobcd18ce3cc99f5f1d027983d6e3c1659183fb46d0
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.application.options.editor;
18 import com.intellij.openapi.application.PathManager;
19 import com.intellij.openapi.components.*;
20 import com.intellij.util.xmlb.XmlSerializerUtil;
21 import com.intellij.xml.XmlBundle;
22 import org.jetbrains.annotations.NotNull;
23 import org.jetbrains.annotations.Nullable;
25 import java.io.File;
27 /**
28 * @author spleaner
30 @State(
31 name="XmlEditorOptions",
32 storages= {
33 @Storage(
34 id="other",
35 file = "$APP_CONFIG$/editor.xml"
38 public class WebEditorOptions implements PersistentStateComponent<WebEditorOptions>, ExportableComponent {
40 private boolean myBreadcrumbsEnabled = true;
41 private boolean myShowCssColorPreviewInGutter = true;
42 private boolean myAutomaticallyInsertClosingTag = true;
43 private boolean myAutomaticallyInsertRequiredAttributes = true;
44 private boolean myAutomaticallyStartAttribute = true;
46 public static WebEditorOptions getInstance() {
47 return ServiceManager.getService(WebEditorOptions.class);
50 public void setBreadcrumbsEnabled(boolean b) {
51 myBreadcrumbsEnabled = b;
54 public boolean isBreadcrumbsEnabled() {
55 return myBreadcrumbsEnabled;
58 public boolean isShowCssColorPreviewInGutter() {
59 return myShowCssColorPreviewInGutter;
62 public void setShowCssColorPreviewInGutter(final boolean showCssColorPreviewInGutter) {
63 myShowCssColorPreviewInGutter = showCssColorPreviewInGutter;
66 public boolean isAutomaticallyInsertClosingTag() {
67 return myAutomaticallyInsertClosingTag;
70 public void setAutomaticallyInsertClosingTag(final boolean automaticallyInsertClosingTag) {
71 myAutomaticallyInsertClosingTag = automaticallyInsertClosingTag;
74 public boolean isAutomaticallyInsertRequiredAttributes() {
75 return myAutomaticallyInsertRequiredAttributes;
78 public void setAutomaticallyInsertRequiredAttributes(final boolean automaticallyInsertRequiredAttributes) {
79 myAutomaticallyInsertRequiredAttributes = automaticallyInsertRequiredAttributes;
82 public boolean isAutomaticallyStartAttribute() {
83 return myAutomaticallyStartAttribute;
86 public void setAutomaticallyStartAttribute(final boolean automaticallyStartAttribute) {
87 myAutomaticallyStartAttribute = automaticallyStartAttribute;
90 @NotNull
91 public File[] getExportFiles() {
92 return new File[]{PathManager.getOptionsFile("editor")};
95 @NotNull
96 public String getPresentableName() {
97 return XmlBundle.message("xml.options");
100 @Nullable
101 public Object clone() {
102 try {
103 return super.clone();
105 catch (CloneNotSupportedException e) {
106 return null;
110 public WebEditorOptions getState() {
111 return this;
114 public void loadState(final WebEditorOptions state) {
115 XmlSerializerUtil.copyBean(state, this);