diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java index df49e6199b5b..1687263a3815 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java @@ -22,6 +22,7 @@ import com.intellij.openapi.options.OptionalConfigurable; import com.intellij.openapi.project.Project; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Iterator; @@ -38,7 +39,7 @@ public class ConfigurableExtensionPointUtil { } - public static List buildConfigurablesList(final ConfigurableEP[] extensions, final Configurable[] components, ConfigurableFilter filter) { + public static List buildConfigurablesList(final ConfigurableEP[] extensions, final Configurable[] components, @Nullable ConfigurableFilter filter) { List result = new ArrayList(); for (ConfigurableEP extension : extensions) { ContainerUtil.addIfNotNull(extension.createConfigurable(), result); diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurablesGroupBase.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurablesGroupBase.java new file mode 100644 index 000000000000..d42f87f72f6b --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurablesGroupBase.java @@ -0,0 +1,54 @@ +/* + * Copyright 2000-2010 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.options.ex; + +import com.intellij.openapi.components.ComponentManager; +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableEP; +import com.intellij.openapi.options.ConfigurableGroup; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +/** + * @author nik + */ +public abstract class ConfigurablesGroupBase implements ConfigurableGroup { + private Configurable[] myChildren; + private ComponentManager myComponentManager; + private final ExtensionPointName myConfigurablesExtensionPoint; + + protected ConfigurablesGroupBase(ComponentManager componentManager, final ExtensionPointName configurablesExtensionPoint) { + myComponentManager = componentManager; + myConfigurablesExtensionPoint = configurablesExtensionPoint; + } + + @Override + public Configurable[] getConfigurables() { + if (myChildren == null) { + final ConfigurableEP[] extensions = myComponentManager.getExtensions(myConfigurablesExtensionPoint); + Configurable[] components = myComponentManager.getComponents(Configurable.class); + + List result = ConfigurableExtensionPointUtil.buildConfigurablesList(extensions, components, getConfigurableFilter()); + myChildren = result.toArray(new Configurable[result.size()]); + } + return myChildren; + } + + @Nullable + protected abstract ConfigurableFilter getConfigurableFilter(); +} diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/IdeConfigurablesGroup.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/IdeConfigurablesGroup.java index f099ad6794e9..4ee03b08bcf1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/IdeConfigurablesGroup.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/IdeConfigurablesGroup.java @@ -15,11 +15,9 @@ */ package com.intellij.openapi.options.ex; -import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.options.*; - -import java.util.List; +import com.intellij.openapi.options.ConfigurableGroup; +import com.intellij.openapi.options.OptionsBundle; /** * Created by IntelliJ IDEA. @@ -28,7 +26,10 @@ import java.util.List; * Time: 3:35:56 PM * To change this template use Options | File Templates. */ -public class IdeConfigurablesGroup implements ConfigurableGroup { +public class IdeConfigurablesGroup extends ConfigurablesGroupBase implements ConfigurableGroup { + public IdeConfigurablesGroup() { + super(ApplicationManager.getApplication(), ConfigurableExtensionPointUtil.APPLICATION_CONFIGURABLES); + } public String getDisplayName() { return OptionsBundle.message("ide.settings.display.name"); @@ -38,14 +39,9 @@ public class IdeConfigurablesGroup implements ConfigurableGroup { return OptionsBundle.message("ide.settings.short.name"); } - public Configurable[] getConfigurables() { - final Application app = ApplicationManager.getApplication(); - final ConfigurableEP[] extensions = app.getExtensions(ConfigurableExtensionPointUtil.APPLICATION_CONFIGURABLES); - Configurable[] components = app.getComponents(Configurable.class); - - List result = ConfigurableExtensionPointUtil.buildConfigurablesList(extensions, components, null); - - return result.toArray(new Configurable[result.size()]); + @Override + protected ConfigurableFilter getConfigurableFilter() { + return null; } public boolean equals(Object object) { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/ProjectConfigurablesGroup.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/ProjectConfigurablesGroup.java index 74ecce5af38a..910bf991e967 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/ProjectConfigurablesGroup.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/ProjectConfigurablesGroup.java @@ -15,18 +15,20 @@ */ package com.intellij.openapi.options.ex; -import com.intellij.openapi.options.*; +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableGroup; +import com.intellij.openapi.options.NonDefaultProjectConfigurable; +import com.intellij.openapi.options.OptionsBundle; import com.intellij.openapi.project.Project; -import java.util.List; - /** * @author max */ -public class ProjectConfigurablesGroup implements ConfigurableGroup { - private Project myProject; +public class ProjectConfigurablesGroup extends ConfigurablesGroupBase implements ConfigurableGroup { + private final Project myProject; public ProjectConfigurablesGroup(Project project) { + super(project, ConfigurableExtensionPointUtil.PROJECT_CONFIGURABLES); myProject = project; } @@ -44,17 +46,14 @@ public class ProjectConfigurablesGroup implements ConfigurableGroup { return myProject.isDefault(); } - public Configurable[] getConfigurables() { - final ConfigurableEP[] extensions = myProject.getExtensions(ConfigurableExtensionPointUtil.PROJECT_CONFIGURABLES); - Configurable[] components = myProject.getComponents(Configurable.class); - List result = ConfigurableExtensionPointUtil.buildConfigurablesList(extensions, components, new ConfigurableFilter() { + @Override + protected ConfigurableFilter getConfigurableFilter() { + return new ConfigurableFilter() { public boolean isIncluded(final Configurable configurable) { if (isDefault() && configurable instanceof NonDefaultProjectConfigurable) return false; return true; } - }); - - return result.toArray(new Configurable[result.size()]); + }; } public int hashCode() { diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index 797029508bbd..b56748745cea 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -259,7 +259,7 @@ - + @@ -543,8 +543,8 @@ factoryClass="com.intellij.ide.structureView.impl.StructureViewToolWindowFactory"/> - - + + diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml index 59c859ebc6bd..3702f6ac42d4 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml @@ -198,7 +198,7 @@ - + diff --git a/platform/platform-resources/src/META-INF/VcsExtensions.xml b/platform/platform-resources/src/META-INF/VcsExtensions.xml index 970c128ebdb2..23341bf71b65 100644 --- a/platform/platform-resources/src/META-INF/VcsExtensions.xml +++ b/platform/platform-resources/src/META-INF/VcsExtensions.xml @@ -9,7 +9,7 @@ - + diff --git a/plugins/copyright/src/META-INF/plugin.xml b/plugins/copyright/src/META-INF/plugin.xml index 379f2cf7e3da..2657e48bd11c 100644 --- a/plugins/copyright/src/META-INF/plugin.xml +++ b/plugins/copyright/src/META-INF/plugin.xml @@ -9,7 +9,7 @@ a consistent copyright notice. - + - - + + diff --git a/plugins/maven/src/main/resources/META-INF/plugin.xml b/plugins/maven/src/main/resources/META-INF/plugin.xml index 6ee2fbc55d1b..0d9aa865dfeb 100644 --- a/plugins/maven/src/main/resources/META-INF/plugin.xml +++ b/plugins/maven/src/main/resources/META-INF/plugin.xml @@ -24,7 +24,7 @@ - + diff --git a/plugins/spellchecker/src/META-INF/plugin.xml b/plugins/spellchecker/src/META-INF/plugin.xml index 8c95ee9b8b3e..4bd26710b1d4 100644 --- a/plugins/spellchecker/src/META-INF/plugin.xml +++ b/plugins/spellchecker/src/META-INF/plugin.xml @@ -54,7 +54,7 @@ - + - + diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/associations/impl/FileAssociationsConfigurable.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/associations/impl/FileAssociationsConfigurable.java index fd85c8d1251e..6527b04b0177 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/associations/impl/FileAssociationsConfigurable.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/associations/impl/FileAssociationsConfigurable.java @@ -39,7 +39,7 @@ public class FileAssociationsConfigurable implements SearchableConfigurable, Non private final UIState myState; private AssociationsEditor myEditor; - FileAssociationsConfigurable(Project project) { + public FileAssociationsConfigurable(Project project) { myProject = project; myState = ServiceManager.getService(project, UIState.class); } diff --git a/plugins/xpath/xpath-view/src/META-INF/plugin.xml b/plugins/xpath/xpath-view/src/META-INF/plugin.xml index ae61779d7e12..baf9effd9f49 100644 --- a/plugins/xpath/xpath-view/src/META-INF/plugin.xml +++ b/plugins/xpath/xpath-view/src/META-INF/plugin.xml @@ -61,7 +61,7 @@ serviceInterface="org.intellij.lang.xpath.xslt.psi.XsltElementFactory" serviceImplementation="org.intellij.lang.xpath.xslt.psi.impl.XsltElementFactoryImpl" /> - + - + - + diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ManuallySetupExtResourceAction.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ManuallySetupExtResourceAction.java index 827e60035627..e9d00bbb2aa0 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ManuallySetupExtResourceAction.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ManuallySetupExtResourceAction.java @@ -19,6 +19,7 @@ import com.intellij.javaee.ExternalResourceConfigurable; import com.intellij.javaee.ExternalResourceManager; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.options.ShowSettingsUtil; +import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; @@ -34,16 +35,14 @@ public class ManuallySetupExtResourceAction extends BaseExtResourceAction { protected void doInvoke(@NotNull final PsiFile file, final int offset, @NotNull final String uri, final Editor editor) throws IncorrectOperationException { ExternalResourceManager.getInstance().addResource(uri,""); - final ExternalResourceConfigurable component = ShowSettingsUtil.getInstance().createProjectConfigurable(file.getProject(), ExternalResourceConfigurable.class); - ShowSettingsUtil.getInstance().editConfigurable( - file.getProject(), - component, - new Runnable() { - public void run() { - component.selectResource(uri); - } + final ShowSettingsUtil util = ShowSettingsUtil.getInstance(); + final Project project = file.getProject(); + final ExternalResourceConfigurable component = util.createProjectConfigurable(project, ExternalResourceConfigurable.class); + util.editConfigurable(project, component, new Runnable() { + public void run() { + component.selectResource(uri); } - ); + }); } public boolean startInWriteAction() {