Search in sources :

Example 1 with FrameworkSupportNode

use of com.intellij.ide.util.newProjectWizard.FrameworkSupportNode in project intellij-community by JetBrains.

the class FrameworkSupportModelBase method setSelectedVersion.

public void setSelectedVersion(@NotNull String frameworkOrGroupId, @NotNull FrameworkVersion version) {
    FrameworkVersion oldVersion = mySelectedVersions.put(frameworkOrGroupId, version);
    if (!Comparing.equal(oldVersion, version)) {
        for (Map.Entry<String, FrameworkSupportNode> entry : mySettingsMap.entrySet()) {
            if (hasParentWithId(entry.getValue(), frameworkOrGroupId)) {
                if (!entry.getValue().getId().equals(frameworkOrGroupId)) {
                    FrameworkSupportOptionsComponent component = myOptionsComponentsMap.get(entry.getKey());
                    if (component != null) {
                        component.updateVersionsComponent();
                    }
                }
                updateFrameworkLibraryComponent(entry.getKey());
            }
        }
    }
    myVersionEventDispatcher.getMulticaster().versionChanged(version);
}
Also used : FrameworkSupportNode(com.intellij.ide.util.newProjectWizard.FrameworkSupportNode) FrameworkVersion(com.intellij.framework.FrameworkVersion) FrameworkSupportOptionsComponent(com.intellij.ide.util.newProjectWizard.FrameworkSupportOptionsComponent) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with FrameworkSupportNode

use of com.intellij.ide.util.newProjectWizard.FrameworkSupportNode in project intellij-community by JetBrains.

the class FrameworkSupportModelBase method setFrameworkComponentEnabled.

public void setFrameworkComponentEnabled(@NotNull @NonNls final String providerId, final boolean enable) {
    final FrameworkSupportNode node = mySettingsMap.get(providerId);
    if (node != null && enable != node.isChecked()) {
        node.setChecked(enable);
        // ensure configurable to be created and registered to disposer
        node.getConfigurable();
        if (myFrameworkVersions.get(providerId) == null) {
            for (FrameworkVersion version : node.getUserObject().getFrameworkType().getVersions()) {
                if (version.getAvailabilityCondition().isAvailableFor(this)) {
                    setSelectedVersion(providerId, version);
                }
            }
        }
    }
}
Also used : FrameworkSupportNode(com.intellij.ide.util.newProjectWizard.FrameworkSupportNode) FrameworkVersion(com.intellij.framework.FrameworkVersion)

Example 3 with FrameworkSupportNode

use of com.intellij.ide.util.newProjectWizard.FrameworkSupportNode in project intellij-community by JetBrains.

the class FrameworkSupportProviderTestCase method addSupport.

protected void addSupport() {
    new WriteCommandAction.Simple(getProject()) {

        @Override
        protected void run() throws Throwable {
            final VirtualFile root = getVirtualFile(createTempDir("contentRoot"));
            PsiTestUtil.addContentRoot(myModule, root);
            final ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
            try {
                List<FrameworkSupportConfigurable> selectedConfigurables = new ArrayList<>();
                final IdeaModifiableModelsProvider modelsProvider = new IdeaModifiableModelsProvider();
                for (FrameworkSupportNode node : myNodes.values()) {
                    if (node.isChecked()) {
                        final FrameworkSupportInModuleConfigurable configurable = getOrCreateConfigurable(node.getUserObject());
                        configurable.addSupport(myModule, model, modelsProvider);
                        if (configurable instanceof OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) {
                            selectedConfigurables.add(((OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) configurable).getConfigurable());
                        }
                    }
                }
                for (FrameworkSupportCommunicator communicator : FrameworkSupportCommunicator.EP_NAME.getExtensions()) {
                    communicator.onFrameworkSupportAdded(myModule, model, selectedConfigurables, myFrameworkSupportModel);
                }
            } finally {
                model.commit();
            }
            for (FrameworkSupportInModuleConfigurable configurable : myConfigurables.values()) {
                Disposer.dispose(configurable);
            }
        }
    }.execute().throwException();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) IdeaModifiableModelsProvider(com.intellij.openapi.roots.IdeaModifiableModelsProvider) FrameworkSupportNode(com.intellij.ide.util.newProjectWizard.FrameworkSupportNode) OldFrameworkSupportProviderWrapper(com.intellij.ide.util.newProjectWizard.OldFrameworkSupportProviderWrapper) FrameworkSupportInModuleConfigurable(com.intellij.framework.addSupport.FrameworkSupportInModuleConfigurable) FrameworkSupportCommunicator(com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportCommunicator)

Example 4 with FrameworkSupportNode

use of com.intellij.ide.util.newProjectWizard.FrameworkSupportNode in project intellij-community by JetBrains.

the class FrameworkSupportProviderTestCase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    final Project project = getProject();
    myFrameworkSupportModel = new FrameworkSupportModelImpl(project, "", LibrariesContainerFactory.createContainer(project));
    myNodes = new LinkedHashMap<>();
    final List<FrameworkSupportInModuleProvider> providers = FrameworkSupportUtil.getAllProviders();
    Collections.sort(providers, FrameworkSupportUtil.getFrameworkSupportProvidersComparator(providers));
    for (FrameworkSupportInModuleProvider provider : providers) {
        final FrameworkSupportNode node = new FrameworkSupportNode(provider, null, myFrameworkSupportModel, getTestRootDisposable());
        myNodes.put(provider.getFrameworkType(), node);
        myFrameworkSupportModel.registerComponent(provider, node);
    }
    myConfigurables = new HashMap<>();
}
Also used : Project(com.intellij.openapi.project.Project) FrameworkSupportNode(com.intellij.ide.util.newProjectWizard.FrameworkSupportNode) FrameworkSupportInModuleProvider(com.intellij.framework.addSupport.FrameworkSupportInModuleProvider)

Aggregations

FrameworkSupportNode (com.intellij.ide.util.newProjectWizard.FrameworkSupportNode)4 FrameworkVersion (com.intellij.framework.FrameworkVersion)2 FrameworkSupportInModuleConfigurable (com.intellij.framework.addSupport.FrameworkSupportInModuleConfigurable)1 FrameworkSupportInModuleProvider (com.intellij.framework.addSupport.FrameworkSupportInModuleProvider)1 FrameworkSupportOptionsComponent (com.intellij.ide.util.newProjectWizard.FrameworkSupportOptionsComponent)1 OldFrameworkSupportProviderWrapper (com.intellij.ide.util.newProjectWizard.OldFrameworkSupportProviderWrapper)1 FrameworkSupportCommunicator (com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportCommunicator)1 Project (com.intellij.openapi.project.Project)1 IdeaModifiableModelsProvider (com.intellij.openapi.roots.IdeaModifiableModelsProvider)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1