From 75ebe010632897eb1ea5c3c08daa4daa2e9baee3 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 7 Jul 2010 15:00:54 +0400 Subject: [PATCH] added extension for communication between different framework support providers --- .../AddSupportForFrameworksPanel.java | 7 +++- .../impl/FrameworkSupportCommunicator.java | 35 +++++++++++++++++++ .../FacetBasedFrameworkSupportProvider.java | 2 +- resources/src/META-INF/IdeaPlugin.xml | 1 + 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 java/idea-ui/src/com/intellij/ide/util/newProjectWizard/impl/FrameworkSupportCommunicator.java diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java index ee078e322db3..729972d24cdf 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java @@ -26,6 +26,7 @@ import com.intellij.facet.ui.libraries.RemoteRepositoryInfo; import com.intellij.ide.util.frameworkSupport.FrameworkSupportConfigurable; import com.intellij.ide.util.frameworkSupport.FrameworkSupportConfigurableListener; import com.intellij.ide.util.frameworkSupport.FrameworkSupportProvider; +import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportCommunicator; import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelImpl; import com.intellij.ide.util.projectWizard.ModuleBuilder; import com.intellij.openapi.Disposable; @@ -341,9 +342,10 @@ public class AddSupportForFrameworksPanel implements Disposable { List addedLibraries = new ArrayList(); List selectedFrameworks = getFrameworkNodes(true); sortFrameworks(selectedFrameworks); - + List selectedConfigurables = new ArrayList(); for (FrameworkSupportNode node : selectedFrameworks) { FrameworkSupportConfigurable configurable = node.getConfigurable(); + selectedConfigurables.add(configurable); final LibraryCompositionSettings settings = node.getLibraryCompositionSettings(); Library library = settings != null ? settings.addLibraries(rootModel, addedLibraries) : null; configurable.addSupport(module, rootModel, library); @@ -354,6 +356,9 @@ public class AddSupportForFrameworksPanel implements Disposable { ((FacetBasedFrameworkSupportProvider)provider).processAddedLibraries(module, addedLibraries); } } + for (FrameworkSupportCommunicator communicator : FrameworkSupportCommunicator.EP_NAME.getExtensions()) { + communicator.onFrameworkSupportAdded(module, rootModel, selectedConfigurables, myModel); + } } private void sortFrameworks(final List nodes) { diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/impl/FrameworkSupportCommunicator.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/impl/FrameworkSupportCommunicator.java new file mode 100644 index 000000000000..b6d325b8bffa --- /dev/null +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/impl/FrameworkSupportCommunicator.java @@ -0,0 +1,35 @@ +/* + * 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.ide.util.newProjectWizard.impl; + +import com.intellij.ide.util.frameworkSupport.FrameworkSupportConfigurable; +import com.intellij.ide.util.frameworkSupport.FrameworkSupportModel; +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.roots.ModifiableRootModel; + +import java.util.List; + +/** + * @author nik + */ +public abstract class FrameworkSupportCommunicator { + public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.frameworkSupportCommunicator"); + + public abstract void onFrameworkSupportAdded(Module module, ModifiableRootModel rootModel, + List selectedFrameworks, + FrameworkSupportModel model); +} diff --git a/platform/lang-api/src/com/intellij/facet/ui/FacetBasedFrameworkSupportProvider.java b/platform/lang-api/src/com/intellij/facet/ui/FacetBasedFrameworkSupportProvider.java index 4ec8dfba6a4c..7dfe46c0be6f 100644 --- a/platform/lang-api/src/com/intellij/facet/ui/FacetBasedFrameworkSupportProvider.java +++ b/platform/lang-api/src/com/intellij/facet/ui/FacetBasedFrameworkSupportProvider.java @@ -44,7 +44,7 @@ public abstract class FacetBasedFrameworkSupportProvider extend myFacetType = facetType; } - protected static String getProviderId(final FacetType facetType) { + public static String getProviderId(final FacetType facetType) { return FACET_SUPPORT_PREFIX + facetType.getStringId(); } diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index c31ebac04b20..4bc4847c9a9c 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -117,6 +117,7 @@ interface="com.intellij.codeInsight.generation.surroundWith.JavaExpressionSurrounder"/> +