Search in sources :

Example 11 with ModifiableFlexBuildConfiguration

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

the class FlexSdkStep method selectSdkUsedByOtherModules.

private static void selectSdkUsedByOtherModules(@Nullable final Project project, final FlexSdkComboBoxWithBrowseButton combo) {
    if (project == null) {
        return;
    }
    final FlexProjectConfigurationEditor currentEditor = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor();
    if (currentEditor != null) {
        final Module[] modules = ModuleStructureConfigurable.getInstance(project).getModules();
        for (Module module : modules) {
            if (ModuleType.get(module) != FlexModuleType.getInstance()) {
                continue;
            }
            for (ModifiableFlexBuildConfiguration c : currentEditor.getConfigurations(module)) {
                SdkEntry sdkEntry = c.getDependencies().getSdkEntry();
                Sdk sdk;
                if (sdkEntry != null && (sdk = FlexSdkUtils.findFlexOrFlexmojosSdk(sdkEntry.getName())) != null && sdk.getSdkType() == FlexSdkType2.getInstance()) {
                    combo.setSelectedSdkRaw(sdk.getName());
                    return;
                }
            }
        }
    } else {
        for (final Module module : ModuleManager.getInstance(project).getModules()) {
            if (ModuleType.get(module) == FlexModuleType.getInstance()) {
                for (FlexBuildConfiguration bc : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
                    Sdk sdk = bc.getSdk();
                    if (sdk != null) {
                        combo.setSelectedSdkRaw(sdk.getName());
                        return;
                    }
                }
            }
        }
    }
}
Also used : FlexProjectConfigurationEditor(com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) SdkEntry(com.intellij.lang.javascript.flex.projectStructure.model.SdkEntry)

Example 12 with ModifiableFlexBuildConfiguration

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

the class FlashBuilderModuleImporter method setupOtherAppsAndModules.

private void setupOtherAppsAndModules(final ModuleRootModel rootModel, final ModifiableFlexBuildConfiguration mainBC, final FlashBuilderProject fbProject) {
    final Collection<ModifiableFlexBuildConfiguration> allApps = new ArrayList<>();
    allApps.add(mainBC);
    for (String mainClass : fbProject.getApplicationClassNames()) {
        final ModifiableFlexBuildConfiguration bc = myFlexConfigEditor.copyConfiguration(mainBC, mainBC.getNature());
        final String shortClassName = StringUtil.getShortName(mainClass);
        bc.setName(shortClassName);
        bc.setMainClass(mainClass);
        bc.setOutputFileName(shortClassName + ".swf");
        if (bc.getTargetPlatform() == TargetPlatform.Desktop) {
            setupAirDescriptor(bc, rootModel);
            bc.getAirDesktopPackagingOptions().setPackageFileName(shortClassName);
        }
        if (bc.getTargetPlatform() == TargetPlatform.Mobile) {
            setupAirDescriptor(bc, rootModel);
            bc.getAndroidPackagingOptions().setPackageFileName(shortClassName);
            bc.getIosPackagingOptions().setPackageFileName(shortClassName);
        }
        FlexModuleBuilder.createRunConfiguration(rootModel.getModule(), bc);
        allApps.add(bc);
    }
    if (BCUtils.canHaveRLMsAndRuntimeStylesheets(mainBC)) {
        setupModules(rootModel, allApps, fbProject);
    }
}
Also used : ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 13 with ModifiableFlexBuildConfiguration

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

the class FlexHighlightingTest method testBadResolveOfSuperClass.

