Search in sources :

Example 61 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by JetBrains.

the class FlexProjectConfigurationEditor method commit.

public void commit() throws ConfigurationException {
    final Map<Pair<String, String>, String> renamedConfigs = new HashMap<>();
    for (Module module : myModule2Editors.keySet()) {
        ModifiableRootModel modifiableModel = myProvider.getModuleModifiableModel(module);
        Collection<String> usedModulesLibrariesIds = new ArrayList<>();
        // ---------------- SDK and shared libraries entries ----------------------
        // Library -> add_library_entry_flag
        Map<Library, Boolean> librariesToAdd = new LinkedHashMap<>();
        final Collection<String> sdkNames = new HashSet<>();
        for (Editor editor : myModule2Editors.get(module)) {
            final SdkEntry sdkEntry = editor.getDependencies().getSdkEntry();
            if (sdkEntry != null) {
                sdkNames.add(sdkEntry.getName());
            }
            for (DependencyEntry dependencyEntry : editor.getDependencies().getEntries()) {
                if (dependencyEntry instanceof ModuleLibraryEntry) {
                    ModuleLibraryEntry moduleLibraryEntry = (ModuleLibraryEntry) dependencyEntry;
                    usedModulesLibrariesIds.add(moduleLibraryEntry.getLibraryId());
                }
                if (dependencyEntry instanceof SharedLibraryEntry) {
                    SharedLibraryEntry sharedLibraryEntry = (SharedLibraryEntry) dependencyEntry;
                    Library library = myProvider.findSourceLibraryForLiveName(sharedLibraryEntry.getLibraryName(), sharedLibraryEntry.getLibraryLevel());
                    if (library != null) {
                        librariesToAdd.put(library, true);
                    }
                }
            }
            String originalName = editor.getOriginalName();
            if (originalName != null && !originalName.equals(editor.getName())) {
                renamedConfigs.put(Pair.create(module.getName(), originalName), editor.getName());
            }
        }
        final Sdk sdk;
        if (sdkNames.isEmpty()) {
            sdk = null;
        } else if (sdkNames.size() == 1) {
            sdk = FlexSdkUtils.findFlexOrFlexmojosSdk(sdkNames.iterator().next());
        } else {
            sdk = new FlexCompositeSdk(ArrayUtil.toStringArray(sdkNames));
        }
        modifiableModel.setSdk(sdk);
        Collection<OrderEntry> entriesToRemove = new ArrayList<>();
        for (OrderEntry orderEntry : modifiableModel.getOrderEntries()) {
            if (orderEntry instanceof LibraryOrderEntry) {
                if (((LibraryOrderEntry) orderEntry).isModuleLevel()) {
                    LibraryEx library = (LibraryEx) ((LibraryOrderEntry) orderEntry).getLibrary();
                    if (FlexProjectRootsUtil.isFlexLibrary(library) && !usedModulesLibrariesIds.contains(FlexProjectRootsUtil.getLibraryId(library))) {
                        entriesToRemove.add(orderEntry);
                    }
                } else {
                    LibraryEx library = (LibraryEx) ((LibraryOrderEntry) orderEntry).getLibrary();
                    if (librariesToAdd.containsKey(library)) {
                        // entry already exists for this library
                        librariesToAdd.put(library, false);
                    } else if (library != null && FlexProjectRootsUtil.isFlexLibrary(library)) {
                        entriesToRemove.add(orderEntry);
                    }
                }
            }
        }
        for (OrderEntry e : entriesToRemove) {
            modifiableModel.removeOrderEntry(e);
        }
        for (Library library : librariesToAdd.keySet()) {
            if (!((LibraryEx) library).isDisposed() && librariesToAdd.get(library) && myProvider.findSourceLibrary(library.getName(), library.getTable().getTableLevel()) != null) {
                modifiableModel.addLibraryEntry(library);
            }
        }
        // ---------------- modules entries ----------------------
        final Set<Module> modulesToAdd = new THashSet<>();
        for (Editor editor : myModule2Editors.get(module)) {
            for (DependencyEntry dependencyEntry : editor.getDependencies().getEntries()) {
                if (dependencyEntry instanceof BuildConfigurationEntry) {
                    final Module dependencyModule = findModuleWithBC((BuildConfigurationEntry) dependencyEntry);
                    if (dependencyModule != null && dependencyModule != module) {
                        modulesToAdd.add(dependencyModule);
                    }
                }
            }
        }
        List<OrderEntry> moduleOrderEntriesToRemove = ContainerUtil.filter(modifiableModel.getOrderEntries(), orderEntry -> orderEntry instanceof ModuleOrderEntry && !modulesToAdd.remove(((ModuleOrderEntry) orderEntry).getModule()));
        for (OrderEntry orderEntry : moduleOrderEntriesToRemove) {
            modifiableModel.removeOrderEntry(orderEntry);
        }
        for (Module moduleToAdd : modulesToAdd) {
            modifiableModel.addModuleOrderEntry(moduleToAdd);
        }
        for (OrderEntry entry : modifiableModel.getOrderEntries()) {
            if (entry instanceof ExportableOrderEntry) {
                // transitiveness will be filtered out in FlexOrderEnumeratorHandler if needed
                ((ExportableOrderEntry) entry).setExported(true);
            }
        }
    }
    // ---------------- do commit ----------------------
    Collection<Module> modulesWithChangedModifiableModel = ContainerUtil.findAll(myModule2Editors.keySet(), module -> myProvider.getModuleModifiableModel(module).isChanged());
    if (!modulesWithChangedModifiableModel.isEmpty()) {
        myProvider.commitModifiableModels();
        myModulesModelChangeEventDispatcher.getMulticaster().modulesModelsChanged(modulesWithChangedModifiableModel);
    }
    ApplicationManager.getApplication().runWriteAction(() -> {
        for (Module module : myModule2Editors.keySet()) {
            Function<Editor, FlexBuildConfigurationImpl> f = editor -> editor.commit();
            FlexBuildConfigurationImpl[] current = ContainerUtil.map2Array(myModule2Editors.get(module), FlexBuildConfigurationImpl.class, f);
            ((FlexBuildConfigurationManagerImpl) FlexBuildConfigurationManager.getInstance(module)).setBuildConfigurations(current);
        }
        if (myProject != null) {
            FlexBuildConfigurationManagerImpl.resetHighlighting(myProject);
            if (!renamedConfigs.isEmpty()) {
                myProject.getMessageBus().syncPublisher(FlexBuildConfigurationChangeListener.TOPIC).buildConfigurationsRenamed(renamedConfigs);
            }
        }
    });
}
Also used : FlexCompositeSdk(com.intellij.lang.javascript.flex.projectStructure.FlexCompositeSdk) java.util(java.util) OutputType(com.intellij.flex.model.bc.OutputType) ArrayUtil(com.intellij.util.ArrayUtil) EventDispatcher(com.intellij.util.EventDispatcher) FlexModuleType(com.intellij.lang.javascript.flex.FlexModuleType) HashMap(com.intellij.util.containers.HashMap) THashSet(gnu.trove.THashSet) ContainerUtil(com.intellij.util.containers.ContainerUtil) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) FlexCommonUtils(com.intellij.flex.FlexCommonUtils) com.intellij.openapi.roots(com.intellij.openapi.roots) Library(com.intellij.openapi.roots.libraries.Library) BCUtils(com.intellij.lang.javascript.flex.projectStructure.options.BCUtils) FlexBCConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable) Project(com.intellij.openapi.project.Project) ModuleType(com.intellij.openapi.module.ModuleType) ChangeListener(javax.swing.event.ChangeListener) FlexSdkUtils(com.intellij.lang.javascript.flex.sdk.FlexSdkUtils) Logger(com.intellij.openapi.diagnostic.Logger) Module(com.intellij.openapi.module.Module) FlexLibraryType(com.intellij.lang.javascript.flex.library.FlexLibraryType) FlexBuildConfigurationsExtension(com.intellij.lang.javascript.flex.projectStructure.FlexBuildConfigurationsExtension) LibraryEx(com.intellij.openapi.roots.impl.libraries.LibraryEx) FlexBCConfigurator(com.intellij.lang.javascript.flex.projectStructure.FlexBCConfigurator) LibraryTablesRegistrar(com.intellij.openapi.roots.libraries.LibraryTablesRegistrar) com.intellij.lang.javascript.flex.projectStructure.model(com.intellij.lang.javascript.flex.projectStructure.model) Disposable(com.intellij.openapi.Disposable) Sdk(com.intellij.openapi.projectRoots.Sdk) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlexProjectRootsUtil(com.intellij.lang.javascript.flex.projectStructure.options.FlexProjectRootsUtil) Nullable(org.jetbrains.annotations.Nullable) LibraryEditingUtil(com.intellij.openapi.roots.ui.configuration.libraries.LibraryEditingUtil) Function(com.intellij.util.Function) LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) Pair(com.intellij.openapi.util.Pair) ApplicationManager(com.intellij.openapi.application.ApplicationManager) ConfigurationException(com.intellij.openapi.options.ConfigurationException) NotNull(org.jetbrains.annotations.NotNull) FlexLibraryProperties(com.intellij.lang.javascript.flex.library.FlexLibraryProperties) Consumer(com.intellij.util.Consumer) HashMap(com.intellij.util.containers.HashMap) LibraryEx(com.intellij.openapi.roots.impl.libraries.LibraryEx) FlexCompositeSdk(com.intellij.lang.javascript.flex.projectStructure.FlexCompositeSdk) Sdk(com.intellij.openapi.projectRoots.Sdk) Pair(com.intellij.openapi.util.Pair) THashSet(gnu.trove.THashSet) FlexCompositeSdk(com.intellij.lang.javascript.flex.projectStructure.FlexCompositeSdk) THashSet(gnu.trove.THashSet) Library(com.intellij.openapi.roots.libraries.Library) Module(com.intellij.openapi.module.Module)

