Search in sources :

Example 16 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class ActionScriptHighlightingTest method testCorrectScopeForSuperclassCheck2.

public void testCorrectScopeForSuperclassCheck2() throws Exception {
    //
    final Sdk sdk46 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
    FlexTestUtils.modifyConfigs(myProject, e -> {
        ModifiableFlexBuildConfiguration bc1 = e.getConfigurations(myModule)[0];
        bc1.setName("web");
        bc1.setTargetPlatform(TargetPlatform.Web);
        FlexTestUtils.setSdk(bc1, sdk46);
        ModifiableFlexBuildConfiguration bc2 = e.createConfiguration(myModule);
        bc2.setName("air");
        bc1.setTargetPlatform(TargetPlatform.Desktop);
        FlexTestUtils.setSdk(bc2, sdk46);
    });
    FlexBuildConfigurationManager m = FlexBuildConfigurationManager.getInstance(myModule);
    m.setActiveBuildConfiguration(m.findConfigurationByName("air"));
    defaultTest();
}
Also used : FlexBuildConfigurationManager(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager) Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 17 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlexModuleBuilder method setupRootModel.

public void setupRootModel(final ModifiableRootModel modifiableRootModel) throws ConfigurationException {
    final ContentEntry contentEntry = doAddContentEntry(modifiableRootModel);
    if (contentEntry == null)
        return;
    final VirtualFile sourceRoot = createSourceRoot(contentEntry);
    final Module module = modifiableRootModel.getModule();
    final FlexProjectConfigurationEditor currentFlexEditor = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor();
    final boolean needToCommitFlexEditor = currentFlexEditor == null;
    final FlexProjectConfigurationEditor flexConfigEditor;
    flexConfigEditor = currentFlexEditor != null ? currentFlexEditor : FlexProjectConfigurationEditor.createEditor(module.getProject(), Collections.singletonMap(module, modifiableRootModel), null, null);
    final ModifiableFlexBuildConfiguration[] configurations = flexConfigEditor.getConfigurations(module);
    assert configurations.length == 1;
    final ModifiableFlexBuildConfiguration bc = configurations[0];
    setupBC(modifiableRootModel, bc);
    if (bc.getOutputType() == OutputType.Application) {
        createRunConfiguration(module, bc);
    }
    if (sourceRoot != null && myCreateSampleApp && myFlexSdk != null) {
        try {
            final boolean flex4 = !FlexSdkUtils.isAirSdkWithoutFlex(myFlexSdk) && StringUtil.compareVersionNumbers(myFlexSdk.getVersionString(), "4") >= 0;
            FlexUtils.createSampleApp(module.getProject(), sourceRoot, mySampleAppName, myTargetPlatform, flex4);
        } catch (IOException ex) {
            throw new ConfigurationException(ex.getMessage());
        }
    }
    if (myCreateHtmlWrapperTemplate && myFlexSdk != null) {
        final String path = VfsUtilCore.urlToPath(contentEntry.getUrl()) + "/" + CreateHtmlWrapperTemplateDialog.HTML_TEMPLATE_FOLDER_NAME;
        if (CreateHtmlWrapperTemplateDialog.createHtmlWrapperTemplate(module.getProject(), myFlexSdk, path, myEnableHistory, myCheckPlayerVersion, myExpressInstall)) {
            bc.setUseHtmlWrapper(true);
            bc.setWrapperTemplatePath(path);
        }
    }
    if (needToCommitFlexEditor) {
        flexConfigEditor.commit();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FlexProjectConfigurationEditor(com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor) ConfigurationException(com.intellij.openapi.options.ConfigurationException) ContentEntry(com.intellij.openapi.roots.ContentEntry) IOException(java.io.IOException) Module(com.intellij.openapi.module.Module) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 18 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlexCompletionTest method testVectorObject.

public void testVectorObject() throws Exception {
    final Sdk sdk45 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
    FlexTestUtils.modifyConfigs(myProject, editor -> {
        ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
        FlexTestUtils.setSdk(bc1, sdk45);
    });
    final LookupElement[] elements = doTest("", "as");
    assertStartsWith(elements, "concat", "every", "filter");
    assertTrue(getBoldStatus(elements[0]));
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) LookupElement(com.intellij.codeInsight.lookup.LookupElement) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 19 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class ActionScriptHighlightingTest method testFieldResolveMixedRoots.

public void testFieldResolveMixedRoots() throws Exception {
    // same as testSuperclassResolveMixedRoots()
    final Sdk sdk45 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
    final Sdk sdk46 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
    FlexTestUtils.modifyConfigs(myProject, e -> {
        ModifiableFlexBuildConfiguration bc1 = e.getConfigurations(myModule)[0];
        bc1.setTargetPlatform(TargetPlatform.Desktop);
        FlexTestUtils.setSdk(bc1, sdk45);
        ModifiableFlexBuildConfiguration bc2 = e.createConfiguration(myModule);
        bc2.setName("2");
        bc1.setTargetPlatform(TargetPlatform.Mobile);
        FlexTestUtils.setSdk(bc2, sdk46);
    });
    defaultTest();
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 20 with ModifiableFlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration in project intellij-plugins by JetBrains.

the class ActionScriptHighlightingTest method testCorrectScopeForSuperclassCheck4.

public void testCorrectScopeForSuperclassCheck4() throws Exception {
    // two dependent modules, different SDKs
    final Module module2 = doCreateRealModuleIn("module2", myProject, FlexModuleType.getInstance());
    final Sdk sdk45 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, false);
    final Sdk sdk46 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.6"), null, false);
    FlexTestUtils.modifyConfigs(myProject, e -> {
        ModifiableFlexBuildConfiguration bc1 = e.getConfigurations(myModule)[0];
        FlexTestUtils.setSdk(bc1, sdk46);
        ModifiableFlexBuildConfiguration bc2 = e.getConfigurations(module2)[0];
        bc2.setOutputType(OutputType.Library);
        FlexTestUtils.setSdk(bc2, sdk45);
        bc1.getDependencies().getModifiableEntries().add(e.createBcEntry(bc1.getDependencies(), bc2, null));
    });
    myAfterCommitRunnable = () -> copyFileToModule(module2, getTestDataPath() + BASE_PATH + getTestName(false) + "_2.js2");
    doTestFor(true, getTestName(false) + ".js2");
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Aggregations

ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)31 Sdk (com.intellij.openapi.projectRoots.Sdk)16 Module (com.intellij.openapi.module.Module)8 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)5 BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)4 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 LookupElement (com.intellij.codeInsight.lookup.LookupElement)3 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)3 ConfigurationException (com.intellij.openapi.options.ConfigurationException)3 IOException (java.io.IOException)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 FlexModuleType (com.intellij.lang.javascript.flex.FlexModuleType)2 SdkEntry (com.intellij.lang.javascript.flex.projectStructure.model.SdkEntry)2 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)2 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)2 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)2 ModuleType (com.intellij.openapi.module.ModuleType)2