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
.options
.ConfigurationException
;
19 import com
.intellij
.xml
.XmlBundle
;
26 public class WebEditorOptionsProvider
implements EditorOptionsProvider
{
27 private JPanel myWholePanel
;
28 private JCheckBox myAutomaticallyInsertClosingTagCheckBox
;
29 private JCheckBox myAutomaticallyInsertRequiredAttributesCheckBox
;
30 private JCheckBox myAutomaticallyStartAttributeAfterCheckBox
;
32 public String
getDisplayName() {
33 return XmlBundle
.message("web.editor.configuration.title");
36 public Icon
getIcon() {
40 public String
getHelpTopic() {
44 public JComponent
createComponent() {
48 public boolean isModified() {
49 final WebEditorOptions xmlEditorOptions
= WebEditorOptions
.getInstance();
50 return xmlEditorOptions
.isAutomaticallyInsertClosingTag() != myAutomaticallyInsertClosingTagCheckBox
.isSelected()
51 || xmlEditorOptions
.isAutomaticallyInsertRequiredAttributes() != myAutomaticallyInsertRequiredAttributesCheckBox
.isSelected()
52 || xmlEditorOptions
.isAutomaticallyStartAttribute() != myAutomaticallyStartAttributeAfterCheckBox
.isSelected();
55 public void apply() throws ConfigurationException
{
56 final WebEditorOptions xmlEditorOptions
= WebEditorOptions
.getInstance();
57 xmlEditorOptions
.setAutomaticallyInsertClosingTag(myAutomaticallyInsertClosingTagCheckBox
.isSelected());
58 xmlEditorOptions
.setAutomaticallyInsertRequiredAttributes(myAutomaticallyInsertRequiredAttributesCheckBox
.isSelected());
59 xmlEditorOptions
.setAutomaticallyStartAttribute(myAutomaticallyStartAttributeAfterCheckBox
.isSelected());
63 final WebEditorOptions xmlEditorOptions
= WebEditorOptions
.getInstance();
64 myAutomaticallyInsertClosingTagCheckBox
.setSelected(xmlEditorOptions
.isAutomaticallyInsertClosingTag());
65 myAutomaticallyInsertRequiredAttributesCheckBox
.setSelected(xmlEditorOptions
.isAutomaticallyInsertRequiredAttributes());
66 myAutomaticallyStartAttributeAfterCheckBox
.setSelected(xmlEditorOptions
.isAutomaticallyStartAttribute());
69 public void disposeUIResources() {
72 public String
getId() {
73 return "editor.preferences.webOptions";
76 public Runnable
enableSearch(final String option
) {