use of com.intellij.ide.util.frameworkSupport.FrameworkSupportProvider in project intellij-community by JetBrains.
the class FrameworkSupportModelBase method onFrameworkSelectionChanged.
public void onFrameworkSelectionChanged(FrameworkSupportNode node) {
final FrameworkSupportInModuleProvider provider = node.getUserObject();
//todo[nik]
boolean checked = node.isChecked();
if (provider instanceof OldFrameworkSupportProviderWrapper) {
final FrameworkSupportProvider oldProvider = ((OldFrameworkSupportProviderWrapper) provider).getProvider();
selectFramework(oldProvider, checked);
}
for (FrameworkSupportInModuleProvider.FrameworkDependency dependency : provider.getDependenciesFrameworkIds()) {
if (!dependency.isOptional()) {
String id = dependency.getFrameworkId();
setFrameworkComponentEnabled(id, true);
}
}
}
use of com.intellij.ide.util.frameworkSupport.FrameworkSupportProvider in project intellij-community by JetBrains.
the class AddSupportForFrameworksPanel method addSupport.
public void addSupport(@NotNull final Module module, @NotNull final ModifiableRootModel rootModel) {
List<Library> addedLibraries = new ArrayList<>();
List<FrameworkSupportNode> selectedFrameworks = getSelectedNodes();
sortFrameworks(selectedFrameworks);
List<FrameworkSupportConfigurable> selectedConfigurables = new ArrayList<>();
final IdeaModifiableModelsProvider modifiableModelsProvider = new IdeaModifiableModelsProvider();
for (FrameworkSupportNode node : selectedFrameworks) {
FrameworkSupportInModuleConfigurable configurable = node.getConfigurable();
if (configurable instanceof OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) {
selectedConfigurables.add(((OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) configurable).getConfigurable());
}
final LibraryCompositionSettings settings = getLibraryCompositionSettings(node);
Library library = settings != null ? settings.addLibraries(rootModel, addedLibraries, myLibrariesContainer) : null;
if (configurable instanceof OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) {
((OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) configurable).getConfigurable().addSupport(module, rootModel, library);
} else {
configurable.addSupport(module, rootModel, modifiableModelsProvider);
}
}
for (FrameworkSupportNode node : selectedFrameworks) {
FrameworkSupportInModuleProvider provider = node.getUserObject();
if (provider instanceof OldFrameworkSupportProviderWrapper) {
final FrameworkSupportProvider oldProvider = ((OldFrameworkSupportProviderWrapper) provider).getProvider();
if (oldProvider instanceof FacetBasedFrameworkSupportProvider && !addedLibraries.isEmpty()) {
((FacetBasedFrameworkSupportProvider) oldProvider).processAddedLibraries(module, addedLibraries);
}
}
}
for (FrameworkSupportCommunicator communicator : FrameworkSupportCommunicator.EP_NAME.getExtensions()) {
communicator.onFrameworkSupportAdded(module, rootModel, selectedConfigurables, myModel);
}
}
Aggregations