Search in sources :

Example 1 with DependencyEntry

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

the class FlexBuildConfigurationsExtension method selectOrderEntry.

@Nullable
public ActionCallback selectOrderEntry(@NotNull final Module module, @Nullable final OrderEntry entry) {
    if (ModuleType.get(module) != FlexModuleType.getInstance()) {
        return null;
    }
    if (entry instanceof LibraryOrderEntry) {
        final Library library = ((LibraryOrderEntry) entry).getLibrary();
        if (library != null && library.getTable() == null && ((LibraryEx) library).getKind() == FlexLibraryType.FLEX_LIBRARY) {
            final String libraryId = FlexProjectRootsUtil.getLibraryId(library);
            final List<CompositeConfigurable> configurables = myConfigurator.getBCConfigurables(module);
            // several build configurations may depend on the same library, here we select the first one we find
            for (CompositeConfigurable configurable : configurables) {
                final FlexBCConfigurable bcConfigurable = FlexBCConfigurable.unwrap(configurable);
                final Dependencies dependencies = bcConfigurable.getDependenciesConfigurable().getEditableObject();
                for (DependencyEntry e : dependencies.getEntries()) {
                    if (!(e instanceof ModuleLibraryEntry) || !((ModuleLibraryEntry) e).getLibraryId().equals(libraryId)) {
                        continue;
                    }
                    final Place p = FlexProjectStructureUtil.createPlace(bcConfigurable, DependenciesConfigurable.TAB_NAME);
                    final DependenciesConfigurable.Location.TableEntry tableEntry = DependenciesConfigurable.Location.TableEntry.forModuleLibrary(libraryId);
                    p.putPath(FlexBCConfigurable.LOCATION_ON_TAB, tableEntry);
                    return ProjectStructureConfigurable.getInstance(module.getProject()).navigateTo(p, true);
                }
            }
        }
    }
    return ProjectStructureConfigurable.getInstance(module.getProject()).select(module.getName(), null, true);
}
Also used : ModuleLibraryEntry(com.intellij.lang.javascript.flex.projectStructure.model.ModuleLibraryEntry) CompositeConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable) LibraryEx(com.intellij.openapi.roots.impl.libraries.LibraryEx) LibraryOrderEntry(com.intellij.openapi.roots.LibraryOrderEntry) FlexBCConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable) DependencyEntry(com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry) Library(com.intellij.openapi.roots.libraries.Library) Dependencies(com.intellij.lang.javascript.flex.projectStructure.model.Dependencies) Place(com.intellij.ui.navigation.Place) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with DependencyEntry

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

the class FlashPlayerTrustUtil method updateTrustedStatus.

public static void updateTrustedStatus(final Module module, final FlexBuildConfiguration bc, final boolean isDebug, final boolean isTrusted) {
    final Collection<String> paths = new ArrayList<>();
    try {
        paths.add(new File(PathUtil.getParentPath(bc.getActualOutputFilePath())).getCanonicalPath());
    } catch (IOException e) {
    /**/
    }
    for (DependencyEntry entry : bc.getDependencies().getEntries()) {
        if (entry instanceof BuildConfigurationEntry && entry.getDependencyType().getLinkageType() == LinkageType.LoadInRuntime) {
            final FlexBuildConfiguration dependencyBC = ((BuildConfigurationEntry) entry).findBuildConfiguration();
            if (dependencyBC != null) {
                try {
                    paths.add(new File(PathUtil.getParentPath(dependencyBC.getActualOutputFilePath())).getCanonicalPath());
                } catch (IOException e) {
                /**/
                }
            }
        }
    }
    updateTrustedStatus(module.getProject(), isTrusted, isDebug, paths.toArray(new String[paths.size()]));
}
Also used : BuildConfigurationEntry(com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) IOException(java.io.IOException) DependencyEntry(com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry) File(java.io.File)

Example 3 with DependencyEntry

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

the class FlexOrderEnumerationHandler method processModuleWithBuildConfiguration.

// configuration is null for root module (one for which scope is being computed)
private static void processModuleWithBuildConfiguration(@NotNull Module module, @Nullable FlexBuildConfiguration bc, Map<Module, ModuleData> modules2activeConfigurations, Set<FlexBuildConfiguration> processedConfigurations, boolean productionDependency) {
    if (ModuleType.get(module) != FlexModuleType.getInstance()) {
        return;
    }
    final boolean isRootModule = bc == null;
    if (isRootModule) {
        bc = getActiveConfiguration(module);
    }
    if (bc == null || !processedConfigurations.add(bc)) {
        return;
    }
    ModuleData moduleData = modules2activeConfigurations.get(module);
    if (moduleData == null) {
        modules2activeConfigurations.put(module, moduleData = new ModuleData());
    }
    moduleData.addBc(bc, productionDependency);
    for (DependencyEntry entry : bc.getDependencies().getEntries()) {
        if (!(entry instanceof BuildConfigurationEntry)) {
            continue;
        }
        final LinkageType linkageType = entry.getDependencyType().getLinkageType();
        if (linkageType == LinkageType.LoadInRuntime) {
            continue;
        }
        FlexBuildConfiguration dependencyBc = ((BuildConfigurationEntry) entry).findBuildConfiguration();
        if (dependencyBc == null || !FlexCommonUtils.checkDependencyType(bc.getOutputType(), dependencyBc.getOutputType(), linkageType)) {
            continue;
        }
        if (!isRootModule && !BCUtils.isTransitiveDependency(linkageType)) {
            continue;
        }
        Module dependencyModule = ((BuildConfigurationEntry) entry).findModule();
        if (dependencyModule == null || dependencyModule == module) {
            continue;
        }
        processModuleWithBuildConfiguration(dependencyModule, dependencyBc, modules2activeConfigurations, processedConfigurations, entry.getDependencyType().getLinkageType() != LinkageType.Test);
    }
}
Also used : BuildConfigurationEntry(com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) DependencyEntry(com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry) Module(com.intellij.openapi.module.Module) LinkageType(com.intellij.flex.model.bc.LinkageType)

Aggregations

DependencyEntry (com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry)3 BuildConfigurationEntry (com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry)2 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)2 LinkageType (com.intellij.flex.model.bc.LinkageType)1 Dependencies (com.intellij.lang.javascript.flex.projectStructure.model.Dependencies)1 ModuleLibraryEntry (com.intellij.lang.javascript.flex.projectStructure.model.ModuleLibraryEntry)1 CompositeConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable)1 FlexBCConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable)1 Module (com.intellij.openapi.module.Module)1 LibraryOrderEntry (com.intellij.openapi.roots.LibraryOrderEntry)1 LibraryEx (com.intellij.openapi.roots.impl.libraries.LibraryEx)1 Library (com.intellij.openapi.roots.libraries.Library)1 Place (com.intellij.ui.navigation.Place)1 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Nullable (org.jetbrains.annotations.Nullable)1