public void addSupport( final @NotNull Module module, final @NotNull ModifiableRootModel rootModel) { List<Library> addedLibraries = new ArrayList<Library>(); List<FrameworkSupportNode> selectedFrameworks = getSelectedNodes(); sortFrameworks(selectedFrameworks); List<FrameworkSupportConfigurable> selectedConfigurables = new ArrayList<FrameworkSupportConfigurable>(); 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); } }
private void updateOptionsPanel() { final FrameworkSupportNodeBase node = getSelectedNode(); if (node instanceof FrameworkSupportNode) { FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode) node; initializeOptionsPanel(frameworkSupportNode, true); showCard(frameworkSupportNode.getId()); UIUtil.setEnabled(myOptionsPanel, frameworkSupportNode.isChecked(), true); frameworkSupportNode.getConfigurable().onFrameworkSelectionChanged(node.isChecked()); } else if (node instanceof FrameworkGroupNode) { FrameworkGroup<?> group = ((FrameworkGroupNode) node).getUserObject(); initializeGroupPanel(group, true); showCard(group.getId()); UIUtil.setEnabled(myOptionsPanel, true, true); } else { showCard(EMPTY_CARD); } }
private FrameworkSupportOptionsComponent initializeOptionsPanel( final FrameworkSupportNode node, boolean addToOptions) { FrameworkSupportOptionsComponent component = myInitializedOptionsComponents.get(node); if (component == null) { final FrameworkSupportNodeBase parentNode = node.getParentNode(); if (parentNode instanceof FrameworkSupportNode) { initializeOptionsPanel((FrameworkSupportNode) parentNode, addToOptions); } else if (parentNode instanceof FrameworkGroupNode) { initializeGroupPanel(((FrameworkGroupNode) parentNode).getUserObject(), addToOptions); } component = new FrameworkSupportOptionsComponent( myModel, myLibrariesContainer, this, node.getUserObject(), node.getConfigurable()); if (addToOptions) { myOptionsPanel.add(node.getId(), wrapInScrollPane(component.getMainPanel())); } myInitializedOptionsComponents.put(node, component); } return component; }