Search in sources :

Example 1 with AndroidDependencyScopesPanel

use of com.android.tools.idea.gradle.structure.dependencies.android.AndroidDependencyScopesPanel 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)

Aggregations

AndroidDependencyScopesPanel (com.android.tools.idea.gradle.structure.dependencies.android.AndroidDependencyScopesPanel)1 PsModule (com.android.tools.idea.gradle.structure.model.PsModule)1 PsAndroidModule (com.android.tools.idea.gradle.structure.model.android.PsAndroidModule)1 PsNewDependencyScopes (com.android.tools.idea.gradle.structure.model.android.dependency.PsNewDependencyScopes)1 PsJavaModule (com.android.tools.idea.gradle.structure.model.java.PsJavaModule)1