ComponentWithBrowseButton - optional remove listener on hide
[fedora-idea.git] / xml / impl / src / com / intellij / application / options / editor / WebEditorOptionsProvider.java
blob722928855abf6028435ffcd5cd196dbb4fba5a21
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.options.ConfigurationException;
19 import com.intellij.xml.XmlBundle;
21 import javax.swing.*;
23 /**
24 * @author spleaner
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() {
37 return null;
40 public String getHelpTopic() {
41 return null;
44 public JComponent createComponent() {
45 return myWholePanel;
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());
62 public void reset() {
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) {
77 return null;