diff options
Diffstat (limited to 'platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java')
-rw-r--r-- | platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java b/platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java index b07c7a62bc47..760d17e67d24 100644 --- a/platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java +++ b/platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -56,7 +56,7 @@ public class CodeStyleSchemesConfigurable extends SearchableConfigurable.Parent. public JComponent createComponent() { myModel = ensureModel(); - if (Registry.is("ide.file.settings.order.new")) { + if (Registry.is("ide.new.settings.dialog")) { return myPanels == null || myPanels.isEmpty() ? null : myPanels.get(0).createComponent(); } return myRootSchemesPanel.getPanel(); @@ -236,7 +236,7 @@ public class CodeStyleSchemesConfigurable extends SearchableConfigurable.Parent. } } - if (Registry.is("ide.file.settings.order.new")) { + if (Registry.is("ide.new.settings.dialog")) { int size = myPanels.size(); Configurable[] result = new Configurable[size > 0 ? size - 1 : 0]; for (int i = 0; i < result.length; i++) { @@ -346,34 +346,31 @@ public class CodeStyleSchemesConfigurable extends SearchableConfigurable.Parent. String displayName = myProvider.getConfigurableDisplayName(); if (displayName != null) return displayName; - return ensurePanel().getDisplayName(); // fallback for 8.0 API compatibility + return myPanel != null ? myPanel.getDisplayName() : null; // fallback for 8.0 API compatibility } @Override public String getHelpTopic() { - return ensurePanel().getHelpTopic(); - } - - private CodeStyleMainPanel ensurePanel() { - if (myPanel == null) { - myPanel = new CodeStyleMainPanel(ensureModel(), myLangSelector, myFactory); - } - return myPanel; + return myPanel != null ? myPanel.getHelpTopic() : null; } @Override public JComponent createComponent() { - return ensurePanel(); + myPanel = new CodeStyleMainPanel(ensureModel(), myLangSelector, myFactory); + return myPanel; } @Override public boolean isModified() { - boolean someSchemeModified = ensurePanel().isModified(); - if (someSchemeModified) { - myApplyCompleted = false; - myRevertCompleted = false; + if (myPanel != null) { + boolean someSchemeModified = myPanel.isModified(); + if (someSchemeModified) { + myApplyCompleted = false; + myRevertCompleted = false; + } + return someSchemeModified; } - return someSchemeModified; + return false; } @Override @@ -428,20 +425,25 @@ public class CodeStyleSchemesConfigurable extends SearchableConfigurable.Parent. } public boolean isPanelModified(CodeStyleScheme scheme) { - return ensurePanel().isModified(scheme); + return myPanel != null && myPanel.isModified(scheme); } public boolean isPanelModified() { - return ensurePanel().isModified(); + return myPanel != null && myPanel.isModified(); } public void applyPanel() throws ConfigurationException { - ensurePanel().apply(); + if (myPanel != null) { + myPanel.apply(); + } } @Override public Set<String> processListOptions() { - return ensurePanel().processListOptions(); + if (myPanel == null) { + myPanel = new CodeStyleMainPanel(ensureModel(), myLangSelector, myFactory); + } + return myPanel.processListOptions(); } } } |