Search in sources :

Example 36 with BuildConfigurationNature

use of com.intellij.flex.model.bc.BuildConfigurationNature in project intellij-plugins by JetBrains.

the class AppTestBase method doSetupFlexSdk.

private void doSetupFlexSdk(final Module module, final String flexSdkRootPath, final TargetPlatform targetPlatform, final String sdkVersion) {
    final String sdkName = generateSdkName(sdkVersion);
    Sdk sdk = ProjectJdkTable.getInstance().findJdk(sdkName);
    if (sdk == null) {
        ApplicationManager.getApplication().runWriteAction(() -> {
            FlexSdkType2 sdkType = FlexSdkType2.getInstance();
            Sdk sdk1 = new ProjectJdkImpl(sdkName, sdkType, flexSdkRootPath, "");
            ProjectJdkTable.getInstance().addJdk(sdk1);
            Disposer.register(getSdkParentDisposable(), new Disposable() {

                @Override
                public void dispose() {
                    ApplicationManager.getApplication().runWriteAction(() -> {
                        ProjectJdkTable sdkTable = ProjectJdkTable.getInstance();
                        sdkTable.removeJdk(sdkTable.findJdk(sdkName));
                    });
                }
            });
            final SdkModificator modificator = sdk1.getSdkModificator();
            modificator.setVersionString(FlexSdkType2.getInstance().getVersionString(sdk1.getHomePath()));
            modifySdk(sdk1, modificator);
            modificator.commitChanges();
        });
    }
    FlexTestUtils.modifyBuildConfiguration(module, bc -> {
        bc.setNature(new BuildConfigurationNature(targetPlatform, false, getOutputType()));
        bc.getDependencies().setSdkEntry(Factory.createSdkEntry(sdkName));
    });
}
Also used : Disposable(com.intellij.openapi.Disposable) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) ProjectJdkTable(com.intellij.openapi.projectRoots.ProjectJdkTable) ProjectJdkImpl(com.intellij.openapi.projectRoots.impl.ProjectJdkImpl) Sdk(com.intellij.openapi.projectRoots.Sdk) FlexSdkType2(com.intellij.lang.javascript.flex.sdk.FlexSdkType2) SdkModificator(com.intellij.openapi.projectRoots.SdkModificator)

Aggregations

BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)36 Module (com.intellij.openapi.module.Module)11 Sdk (com.intellij.openapi.projectRoots.Sdk)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)5 TargetPlatform (com.intellij.flex.model.bc.TargetPlatform)4 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)4 NotNull (org.jetbrains.annotations.NotNull)4 OutputType (com.intellij.flex.model.bc.OutputType)3 FlexModuleType (com.intellij.lang.javascript.flex.FlexModuleType)3 WriteAction (com.intellij.openapi.application.WriteAction)3 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)3 FlexTestUtils (com.intellij.flex.util.FlexTestUtils)2 FlexStylesIndexableSetContributor (com.intellij.javascript.flex.css.FlexStylesIndexableSetContributor)2 FlexSchemaHandler (com.intellij.javascript.flex.mxml.schema.FlexSchemaHandler)2 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)2 ModuleType (com.intellij.openapi.module.ModuleType)2 Project (com.intellij.openapi.project.Project)2 SdkModificator (com.intellij.openapi.projectRoots.SdkModificator)2 ValidationInfo (com.intellij.openapi.ui.ValidationInfo)2