public void testBadResolveOfSuperClass() throws Exception {
    final Sdk sdk = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, true);
    WriteAction.run(() -> FlexTestUtils.modifyConfigs(myProject, editor -> {
        final ModifiableFlexBuildConfiguration bc1 = editor.getConfigurations(myModule)[0];
        FlexTestUtils.setSdk(bc1, sdk);
        final ModifiableFlexBuildConfiguration bc2 = editor.createConfiguration(myModule);
        bc2.setNature(new BuildConfigurationNature(TargetPlatform.Desktop, false, OutputType.Application));
        bc2.setName("2");
        FlexTestUtils.setSdk(bc2, sdk);
    }));
    doTestFor(true, getTestName(false) + ".mxml");
}
Also used : InjectedLanguageManager(com.intellij.lang.injection.InjectedLanguageManager) XmlFile(com.intellij.psi.xml.XmlFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) THashSet(gnu.trove.THashSet) AnnotationBackedDescriptor(com.intellij.lang.javascript.flex.AnnotationBackedDescriptor) JSAttributeListOwner(com.intellij.lang.javascript.psi.ecmal4.JSAttributeListOwner) PsiTreeUtil(com.intellij.psi.util.PsiTreeUtil) CheckXmlFileWithXercesValidatorInspection(com.intellij.xml.util.CheckXmlFileWithXercesValidatorInspection) DumbServiceImpl(com.intellij.openapi.project.DumbServiceImpl) WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) ActionScriptDaemonAnalyzerTestCase(com.intellij.flex.util.ActionScriptDaemonAnalyzerTestCase) Module(com.intellij.openapi.module.Module) com.intellij.lang.javascript(com.intellij.lang.javascript) JavaScriptIndex(com.intellij.lang.javascript.index.JavaScriptIndex) UnterminatedStatementJSInspection(com.intellij.lang.javascript.inspections.UnterminatedStatementJSInspection) JSAttributeList(com.intellij.lang.javascript.psi.ecmal4.JSAttributeList) Extensions(com.intellij.openapi.extensions.Extensions) CssUnknownPropertyInspection(com.intellij.psi.css.inspections.CssUnknownPropertyInspection) StdModuleTypes(com.intellij.openapi.module.StdModuleTypes) IncorrectOperationException(com.intellij.util.IncorrectOperationException) XmlHighlighterColors(com.intellij.openapi.editor.XmlHighlighterColors) PsiTestUtil(com.intellij.testFramework.PsiTestUtil) JSUseNamespaceDirective(com.intellij.lang.javascript.psi.ecmal4.JSUseNamespaceDirective) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) ModuleOrProjectCompilerOptions(com.intellij.lang.javascript.flex.projectStructure.model.ModuleOrProjectCompilerOptions) JSUnusedGlobalSymbolsInspection(com.intellij.lang.javascript.inspections.JSUnusedGlobalSymbolsInspection) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) HighlightInfoFilter(com.intellij.codeInsight.daemon.impl.HighlightInfoFilter) CssInvalidHtmlTagReferenceInspection(com.intellij.psi.css.inspections.invalid.CssInvalidHtmlTagReferenceInspection) VfsUtilCore.urlToPath(com.intellij.openapi.vfs.VfsUtilCore.urlToPath) java.util(java.util) FlexProjectLevelCompilerOptionsHolder(com.intellij.lang.javascript.flex.projectStructure.FlexProjectLevelCompilerOptionsHolder) HighlightInfo(com.intellij.codeInsight.daemon.impl.HighlightInfo) FlexUnitLibs(com.intellij.flex.util.FlexUnitLibs) CssDialect(com.intellij.lang.css.CssDialect) DaemonCodeAnalyzer(com.intellij.codeInsight.daemon.DaemonCodeAnalyzer) CssNoGenericFontNameInspection(com.intellij.psi.css.inspections.bugs.CssNoGenericFontNameInspection) XmlNSDescriptorImpl(com.intellij.xml.impl.dtd.XmlNSDescriptorImpl) ModuleType(com.intellij.openapi.module.ModuleType) CssBundle(com.intellij.psi.css.CssBundle) JSUnusedLocalSymbolsInspection(com.intellij.lang.javascript.inspections.JSUnusedLocalSymbolsInspection) PropertiesBundle(com.intellij.lang.properties.PropertiesBundle) FileTemplateManager(com.intellij.ide.fileTemplates.FileTemplateManager) JSResolveUtil(com.intellij.lang.javascript.psi.resolve.JSResolveUtil) StringUtil(com.intellij.openapi.util.text.StringUtil) FlexSchemaHandler(com.intellij.javascript.flex.mxml.schema.FlexSchemaHandler) XmlNSDescriptor(com.intellij.xml.XmlNSDescriptor) IOException(java.io.IOException) Target(java.lang.annotation.Target) JSPsiImplUtils(com.intellij.lang.javascript.psi.impl.JSPsiImplUtils) Sdk(com.intellij.openapi.projectRoots.Sdk) File(java.io.File) JarFileSystem(com.intellij.openapi.vfs.JarFileSystem) FileTemplateUtil(com.intellij.ide.fileTemplates.FileTemplateUtil) XmlAttributeDescriptor(com.intellij.xml.XmlAttributeDescriptor) LocalInspectionTool(com.intellij.codeInspection.LocalInspectionTool) JSFunctionsSearch(com.intellij.lang.javascript.search.JSFunctionsSearch) DaemonCodeAnalyzerImpl(com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl) CssUnknownTargetInspection(com.intellij.psi.css.inspections.invalid.CssUnknownTargetInspection) VfsRootAccess(com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess) JSMethodCanBeStaticInspection(com.intellij.lang.javascript.inspections.JSMethodCanBeStaticInspection) EXTENSION_POINT_NAME(com.intellij.codeInsight.daemon.impl.HighlightInfoFilter.EXTENSION_POINT_NAME) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) SpellCheckingInspection(com.intellij.spellchecker.inspections.SpellCheckingInspection) FlexStylesIndexableSetContributor(com.intellij.javascript.flex.css.FlexStylesIndexableSetContributor) CssDialectMappings(com.intellij.lang.css.CssDialectMappings) Disposer(com.intellij.openapi.util.Disposer) FlexCSSDialect(com.intellij.javascript.flex.css.FlexCSSDialect) XmlAttributeValue(com.intellij.psi.xml.XmlAttributeValue) Method(java.lang.reflect.Method) ReferencesSearch(com.intellij.psi.search.searches.ReferencesSearch) DumbService(com.intellij.openapi.project.DumbService) XmlUnusedNamespaceInspection(com.intellij.codeInsight.daemon.impl.analysis.XmlUnusedNamespaceInspection) FlexUnitTestCreator(com.intellij.lang.javascript.flex.flexunit.FlexUnitTestCreator) CssInvalidFunctionInspection(com.intellij.psi.css.inspections.invalid.CssInvalidFunctionInspection) FlexBundle(com.intellij.lang.javascript.flex.FlexBundle) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) VfsUtilCore.convertFromUrl(com.intellij.openapi.vfs.VfsUtilCore.convertFromUrl) ApplicationManager(com.intellij.openapi.application.ApplicationManager) CssNegativeValueInspection(com.intellij.psi.css.inspections.CssNegativeValueInspection) IntentionAction(com.intellij.codeInsight.intention.IntentionAction) FlexMxmlNSDescriptor(com.intellij.javascript.flex.mxml.schema.FlexMxmlNSDescriptor) com.intellij.psi(com.intellij.psi) NotNull(org.jetbrains.annotations.NotNull) FlexBuildConfigurationManager(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager) JSInheritanceUtil(com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil) Ref(com.intellij.openapi.util.Ref) CssUnusedSymbolInspection(com.intellij.psi.css.inspections.CssUnusedSymbolInspection) NavigationItem(com.intellij.navigation.NavigationItem) CodeInsightTestUtil(com.intellij.testFramework.fixtures.CodeInsightTestUtil) OutputType(com.intellij.flex.model.bc.OutputType) WriteAction(com.intellij.openapi.application.WriteAction) FlexModuleType(com.intellij.lang.javascript.flex.FlexModuleType) NonNls(org.jetbrains.annotations.NonNls) ContainerUtil(com.intellij.util.containers.ContainerUtil) XmlPathReferenceInspection(com.intellij.codeInsight.daemon.impl.analysis.XmlPathReferenceInspection) ExpectedHighlightingData(com.intellij.testFramework.ExpectedHighlightingData) Retention(java.lang.annotation.Retention) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) com.intellij.openapi.roots(com.intellij.openapi.roots) CssUnitlessNumberInspection(com.intellij.psi.css.inspections.bugs.CssUnitlessNumberInspection) RenameProcessor(com.intellij.refactoring.rename.RenameProcessor) ImplementationSearcher(com.intellij.codeInsight.navigation.ImplementationSearcher) BadExpressionStatementJSInspection(com.sixrr.inspectjs.validity.BadExpressionStatementJSInspection) FlexTestUtils(com.intellij.flex.util.FlexTestUtils) InjectedLanguageUtil(com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil) OpenFileDescriptor(com.intellij.openapi.fileEditor.OpenFileDescriptor) CodeInsightTestFixtureImpl(com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl) JSFieldCanBeLocalInspection(com.intellij.lang.javascript.inspections.actionscript.JSFieldCanBeLocalInspection) VfsUtilCore(com.intellij.openapi.vfs.VfsUtilCore) XmlAttribute(com.intellij.psi.xml.XmlAttribute) JSDialectSpecificHandlersFactory(com.intellij.lang.javascript.dialects.JSDialectSpecificHandlersFactory) com.intellij.lang.javascript.psi(com.intellij.lang.javascript.psi) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) JSUntypedDeclarationInspection(com.intellij.lang.javascript.inspections.actionscript.JSUntypedDeclarationInspection) ElementType(java.lang.annotation.ElementType) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) JSClassResolver(com.intellij.lang.javascript.psi.resolve.JSClassResolver) SdkModificator(com.intellij.openapi.projectRoots.SdkModificator) CssInvalidElementInspection(com.intellij.psi.css.inspections.CssInvalidElementInspection) CssInvalidPropertyValueInspection(com.intellij.psi.css.inspections.invalid.CssInvalidPropertyValueInspection) RetentionPolicy(java.lang.annotation.RetentionPolicy) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 14 with ModifiableFlexBuildConfiguration

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