Example 62 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by JetBrains.

the class FlexBuildTargetScopeProvider method getBuildTargetScopes.

@NotNull
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull final CompileScope baseScope, @NotNull final CompilerFilter filter, @NotNull final Project project, boolean forceBuild) {
    final RunConfiguration runConfiguration = CompileStepBeforeRun.getRunConfiguration(baseScope);
    final Collection<Pair<Module, FlexBuildConfiguration>> bcsToCompileForPackaging = FlexResourceBuildTargetScopeProvider.getBCsToCompileForPackaging(baseScope);
    List<String> targetIds = new ArrayList<>();
    try {
        for (Pair<Module, FlexBuildConfiguration> moduleAndBC : getModulesAndBCsToCompile(baseScope)) {
            final Module module = moduleAndBC.first;
            final FlexBuildConfiguration bc = moduleAndBC.second;
            if (bcsToCompileForPackaging != null && contains(bcsToCompileForPackaging, module, bc)) {
                final boolean forcedDebugStatus = getForcedDebugStatus(project, bc);
                targetIds.add(FlexCommonUtils.getBuildTargetId(module.getName(), bc.getName(), forcedDebugStatus));
            } else if (bc.isTempBCForCompilation()) {
                LOG.assertTrue(runConfiguration instanceof FlashRunConfiguration || runConfiguration instanceof FlexUnitRunConfiguration, bc.getName());
                final BCBasedRunnerParameters params = runConfiguration instanceof FlashRunConfiguration ? ((FlashRunConfiguration) runConfiguration).getRunnerParameters() : ((FlexUnitRunConfiguration) runConfiguration).getRunnerParameters();
                LOG.assertTrue(params.getModuleName().equals(module.getName()), "Module name in run config: " + params.getModuleName() + ", expected: " + module.getName());
                LOG.assertTrue(params.getBCName().equals(bc.getName()), "BC name in run config: " + params.getBCName() + ", expected: " + bc.getName());
                targetIds.add(FlexCommonUtils.getBuildTargetIdForRunConfig(runConfiguration.getType().getId(), runConfiguration.getName()));
            } else {
                targetIds.add(FlexCommonUtils.getBuildTargetId(module.getName(), bc.getName(), null));
            }
        }
    } catch (ConfigurationException e) {
        // can't happen because checked in ValidateFlashConfigurationsPrecompileTask
        LOG.error(e);
    }
    if (targetIds.isEmpty()) {
        return Collections.emptyList();
    }
    return Collections.singletonList(CmdlineProtoUtil.createTargetsScope(FlexBuildTargetType.INSTANCE.getTypeId(), targetIds, forceBuild));
}
Also used : BCBasedRunnerParameters(com.intellij.lang.javascript.flex.run.BCBasedRunnerParameters) FlexUnitRunConfiguration(com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) FlexUnitRunConfiguration(com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) ConfigurationException(com.intellij.openapi.options.ConfigurationException) Module(com.intellij.openapi.module.Module) Pair(com.intellij.openapi.util.Pair) NotNull(org.jetbrains.annotations.NotNull)

