Search in sources :

Example 1 with ModifiableFlexBuildConfiguration

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

the class FlexCompletionTest method testNonApplicableInheritors.

@JSTestOptions({ JSTestOption.WithGumboSdk, JSTestOption.WithFlexLib, JSTestOption.WithSmartCompletion })
public void testNonApplicableInheritors() throws Exception {
    FlexTestUtils.modifyConfigs(myProject, editor -> {
        final ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
        final ModifiableFlexBuildConfiguration bc2 = editor.copyConfiguration(bc1, BuildConfigurationNature.DEFAULT);
        bc2.setName("bc 2");
        bc2.getDependencies().getModifiableEntries().clear();
    });
    LookupElement[] elements = doTest("", "as");
    assertEquals(3, elements.length);
    assertEquals("Image", elements[0].getLookupString());
    assertEquals("Base64Image", elements[1].getLookupString());
    assertEquals("ImageMap", elements[2].getLookupString());
    final FlexBuildConfigurationManager manager = FlexBuildConfigurationManager.getInstance(myModule);
    manager.setActiveBuildConfiguration(manager.findConfigurationByName("bc 2"));
    elements = doTest("", "as");
    assertEquals(1, elements.length);
    assertEquals("Image", elements[0].getLookupString());
}
Also used : FlexBuildConfigurationManager(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager) LookupElement(com.intellij.codeInsight.lookup.LookupElement) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 2 with ModifiableFlexBuildConfiguration

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

the class FlexProjectConfigTest method testModuleLibrary.

public void testModuleLibrary() throws ConfigurationException {
    assertEquals(1, FlexBuildConfigurationManager.getInstance(myModule).getBuildConfigurations().length);
    final String libraryId = createModuleLibrary();
    FlexTestUtils.modifyConfigs(myProject, configEditor -> {
        ModifiableFlexBuildConfiguration[] configurations = configEditor.getConfigurations(myModule);
        assertEquals(1, configurations.length);
        ModifiableFlexBuildConfiguration c = configurations[0];
        configEditor.createModuleLibraryEntry(c.getDependencies(), libraryId);
    });
    OrderEntry libraryEntry = findLibraryEntry(myModule, libraryId);
    assertNull(libraryEntry);
}
Also used : ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 3 with ModifiableFlexBuildConfiguration

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

the class FlexProjectConfigTest method createConfiguration.

private static ModifiableFlexBuildConfiguration createConfiguration(FlexProjectConfigurationEditor editor, Module module) {
    int i = 1;
    String name = "Config";
    while (true) {
        boolean found = false;
        for (ModifiableFlexBuildConfiguration configuration : editor.getConfigurations(module)) {
            if (configuration.getName().equals(name = "Config " + String.valueOf(i))) {
                found = true;
                break;
            }
        }
        if (found) {
            i++;
        } else {
            break;
        }
    }
    ModifiableFlexBuildConfiguration c = editor.createConfiguration(module);
    c.setName(name);
    return c;
}
Also used : ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 4 with ModifiableFlexBuildConfiguration

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

the class ActionScriptHighlightingTest method testVectorWithSdk.

public void testVectorWithSdk() 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);
    });
    doTestFor(true, getTestName(false) + ".as");
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 5 with ModifiableFlexBuildConfiguration

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

the class ActionScriptHighlightingTest method testCorrectScopeForSuperclassCheck6.

public void testCorrectScopeForSuperclassCheck6() throws Exception {
    // monkey patching SDK class
    final Sdk sdk45 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, false);
    FlexTestUtils.modifyConfigs(myProject, e -> {
        ModifiableFlexBuildConfiguration bc1 = e.getConfigurations(myModule)[0];
        FlexTestUtils.setSdk(bc1, sdk45);
    });
    doTestFor(true, getTestName(false) + ".js2", getTestName(false) + "_2.js2");
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) 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