the class ActionScriptHighlightingTest method testCorrectScopeForSuperclassCheck5.

public void testCorrectScopeForSuperclassCheck5() throws Exception {
    // same fqn in SDK and library:
    // Module depends on an swc that has SDK classes compiled in.
    // Library classes (swc compiled with SDK 4.6) have newer timestamp than classes of SDK that module depends on (SDK 4.5)
    // SDK should have no sources attached (otherwise getNavigationElement() for both classes will bring us to the same file)
    // see testData\js2_highlighting\CorrectScopeForSuperclassCheck5_src.zip
    final Sdk sdk45 = FlexTestUtils.createSdk(FlexTestUtils.getPathToCompleteFlexSdk("4.5"), null, false);
    FlexTestUtils.addFlexLibrary(false, myModule, "foobar", true, getTestDataPath(), BASE_PATH + getTestName(false) + ".swc", null, null, LinkageType.Merged);
    FlexTestUtils.modifyConfigs(myProject, e -> {
        ModifiableFlexBuildConfiguration bc1 = e.getConfigurations(myModule)[0];
        FlexTestUtils.setSdk(bc1, sdk45);
    });
    doTestFor(true, getTestName(false) + ".js2");
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 15 with ModifiableFlexBuildConfiguration

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

the class ActionScriptHighlightingTest method testSuperclassResolveMixedRoots.

public void testSuperclassResolveMixedRoots() throws Exception {
    // we need two SDKs so that flash.net.FileReference from SDK 4.6/playerglobal.swc
    // has more recent timestamp than its brother from SDK 4.5/airglobal.swc
    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)

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