Example 63 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-plugins by JetBrains.

the class FlexBuildTargetScopeProvider method getModulesAndBCsToCompile.

static Collection<Pair<Module, FlexBuildConfiguration>> getModulesAndBCsToCompile(final CompileScope scope) throws ConfigurationException {
    final Collection<Pair<Module, FlexBuildConfiguration>> result = new HashSet<>();
    final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCsToCompile = FlexResourceBuildTargetScopeProvider.getBCsToCompileForPackaging(scope);
    final RunConfiguration runConfiguration = CompileStepBeforeRun.getRunConfiguration(scope);
    if (modulesAndBCsToCompile != null) {
        for (Pair<Module, FlexBuildConfiguration> moduleAndBC : modulesAndBCsToCompile) {
            if (!moduleAndBC.second.isSkipCompile()) {
                final FlexBuildConfiguration bcWithForcedDebugStatus = forceDebugStatus(moduleAndBC.first.getProject(), moduleAndBC.second);
                result.add(Pair.create(moduleAndBC.first, bcWithForcedDebugStatus));
                appendBCDependencies(result, moduleAndBC.first, moduleAndBC.second);
            }
        }
    } else if (runConfiguration instanceof FlashRunConfiguration || runConfiguration instanceof FlexUnitRunConfiguration) {
        final BCBasedRunnerParameters params = runConfiguration instanceof FlashRunConfiguration ? ((FlashRunConfiguration) runConfiguration).getRunnerParameters() : ((FlexUnitRunConfiguration) runConfiguration).getRunnerParameters();
        final Pair<Module, FlexBuildConfiguration> moduleAndBC;
        final Ref<RuntimeConfigurationError> exceptionRef = new Ref<>();
        moduleAndBC = ApplicationManager.getApplication().runReadAction((NullableComputable<Pair<Module, FlexBuildConfiguration>>) () -> {
            try {
                return params.checkAndGetModuleAndBC(runConfiguration.getProject());
            } catch (RuntimeConfigurationError e) {
                exceptionRef.set(e);
                return null;
            }
        });
        if (!exceptionRef.isNull()) {
            throw new ConfigurationException(exceptionRef.get().getMessage(), FlexBundle.message("run.configuration.0", runConfiguration.getName()));
        }
        if (!moduleAndBC.second.isSkipCompile()) {
            result.add(moduleAndBC);
            appendBCDependencies(result, moduleAndBC.first, moduleAndBC.second);
        }
    } else {
        for (final Module module : scope.getAffectedModules()) {
            if (module.isDisposed() || ModuleType.get(module) != FlexModuleType.getInstance())
                continue;
            for (final FlexBuildConfiguration bc : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
                if (!bc.isSkipCompile()) {
                    result.add(Pair.create(module, bc));
                }
            }
        }
    }
    return result;
}
Also used : BCBasedRunnerParameters(com.intellij.lang.javascript.flex.run.BCBasedRunnerParameters) FlexUnitRunConfiguration(com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Ref(com.intellij.openapi.util.Ref) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) FlexUnitRunConfiguration(com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) ConfigurationException(com.intellij.openapi.options.ConfigurationException) Module(com.intellij.openapi.module.Module) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) Pair(com.intellij.openapi.util.Pair)

