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;
}
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;
}
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);
}
}
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);
}
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);
}
}
}
Aggregations