Search in sources :

Example 6 with ModuleToImport

use of com.android.tools.idea.gradle.project.ModuleToImport in project android by JetBrains.

the class ImportSourceLocationStep method updateStepStatus.

private void updateStepStatus(PathValidationResult result) {
    Object validationDetails = result.myDetails;
    PageStatus status = result.myStatus;
    Map<String, VirtualFile> selectedModules = Collections.emptyMap();
    if (!ERROR.equals(status.severity)) {
        final Collection<ModuleToImport> modules = myModulesPanel.getSelectedModules();
        if (modules.isEmpty()) {
            status = PageStatus.NO_MODULES_SELECTED;
            validationDetails = null;
        } else {
            selectedModules = Maps.newHashMap();
            for (ModuleToImport module : modules) {
                selectedModules.put(myModulesPanel.getModuleName(module), module.location);
            }
        }
    }
    myPageValidationResult = result;
    myState.setModulesToImport(selectedModules);
    updateStatusDisplay(status, validationDetails);
    myStatus = status;
    myUpdateListener.update();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ModuleToImport(com.android.tools.idea.gradle.project.ModuleToImport)

Example 7 with ModuleToImport

use of com.android.tools.idea.gradle.project.ModuleToImport in project android by JetBrains.

the class ModulesListModelTest method testTwoEmptyNamesAreNotDuplicates.

public void testTwoEmptyNamesAreNotDuplicates() {
    ModuleToImport m2 = new ModuleToImport("m2", myModule2.location, NO_DEPS);
    setModules(myModule1, m2);
    myModel.setModuleName(myModule1, "");
    myModel.setModuleName(m2, "");
    assertEquals(INVALID_NAME, myModel.getModuleState(myModule1));
    assertEquals(INVALID_NAME, myModel.getModuleState(m2));
}
Also used : ModuleToImport(com.android.tools.idea.gradle.project.ModuleToImport)

Example 8 with ModuleToImport

use of com.android.tools.idea.gradle.project.ModuleToImport in project android by JetBrains.

the class ModulesListModelTest method testSelectedByDefault.

public void testSelectedByDefault() {
    ModuleToImport nullLocation = new ModuleToImport("somename", null, NO_DEPS);
    ModuleToImport existing = new ModuleToImport(EXISTING_MODULE, myModule2.location, NO_DEPS);
    setModules(myModule1, nullLocation, existing);
    assertTrue(myModel.isSelected(myModule1));
    assertFalse(myModel.isSelected(nullLocation));
    assertFalse(myModel.isSelected(existing));
}
Also used : ModuleToImport(com.android.tools.idea.gradle.project.ModuleToImport)

Example 9 with ModuleToImport

use of com.android.tools.idea.gradle.project.ModuleToImport in project android by JetBrains.

the class ModulesListModelTest method assertContainsAll.

private static void assertContainsAll(ModuleListModel moduleListModel, ModuleToImport... expectedModules) {
    Collection<ModuleToImport> modules = moduleListModel.getSelectedModules();
    assertEquals(expectedModules.length, modules.size());
    for (ModuleToImport module : expectedModules) {
        assertTrue(String.format("Does not contain %s", module.name), modules.contains(module));
    }
}
Also used : ModuleToImport(com.android.tools.idea.gradle.project.ModuleToImport)

Example 10 with ModuleToImport

use of com.android.tools.idea.gradle.project.ModuleToImport in project android by JetBrains.

the class ModulesTable method getSelectedModulesMap.

public Map<String, VirtualFile> getSelectedModulesMap() {
    final Collection<ModuleToImport> modules = myListModel.getSelectedModules();
    if (modules.isEmpty()) {
        return Collections.emptyMap();
    }
    Map<String, VirtualFile> selectedModules = Maps.newHashMap();
    for (ModuleToImport module : modules) {
        selectedModules.put(myListModel.getModuleName(module), module.location);
    }
    return selectedModules;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ModuleToImport(com.android.tools.idea.gradle.project.ModuleToImport)

Aggregations

ModuleToImport (com.android.tools.idea.gradle.project.ModuleToImport)17 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 IOException (java.io.IOException)3 VisibleForTesting (com.android.annotations.VisibleForTesting)1 ModuleImporter (com.android.tools.idea.gradle.project.ModuleImporter)1 ModuleListModel (com.android.tools.idea.npw.importing.ModuleListModel)1 Function (com.google.common.base.Function)1 Project (com.intellij.openapi.project.Project)1 File (java.io.File)1 Collection (java.util.Collection)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1