Example 64 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project android by JetBrains.

the class SdkUpdaterConfigurable method apply.

@Override
public void apply() throws ConfigurationException {
    myPanel.saveSources();
    HtmlBuilder message = new HtmlBuilder();
    message.openHtmlBody();
    final List<LocalPackage> toDelete = Lists.newArrayList();
    final Map<RemotePackage, UpdatablePackage> requestedPackages = Maps.newHashMap();
    for (PackageNodeModel model : myPanel.getStates()) {
        if (model.getState() == PackageNodeModel.SelectedState.NOT_INSTALLED) {
            if (model.getPkg().hasLocal()) {
                toDelete.add(model.getPkg().getLocal());
            }
        } else if (model.getState() == PackageNodeModel.SelectedState.INSTALLED && (model.getPkg().isUpdate() || !model.getPkg().hasLocal())) {
            UpdatablePackage pkg = model.getPkg();
            requestedPackages.put(pkg.getRemote(), pkg);
        }
    }
    boolean found = false;
    if (!toDelete.isEmpty()) {
        found = true;
        message.add("The following components will be deleted: \n");
        message.beginList();
        for (LocalPackage item : toDelete) {
            message.listItem().add(item.getDisplayName()).add(", Revision: ").add(item.getVersion().toString());
        }
        message.endList();
    }
    if (!requestedPackages.isEmpty()) {
        found = true;
        message.add("The following components will be installed: \n");
        message.beginList();
        Multimap<RemotePackage, RemotePackage> dependencies = HashMultimap.create();
        ProgressIndicator progress = new StudioLoggerProgressIndicator(getClass());
        RepositoryPackages packages = getRepoManager().getPackages();
        for (RemotePackage item : requestedPackages.keySet()) {
            List<RemotePackage> packageDependencies = InstallerUtil.computeRequiredPackages(ImmutableList.of(item), packages, progress);
            if (packageDependencies == null) {
                Messages.showErrorDialog((Project) null, "Unable to resolve dependencies for " + item.getDisplayName(), "Dependency Error");
                throw new ConfigurationException("Unable to resolve dependencies.");
            }
            for (RemotePackage dependency : packageDependencies) {
                dependencies.put(dependency, item);
            }
            message.listItem().add(String.format("%1$s %2$s %3$s", item.getDisplayName(), item.getTypeDetails() instanceof DetailsTypes.ApiDetailsType ? "revision" : "version", item.getVersion()));
        }
        for (RemotePackage dependency : dependencies.keySet()) {
            if (requestedPackages.containsKey(dependency)) {
                continue;
            }
            Set<RemotePackage> requests = Sets.newHashSet(dependencies.get(dependency));
            requests.remove(dependency);
            if (!requests.isEmpty()) {
                message.listItem().add(dependency.getDisplayName()).add(" (Required by ");
                Iterator<RemotePackage> requestIterator = requests.iterator();
                message.add(requestIterator.next().getDisplayName());
                while (requestIterator.hasNext()) {
                    message.add(", ").add(requestIterator.next().getDisplayName());
                }
                message.add(")");
            }
        }
        message.endList();
    }
    message.closeHtmlBody();
    if (found) {
        if (confirmChange(message)) {
            if (!requestedPackages.isEmpty() || !toDelete.isEmpty()) {
                ModelWizardDialog dialog = SdkQuickfixUtils.createDialogForPackages(myPanel.getComponent(), requestedPackages.values(), toDelete, true);
                if (dialog != null) {
                    dialog.show();
                    for (RemotePackage remotePackage : requestedPackages.keySet()) {
                        PackageOperation installer = getRepoManager().getInProgressInstallOperation(remotePackage);
                        if (installer != null) {
                            PackageOperation.StatusChangeListener listener = (installer1, progress) -> myPanel.getComponent().repaint();
                            myListeners.add(listener);
                            installer.registerStateChangeListener(listener);
                        }
                    }
                }
            }
            myPanel.refresh();
        } else {
            throw new ConfigurationException("Installation was canceled.");
        }
    } else {
        // We didn't have any changes, so just reload (maybe the channel changed).
        myChannelChangedCallback.run();
    }
}
Also used : Settings(com.intellij.openapi.options.ex.Settings) AllIcons(com.intellij.icons.AllIcons) DataContext(com.intellij.openapi.actionSystem.DataContext) com.android.repository.api(com.android.repository.api) RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) Nls(org.jetbrains.annotations.Nls) StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) Map(java.util.Map) Disposer(com.intellij.openapi.util.Disposer) Project(com.intellij.openapi.project.Project) Messages(com.intellij.openapi.ui.Messages) Objects(com.google.common.base.Objects) com.google.common.collect(com.google.common.collect) DataManager(com.intellij.ide.DataManager) AncestorEvent(javax.swing.event.AncestorEvent) DetailsTypes(com.android.sdklib.repository.meta.DetailsTypes) Iterator(java.util.Iterator) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler) StudioHelpManagerImpl(com.android.tools.idea.help.StudioHelpManagerImpl) HtmlBuilder(com.android.utils.HtmlBuilder) Set(java.util.Set) Configurable(com.intellij.openapi.options.Configurable) InstallerUtil(com.android.repository.util.InstallerUtil) StudioDownloader(com.android.tools.idea.sdk.StudioDownloader) ModelWizardDialog(com.android.tools.idea.wizard.model.ModelWizardDialog) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) StudioSettingsController(com.android.tools.idea.sdk.StudioSettingsController) AncestorListenerAdapter(com.intellij.ui.AncestorListenerAdapter) SdkQuickfixUtils(com.android.tools.idea.sdk.wizard.SdkQuickfixUtils) ConfigurationException(com.intellij.openapi.options.ConfigurationException) NotNull(org.jetbrains.annotations.NotNull) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) javax.swing(javax.swing) DetailsTypes(com.android.sdklib.repository.meta.DetailsTypes) HtmlBuilder(com.android.utils.HtmlBuilder) StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) ConfigurationException(com.intellij.openapi.options.ConfigurationException) StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) ModelWizardDialog(com.android.tools.idea.wizard.model.ModelWizardDialog)

