IDEA-127739 Navigation Tab
[idea/community.git] / platform / platform-impl / src / com / intellij / ide / ui / AppearanceConfigurable.java
1 /*
2  * Copyright 2000-2014 JetBrains s.r.o.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package com.intellij.ide.ui;
17
18 import com.intellij.ide.IdeBundle;
19 import com.intellij.ide.ui.laf.darcula.DarculaInstaller;
20 import com.intellij.openapi.editor.ex.util.EditorUtil;
21 import com.intellij.openapi.options.BaseConfigurable;
22 import com.intellij.openapi.options.SearchableConfigurable;
23 import com.intellij.openapi.ui.ComboBox;
24 import com.intellij.openapi.util.Comparing;
25 import com.intellij.openapi.util.registry.Registry;
26 import com.intellij.openapi.wm.ex.WindowManagerEx;
27 import com.intellij.ui.components.JBCheckBox;
28 import com.intellij.util.ui.UIUtil;
29 import org.jetbrains.annotations.NotNull;
30 import org.jetbrains.annotations.Nullable;
31
32 import javax.swing.*;
33 import javax.swing.event.ChangeEvent;
34 import javax.swing.event.ChangeListener;
35 import java.awt.event.ActionEvent;
36 import java.awt.event.ActionListener;
37 import java.util.Dictionary;
38 import java.util.Hashtable;
39
40 /**
41  * @author Eugene Belyaev
42  */
43 public class AppearanceConfigurable extends BaseConfigurable implements SearchableConfigurable {
44   private MyComponent myComponent;
45
46   public String getDisplayName() {
47     return IdeBundle.message("title.appearance");
48   }
49
50   public AppearanceConfigurable() {
51     myComponent = new MyComponent();
52   }
53
54   private void initComponent() {
55     if (myComponent == null)  {
56       myComponent = new MyComponent();
57     }
58
59   }
60
61   public JComponent createComponent() {
62     initComponent();
63     DefaultComboBoxModel aModel = new DefaultComboBoxModel(UIUtil.getValidFontNames(false));
64     myComponent.myFontCombo.setModel(aModel);
65     myComponent.myFontSizeCombo.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes()));
66     myComponent.myPresentationModeFontSize.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes()));
67     myComponent.myFontSizeCombo.setEditable(true);
68     myComponent.myPresentationModeFontSize.setEditable(true);
69
70     myComponent.myLafComboBox.setModel(new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels()));
71     myComponent.myLafComboBox.setRenderer(new LafComboBoxRenderer());
72
73     Dictionary<Integer, JComponent> delayDictionary = new Hashtable<Integer, JComponent>();
74     delayDictionary.put(new Integer(0), new JLabel("0"));
75     delayDictionary.put(new Integer(1200), new JLabel("1200"));
76     //delayDictionary.put(new Integer(2400), new JLabel("2400"));
77     myComponent.myInitialTooltipDelaySlider.setLabelTable(delayDictionary);
78     UIUtil.setSliderIsFilled(myComponent.myInitialTooltipDelaySlider, Boolean.TRUE);
79     myComponent.myInitialTooltipDelaySlider.setMinimum(0);
80     myComponent.myInitialTooltipDelaySlider.setMaximum(1200);
81     myComponent.myInitialTooltipDelaySlider.setPaintLabels(true);
82     myComponent.myInitialTooltipDelaySlider.setPaintTicks(true);
83     myComponent.myInitialTooltipDelaySlider.setPaintTrack(true);
84     myComponent.myInitialTooltipDelaySlider.setMajorTickSpacing(1200);
85     myComponent.myInitialTooltipDelaySlider.setMinorTickSpacing(100);
86
87     myComponent.myEnableAlphaModeCheckBox.addActionListener(new ActionListener() {
88       public void actionPerformed(ActionEvent e) {
89         boolean state = myComponent.myEnableAlphaModeCheckBox.isSelected();
90         myComponent.myAlphaModeDelayTextField.setEnabled(state);
91         myComponent.myAlphaModeRatioSlider.setEnabled(state);
92       }
93     });
94
95     myComponent.myAlphaModeRatioSlider.setSize(100, 50);
96     @SuppressWarnings({"UseOfObsoleteCollectionType"})
97     Dictionary<Integer, JComponent> dictionary = new Hashtable<Integer, JComponent>();
98     dictionary.put(new Integer(0), new JLabel("0%"));
99     dictionary.put(new Integer(50), new JLabel("50%"));
100     dictionary.put(new Integer(100), new JLabel("100%"));
101     myComponent.myAlphaModeRatioSlider.setLabelTable(dictionary);
102     UIUtil.setSliderIsFilled(myComponent.myAlphaModeRatioSlider, Boolean.TRUE);
103     myComponent.myAlphaModeRatioSlider.setPaintLabels(true);
104     myComponent.myAlphaModeRatioSlider.setPaintTicks(true);
105     myComponent.myAlphaModeRatioSlider.setPaintTrack(true);
106     myComponent.myAlphaModeRatioSlider.setMajorTickSpacing(50);
107     myComponent.myAlphaModeRatioSlider.setMinorTickSpacing(10);
108     myComponent.myAlphaModeRatioSlider.addChangeListener(new ChangeListener() {
109       public void stateChanged(ChangeEvent e) {
110         myComponent.myAlphaModeRatioSlider.setToolTipText(myComponent.myAlphaModeRatioSlider.getValue() + "%");
111       }
112     });
113
114     myComponent.myTransparencyPanel.setVisible(WindowManagerEx.getInstanceEx().isAlphaModeSupported());
115
116     return myComponent.myPanel;
117   }
118
119   public void apply() {
120     initComponent();
121     UISettings settings = UISettings.getInstance();
122     int _fontSize = getIntValue(myComponent.myFontSizeCombo, settings.FONT_SIZE);
123     int _presentationFontSize = getIntValue(myComponent.myPresentationModeFontSize, settings.PRESENTATION_MODE_FONT_SIZE);
124     boolean shouldUpdateUI = false;
125     String _fontFace = (String)myComponent.myFontCombo.getSelectedItem();
126     LafManager lafManager = LafManager.getInstance();
127     if (_fontSize != settings.FONT_SIZE || !settings.FONT_FACE.equals(_fontFace)) {
128       settings.FONT_SIZE = _fontSize;
129       settings.FONT_FACE = _fontFace;
130       shouldUpdateUI = true;
131     }
132
133     if (_presentationFontSize != settings.PRESENTATION_MODE_FONT_SIZE) {
134       settings.PRESENTATION_MODE_FONT_SIZE = _presentationFontSize;
135       shouldUpdateUI = true;
136     }
137
138     settings.ANIMATE_WINDOWS = myComponent.myAnimateWindowsCheckBox.isSelected();
139     boolean update = settings.SHOW_TOOL_WINDOW_NUMBERS != myComponent.myWindowShortcutsCheckBox.isSelected();
140     settings.SHOW_TOOL_WINDOW_NUMBERS = myComponent.myWindowShortcutsCheckBox.isSelected();
141     update |= settings.HIDE_TOOL_STRIPES != !myComponent.myShowToolStripesCheckBox.isSelected();
142     settings.HIDE_TOOL_STRIPES = !myComponent.myShowToolStripesCheckBox.isSelected();
143     update |= settings.SHOW_ICONS_IN_MENUS != myComponent.myCbDisplayIconsInMenu.isSelected();
144     settings.SHOW_ICONS_IN_MENUS = myComponent.myCbDisplayIconsInMenu.isSelected();
145     update |= settings.SHOW_MEMORY_INDICATOR != myComponent.myShowMemoryIndicatorCheckBox.isSelected();
146     settings.SHOW_MEMORY_INDICATOR = myComponent.myShowMemoryIndicatorCheckBox.isSelected();
147     update |= settings.ALLOW_MERGE_BUTTONS != myComponent.myAllowMergeButtons.isSelected();
148     settings.ALLOW_MERGE_BUTTONS = myComponent.myAllowMergeButtons.isSelected();
149     update |= settings.CYCLE_SCROLLING != myComponent.myCycleScrollingCheckBox.isSelected();
150     settings.CYCLE_SCROLLING = myComponent.myCycleScrollingCheckBox.isSelected();
151     if (settings.OVERRIDE_NONIDEA_LAF_FONTS != myComponent.myOverrideLAFFonts.isSelected()) {
152       shouldUpdateUI = true;
153     }
154     settings.OVERRIDE_NONIDEA_LAF_FONTS = myComponent.myOverrideLAFFonts.isSelected();
155     settings.MOVE_MOUSE_ON_DEFAULT_BUTTON = myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected();
156     settings.HIDE_NAVIGATION_ON_FOCUS_LOSS = myComponent.myHideNavigationPopupsCheckBox.isSelected();
157     settings.DND_WITH_PRESSED_ALT_ONLY = myComponent.myAltDNDCheckBox.isSelected();
158
159     update |= settings.DISABLE_MNEMONICS != myComponent.myDisableMnemonics.isSelected();
160     settings.DISABLE_MNEMONICS = myComponent.myDisableMnemonics.isSelected();
161
162     update |= settings.USE_SMALL_LABELS_ON_TABS != myComponent.myUseSmallLabelsOnTabs.isSelected();
163     settings.USE_SMALL_LABELS_ON_TABS = myComponent.myUseSmallLabelsOnTabs.isSelected();
164
165     update |= settings.WIDESCREEN_SUPPORT != myComponent.myWidescreenLayoutCheckBox.isSelected();
166     settings.WIDESCREEN_SUPPORT = myComponent.myWidescreenLayoutCheckBox.isSelected();
167
168     update |= settings.LEFT_HORIZONTAL_SPLIT != myComponent.myLeftLayoutCheckBox.isSelected();
169     settings.LEFT_HORIZONTAL_SPLIT = myComponent.myLeftLayoutCheckBox.isSelected();
170
171     update |= settings.RIGHT_HORIZONTAL_SPLIT != myComponent.myRightLayoutCheckBox.isSelected();
172     settings.RIGHT_HORIZONTAL_SPLIT = myComponent.myRightLayoutCheckBox.isSelected();
173
174     update |= settings.SHOW_EDITOR_TOOLTIP != myComponent.myEditorTooltipCheckBox.isSelected();
175     settings.SHOW_EDITOR_TOOLTIP = myComponent.myEditorTooltipCheckBox.isSelected();
176
177     update |= settings.NAVIGATE_TO_PREVIEW != myComponent.myNavigateToPreviewCheckBox.isSelected();
178     settings.NAVIGATE_TO_PREVIEW = myComponent.myNavigateToPreviewCheckBox.isSelected();
179
180     update |= settings.DISABLE_MNEMONICS_IN_CONTROLS != myComponent.myDisableMnemonicInControlsCheckBox.isSelected();
181     settings.DISABLE_MNEMONICS_IN_CONTROLS = myComponent.myDisableMnemonicInControlsCheckBox.isSelected();
182
183     update |= settings.SHOW_ICONS_IN_QUICK_NAVIGATION != myComponent.myHideIconsInQuickNavigation.isSelected();
184     settings.SHOW_ICONS_IN_QUICK_NAVIGATION = myComponent.myHideIconsInQuickNavigation.isSelected();
185
186     if (!Comparing.equal(myComponent.myLafComboBox.getSelectedItem(), lafManager.getCurrentLookAndFeel())) {
187       final UIManager.LookAndFeelInfo lafInfo = (UIManager.LookAndFeelInfo)myComponent.myLafComboBox.getSelectedItem();
188       if (lafManager.checkLookAndFeel(lafInfo)) {
189         update = shouldUpdateUI = true;
190         final boolean wasDarcula = UIUtil.isUnderDarcula();
191         lafManager.setCurrentLookAndFeel(lafInfo);
192         //noinspection SSBasedInspection
193         SwingUtilities.invokeLater(new Runnable() {
194           public void run() {
195             if (UIUtil.isUnderDarcula()) {
196               DarculaInstaller.install();
197             } else if (wasDarcula) {
198               DarculaInstaller.uninstall();
199             }
200           }
201         });
202       }
203     }
204
205
206     if (shouldUpdateUI) {
207       lafManager.updateUI();
208     }
209
210     if (WindowManagerEx.getInstanceEx().isAlphaModeSupported()) {
211       int delay = -1;
212       try {
213         delay = Integer.parseInt(myComponent.myAlphaModeDelayTextField.getText());
214       }
215       catch (NumberFormatException ignored) {
216       }
217       float ratio = myComponent.myAlphaModeRatioSlider.getValue() / 100f;
218       if (myComponent.myEnableAlphaModeCheckBox.isSelected() != settings.ENABLE_ALPHA_MODE ||
219           delay != -1 && delay != settings.ALPHA_MODE_DELAY || ratio != settings.ALPHA_MODE_RATIO) {
220         update = true;
221         settings.ENABLE_ALPHA_MODE = myComponent.myEnableAlphaModeCheckBox.isSelected();
222         settings.ALPHA_MODE_DELAY = delay;
223         settings.ALPHA_MODE_RATIO = ratio;
224       }
225     }
226     int tooltipDelay = Math.min(myComponent.myInitialTooltipDelaySlider.getValue(), 5000);
227     if (tooltipDelay != Registry.intValue("ide.tooltip.initialDelay")) {
228       update = true;
229       Registry.get("ide.tooltip.initialDelay").setValue(tooltipDelay);
230     }
231
232     if (update) {
233       settings.fireUISettingsChanged();
234     }
235     myComponent.updateCombo();
236
237     EditorUtil.reinitSettings();
238   }
239
240   private static int getIntValue(JComboBox combo, int defaultValue) {
241     String temp = (String)combo.getEditor().getItem();
242     int value = -1;
243     if (temp != null && temp.trim().length() > 0) {
244       try {
245         value = Integer.parseInt(temp);
246       }
247       catch (NumberFormatException ignore) {
248       }
249       if (value <= 0) {
250         value = defaultValue;
251       }
252     }
253     else {
254       value = defaultValue;
255     }
256     return value;
257   }
258
259   public void reset() {
260     initComponent();
261     UISettings settings = UISettings.getInstance();
262
263     myComponent.myFontCombo.setSelectedItem(settings.FONT_FACE);
264     myComponent.myFontSizeCombo.setSelectedItem(Integer.toString(settings.FONT_SIZE));
265     myComponent.myPresentationModeFontSize.setSelectedItem(Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE));
266     myComponent.myAnimateWindowsCheckBox.setSelected(settings.ANIMATE_WINDOWS);
267     myComponent.myWindowShortcutsCheckBox.setSelected(settings.SHOW_TOOL_WINDOW_NUMBERS);
268     myComponent.myShowToolStripesCheckBox.setSelected(!settings.HIDE_TOOL_STRIPES);
269     myComponent.myCbDisplayIconsInMenu.setSelected(settings.SHOW_ICONS_IN_MENUS);
270     myComponent.myShowMemoryIndicatorCheckBox.setSelected(settings.SHOW_MEMORY_INDICATOR);
271     myComponent.myAllowMergeButtons.setSelected(settings.ALLOW_MERGE_BUTTONS);
272     myComponent.myCycleScrollingCheckBox.setSelected(settings.CYCLE_SCROLLING);
273
274     myComponent.myHideIconsInQuickNavigation.setSelected(settings.SHOW_ICONS_IN_QUICK_NAVIGATION);
275     myComponent.myMoveMouseOnDefaultButtonCheckBox.setSelected(settings.MOVE_MOUSE_ON_DEFAULT_BUTTON);
276     myComponent.myHideNavigationPopupsCheckBox.setSelected(settings.HIDE_NAVIGATION_ON_FOCUS_LOSS);
277     myComponent.myAltDNDCheckBox.setSelected(settings.DND_WITH_PRESSED_ALT_ONLY);
278     myComponent.myLafComboBox.setSelectedItem(LafManager.getInstance().getCurrentLookAndFeel());
279     myComponent.myOverrideLAFFonts.setSelected(settings.OVERRIDE_NONIDEA_LAF_FONTS);
280     myComponent.myDisableMnemonics.setSelected(settings.DISABLE_MNEMONICS);
281     myComponent.myUseSmallLabelsOnTabs.setSelected(settings.USE_SMALL_LABELS_ON_TABS);
282     myComponent.myWidescreenLayoutCheckBox.setSelected(settings.WIDESCREEN_SUPPORT);
283     myComponent.myLeftLayoutCheckBox.setSelected(settings.LEFT_HORIZONTAL_SPLIT);
284     myComponent.myRightLayoutCheckBox.setSelected(settings.RIGHT_HORIZONTAL_SPLIT);
285     myComponent.myEditorTooltipCheckBox.setSelected(settings.SHOW_EDITOR_TOOLTIP);
286     myComponent.myNavigateToPreviewCheckBox.setSelected(settings.NAVIGATE_TO_PREVIEW);
287     myComponent.myDisableMnemonicInControlsCheckBox.setSelected(settings.DISABLE_MNEMONICS_IN_CONTROLS);
288
289     boolean alphaModeEnabled = WindowManagerEx.getInstanceEx().isAlphaModeSupported();
290     if (alphaModeEnabled) {
291       myComponent.myEnableAlphaModeCheckBox.setSelected(settings.ENABLE_ALPHA_MODE);
292     }
293     else {
294       myComponent.myEnableAlphaModeCheckBox.setSelected(false);
295     }
296     myComponent.myEnableAlphaModeCheckBox.setEnabled(alphaModeEnabled);
297     myComponent.myAlphaModeDelayTextField.setText(Integer.toString(settings.ALPHA_MODE_DELAY));
298     myComponent.myAlphaModeDelayTextField.setEnabled(alphaModeEnabled && settings.ENABLE_ALPHA_MODE);
299     int ratio = (int)(settings.ALPHA_MODE_RATIO * 100f);
300     myComponent.myAlphaModeRatioSlider.setValue(ratio);
301     myComponent.myAlphaModeRatioSlider.setToolTipText(ratio + "%");
302     myComponent.myAlphaModeRatioSlider.setEnabled(alphaModeEnabled && settings.ENABLE_ALPHA_MODE);
303     myComponent.myInitialTooltipDelaySlider.setValue(Registry.intValue("ide.tooltip.initialDelay"));
304     myComponent.updateCombo();
305   }
306
307   public boolean isModified() {
308     initComponent();
309     UISettings settings = UISettings.getInstance();
310
311     boolean isModified = false;
312     isModified |= !Comparing.equal(myComponent.myFontCombo.getSelectedItem(), settings.FONT_FACE);
313     isModified |= !Comparing.equal(myComponent.myFontSizeCombo.getEditor().getItem(), Integer.toString(settings.FONT_SIZE));
314     isModified |= myComponent.myAnimateWindowsCheckBox.isSelected() != settings.ANIMATE_WINDOWS;
315     isModified |= myComponent.myWindowShortcutsCheckBox.isSelected() != settings.SHOW_TOOL_WINDOW_NUMBERS;
316     isModified |= myComponent.myShowToolStripesCheckBox.isSelected() == settings.HIDE_TOOL_STRIPES;
317     isModified |= myComponent.myCbDisplayIconsInMenu.isSelected() != settings.SHOW_ICONS_IN_MENUS;
318     isModified |= myComponent.myShowMemoryIndicatorCheckBox.isSelected() != settings.SHOW_MEMORY_INDICATOR;
319     isModified |= myComponent.myAllowMergeButtons.isSelected() != settings.ALLOW_MERGE_BUTTONS;
320     isModified |= myComponent.myCycleScrollingCheckBox.isSelected() != settings.CYCLE_SCROLLING;
321
322     isModified |= myComponent.myOverrideLAFFonts.isSelected() != settings.OVERRIDE_NONIDEA_LAF_FONTS;
323
324     isModified |= myComponent.myDisableMnemonics.isSelected() != settings.DISABLE_MNEMONICS;
325     isModified |= myComponent.myDisableMnemonicInControlsCheckBox.isSelected() != settings.DISABLE_MNEMONICS_IN_CONTROLS;
326
327     isModified |= myComponent.myUseSmallLabelsOnTabs.isSelected() != settings.USE_SMALL_LABELS_ON_TABS;
328     isModified |= myComponent.myWidescreenLayoutCheckBox.isSelected() != settings.WIDESCREEN_SUPPORT;
329     isModified |= myComponent.myLeftLayoutCheckBox.isSelected() != settings.LEFT_HORIZONTAL_SPLIT;
330     isModified |= myComponent.myRightLayoutCheckBox.isSelected() != settings.RIGHT_HORIZONTAL_SPLIT;
331     isModified |= myComponent.myEditorTooltipCheckBox.isSelected() != settings.SHOW_EDITOR_TOOLTIP;
332     isModified |= myComponent.myNavigateToPreviewCheckBox.isSelected() != settings.NAVIGATE_TO_PREVIEW;
333
334     isModified |= myComponent.myHideIconsInQuickNavigation.isSelected() != settings.SHOW_ICONS_IN_QUICK_NAVIGATION;
335
336     isModified |= !Comparing.equal(myComponent.myPresentationModeFontSize.getEditor().getItem(), Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE));
337
338     isModified |= myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected() != settings.MOVE_MOUSE_ON_DEFAULT_BUTTON;
339     isModified |= myComponent.myHideNavigationPopupsCheckBox.isSelected() != settings.HIDE_NAVIGATION_ON_FOCUS_LOSS;
340     isModified |= myComponent.myAltDNDCheckBox.isSelected() != settings.DND_WITH_PRESSED_ALT_ONLY;
341     isModified |= !Comparing.equal(myComponent.myLafComboBox.getSelectedItem(), LafManager.getInstance().getCurrentLookAndFeel());
342     if (WindowManagerEx.getInstanceEx().isAlphaModeSupported()) {
343       isModified |= myComponent.myEnableAlphaModeCheckBox.isSelected() != settings.ENABLE_ALPHA_MODE;
344       int delay = -1;
345       try {
346         delay = Integer.parseInt(myComponent.myAlphaModeDelayTextField.getText());
347       }
348       catch (NumberFormatException ignored) {
349       }
350       if (delay != -1) {
351         isModified |= delay != settings.ALPHA_MODE_DELAY;
352       }
353       float ratio = myComponent.myAlphaModeRatioSlider.getValue() / 100f;
354       isModified |= ratio != settings.ALPHA_MODE_RATIO;
355     }
356     int tooltipDelay = -1;
357     tooltipDelay = myComponent.myInitialTooltipDelaySlider.getValue();
358     isModified |=  tooltipDelay != Registry.intValue("ide.tooltip.initialDelay");
359
360     return isModified;
361   }
362
363   public void disposeUIResources() {
364     myComponent = null;
365   }
366
367   public String getHelpTopic() {
368     return "preferences.lookFeel";
369   }
370
371   private static class MyComponent {
372     private JPanel myPanel;
373     private JComboBox myFontCombo;
374     private JComboBox myFontSizeCombo;
375     private JCheckBox myAnimateWindowsCheckBox;
376     private JCheckBox myWindowShortcutsCheckBox;
377     private JCheckBox myShowToolStripesCheckBox;
378     private JCheckBox myShowMemoryIndicatorCheckBox;
379     private JComboBox myLafComboBox;
380     private JCheckBox myCycleScrollingCheckBox;
381
382     private JCheckBox myMoveMouseOnDefaultButtonCheckBox;
383     private JCheckBox myEnableAlphaModeCheckBox;
384     private JTextField myAlphaModeDelayTextField;
385     private JSlider myAlphaModeRatioSlider;
386     private JLabel myFontSizeLabel;
387     private JLabel myFontNameLabel;
388     private JPanel myTransparencyPanel;
389     private JCheckBox myOverrideLAFFonts;
390
391     private JCheckBox myHideIconsInQuickNavigation;
392     private JCheckBox myCbDisplayIconsInMenu;
393     private JCheckBox myDisableMnemonics;
394     private JCheckBox myDisableMnemonicInControlsCheckBox;
395     private JCheckBox myHideNavigationPopupsCheckBox;
396     private JCheckBox myAltDNDCheckBox;
397     private JCheckBox myAllowMergeButtons;
398     private JBCheckBox myUseSmallLabelsOnTabs;
399     private JBCheckBox myWidescreenLayoutCheckBox;
400     private JCheckBox myLeftLayoutCheckBox;
401     private JCheckBox myRightLayoutCheckBox;
402     private JSlider myInitialTooltipDelaySlider;
403     private ComboBox myPresentationModeFontSize;
404     private JCheckBox myEditorTooltipCheckBox;
405     private JCheckBox myNavigateToPreviewCheckBox;
406     private JCheckBox myAllowStatusBar;
407     private JCheckBox myAllowLineNumbers;
408     private JCheckBox myAllowAnnotations;
409
410     public MyComponent() {
411       myOverrideLAFFonts.addActionListener( new ActionListener() {
412         public void actionPerformed(ActionEvent e) {
413           updateCombo();
414         }
415       });
416     }
417
418     public void updateCombo() {
419       boolean enableChooser = myOverrideLAFFonts.isSelected();
420
421       myFontCombo.setEnabled(enableChooser);
422       myFontSizeCombo.setEnabled(enableChooser);
423       myFontNameLabel.setEnabled(enableChooser);
424       myFontSizeLabel.setEnabled(enableChooser);
425     }
426
427     private void createUIComponents() {
428       myFontSizeCombo = new ComboBox();
429       myPresentationModeFontSize = new ComboBox();
430     }
431   }
432
433   @NotNull
434   public String getId() {
435     //noinspection ConstantConditions
436     return getHelpTopic();
437   }
438
439   @Nullable
440   public Runnable enableSearch(String option) {
441     return null;
442   }
443 }