Search in sources :

Example 6 with PsModule

use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.

the class ModulesComboBoxAction method createPopupActionGroup.

@Override
@NotNull
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
    DefaultActionGroup group = new DefaultActionGroup();
    for (PsModule module : myExtraTopModules) {
        group.add(new ModuleAction(module));
    }
    myContext.getProject().forEachModule(module -> group.add(new ModuleAction(module)));
    return group;
}
Also used : PsModule(com.android.tools.idea.gradle.structure.model.PsModule) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with PsModule

use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.

the class ModuleDependenciesForm method getModuleDependencies.

@NotNull
private static List<PsModule> getModuleDependencies(@NotNull PsModule module) {
    PsProject project = module.getParent();
    List<PsModule> dependencies = Lists.newArrayList();
    if (module instanceof PsAndroidModule) {
        ((PsAndroidModule) module).forEachModuleDependency(dependency -> {
            String name = dependency.getName();
            PsModule found = project.findModuleByName(name);
            if (found != null) {
                dependencies.add(found);
            }
        });
    }
    return dependencies;
}
Also used : PsProject(com.android.tools.idea.gradle.structure.model.PsProject) PsModule(com.android.tools.idea.gradle.structure.model.PsModule) PsAndroidModule(com.android.tools.idea.gradle.structure.model.android.PsAndroidModule) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with PsModule

use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.

the class AddLibraryDependencyDialog method addNewDependencies.

@Override
public void addNewDependencies() {
    String library = myLibraryDependenciesForm.getSelectedLibrary();
    assert library != null;
    AbstractDependencyScopesPanel scopesPanel = getScopesPanel();
    List<String> scopesNames = scopesPanel.getSelectedScopeNames();
    PsModule module = getModule();
    if (module instanceof PsAndroidModule) {
        PsNewDependencyScopes newScopes = ((AndroidDependencyScopesPanel) scopesPanel).getNewScopes();
        assert newScopes != null;
        ((PsAndroidModule) module).addLibraryDependency(library, newScopes, scopesNames);
    } else if (module instanceof PsJavaModule) {
        ((PsJavaModule) module).addLibraryDependency(library, scopesNames);
    }
}
Also used : PsJavaModule(com.android.tools.idea.gradle.structure.model.java.PsJavaModule) PsModule(com.android.tools.idea.gradle.structure.model.PsModule) PsNewDependencyScopes(com.android.tools.idea.gradle.structure.model.android.dependency.PsNewDependencyScopes) PsAndroidModule(com.android.tools.idea.gradle.structure.model.android.PsAndroidModule) AndroidDependencyScopesPanel(com.android.tools.idea.gradle.structure.dependencies.android.AndroidDependencyScopesPanel)

Example 9 with PsModule

use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.

the class PsAndroidDependencyCollection method addModule.

private void addModule(@NotNull String gradlePath, @NotNull PsAndroidArtifact artifact, @Nullable String projectVariant) {
    PsParsedDependencies parsedDependencies = myParent.getParsedDependencies();
    ModuleDependencyModel matchingParsedDependency = parsedDependencies.findModuleDependency(gradlePath, artifact::contains);
    Module resolvedModule = null;
    PsModule module = myParent.getParent().findModuleByGradlePath(gradlePath);
    if (module != null) {
        resolvedModule = module.getResolvedModel();
    }
    PsModuleAndroidDependency dependency = findElement(gradlePath, PsModuleAndroidDependency.class);
    if (dependency == null) {
        dependency = new PsModuleAndroidDependency(myParent, gradlePath, artifact, projectVariant, resolvedModule, matchingParsedDependency);
        myModuleDependenciesByGradlePath.put(gradlePath, dependency);
    }
    updateDependency(dependency, artifact, matchingParsedDependency);
}
Also used : PsModule(com.android.tools.idea.gradle.structure.model.PsModule) ModuleDependencyModel(com.android.tools.idea.gradle.dsl.model.dependencies.ModuleDependencyModel) PsParsedDependencies(com.android.tools.idea.gradle.structure.model.PsParsedDependencies) PsModule(com.android.tools.idea.gradle.structure.model.PsModule) Module(com.intellij.openapi.module.Module)

Example 10 with PsModule

use of com.android.tools.idea.gradle.structure.model.PsModule in project android by JetBrains.

the class BasePerspectiveConfigurable method selectModule.

private void selectModule(@NotNull String moduleName) {
    PsModule module = findModule(moduleName);
    if (module != null) {
        MyNode node = findNodeByObject(myRoot, module);
        if (node != null) {
            selectNodeInTree(moduleName);
            setSelectedNode(node);
        }
    }
}
Also used : PsModule(com.android.tools.idea.gradle.structure.model.PsModule)

Aggregations

PsModule (com.android.tools.idea.gradle.structure.model.PsModule)13 PsAndroidModule (com.android.tools.idea.gradle.structure.model.android.PsAndroidModule)5 NamedConfigurable (com.intellij.openapi.ui.NamedConfigurable)3 NotNull (org.jetbrains.annotations.NotNull)3 PsArtifactDependencySpec (com.android.tools.idea.gradle.structure.model.PsArtifactDependencySpec)2 PsProject (com.android.tools.idea.gradle.structure.model.PsProject)2 PsJavaModule (com.android.tools.idea.gradle.structure.model.java.PsJavaModule)2 List (java.util.List)2 ModuleDependencyModel (com.android.tools.idea.gradle.dsl.model.dependencies.ModuleDependencyModel)1 PsContext (com.android.tools.idea.gradle.structure.configurables.PsContext)1 AndroidDependencyScopesPanel (com.android.tools.idea.gradle.structure.dependencies.android.AndroidDependencyScopesPanel)1 PsIssue (com.android.tools.idea.gradle.structure.model.PsIssue)1 PsLibraryDependency (com.android.tools.idea.gradle.structure.model.PsLibraryDependency)1 PsParsedDependencies (com.android.tools.idea.gradle.structure.model.PsParsedDependencies)1 PsLibraryAndroidDependency (com.android.tools.idea.gradle.structure.model.android.PsLibraryAndroidDependency)1 PsNewDependencyScopes (com.android.tools.idea.gradle.structure.model.android.dependency.PsNewDependencyScopes)1 Splitter (com.google.common.base.Splitter)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 Module (com.intellij.openapi.module.Module)1 MasterDetailsComponent (com.intellij.openapi.ui.MasterDetailsComponent)1