Example 65 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class SettingsEditor method updateStatus.

void updateStatus(Configurable configurable) {
    myFilter.updateSpotlight(configurable == null);
    if (myBanner != null) {
        myBanner.setProject(myTreeView.findConfigurableProject(configurable));
        myBanner.setText(myTreeView.getPathNames(configurable));
    }
    if (myEditor != null) {
        ConfigurationException exception = myFilter.myContext.getErrors().get(configurable);
        myEditor.getApplyAction().setEnabled(!myFilter.myContext.getModified().isEmpty());
        myEditor.getResetAction().setEnabled(myFilter.myContext.isModified(configurable) || exception != null);
        myEditor.setError(exception);
        myEditor.revalidate();
    }
    if (configurable != null) {
        new Alarm().addRequest(() -> {
            if (!myDisposed && mySpotlightPainter != null) {
                mySpotlightPainter.updateNow();
            }
        }, 300);
    }
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) Alarm(com.intellij.util.Alarm)

Aggregations

ConfigurationException (com.intellij.openapi.options.ConfigurationException)102 File (java.io.File)25 VirtualFile (com.intellij.openapi.vfs.VirtualFile)24 Project (com.intellij.openapi.project.Project)22 Module (com.intellij.openapi.module.Module)18 IOException (java.io.IOException)14 NotNull (org.jetbrains.annotations.NotNull)11 Nullable (org.jetbrains.annotations.Nullable)8 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)7 Sdk (com.intellij.openapi.projectRoots.Sdk)7 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)6 Disposable (com.intellij.openapi.Disposable)4 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)4 Pair (com.intellij.openapi.util.Pair)4 GradleProjectImporter (com.android.tools.idea.gradle.project.importing.GradleProjectImporter)3 ExecutionException (com.intellij.execution.ExecutionException)3 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)3 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)3 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)3