Search in sources :

Example 1 with IdeModifiableModelsProviderImpl

use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project intellij-community by JetBrains.

the class MavenFoldersImporterTest method testDoNotUpdateOutputFoldersWhenUpdatingExcludedFolders.

public void testDoNotUpdateOutputFoldersWhenUpdatingExcludedFolders() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    ApplicationManager.getApplication().runWriteAction(() -> {
        MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom), getModule("project"), new IdeModifiableModelsProviderImpl(myProject));
        adapter.useModuleOutput(new File(myProjectRoot.getPath(), "target/my-classes").getPath(), new File(myProjectRoot.getPath(), "target/my-test-classes").getPath());
        adapter.getRootModel().commit();
    });
    MavenFoldersImporter.updateProjectFolders(myProject, true);
    ModuleRootManager rootManager = ModuleRootManager.getInstance(getModule("project"));
    CompilerModuleExtension compiler = rootManager.getModuleExtension(CompilerModuleExtension.class);
    assertTrue(compiler.getCompilerOutputUrl(), compiler.getCompilerOutputUrl().endsWith("my-classes"));
    assertTrue(compiler.getCompilerOutputUrlForTests(), compiler.getCompilerOutputUrlForTests().endsWith("my-test-classes"));
}
Also used : IdeModifiableModelsProviderImpl(com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl) MavenRootModelAdapter(org.jetbrains.idea.maven.importing.MavenRootModelAdapter) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 2 with IdeModifiableModelsProviderImpl

use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project intellij-community by JetBrains.

the class MavenFoldersImporterTest method testDoesNotExcludeRegisteredSources.

public void testDoesNotExcludeRegisteredSources() throws Exception {
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    new File(myProjectRoot.getPath(), "target/foo").mkdirs();
    final File sourceDir = new File(myProjectRoot.getPath(), "target/src");
    sourceDir.mkdirs();
    ApplicationManager.getApplication().runWriteAction(() -> {
        MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom), getModule("project"), new IdeModifiableModelsProviderImpl(myProject));
        adapter.addSourceFolder(sourceDir.getPath(), JavaSourceRootType.SOURCE);
        adapter.getRootModel().commit();
    });
    updateProjectFolders();
    assertSources("project", "target/src");
    assertExcludes("project", "target");
}
Also used : IdeModifiableModelsProviderImpl(com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl) MavenRootModelAdapter(org.jetbrains.idea.maven.importing.MavenRootModelAdapter) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 3 with IdeModifiableModelsProviderImpl

use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project intellij-community by JetBrains.

the class GroovyImporterTest method testUpdatingGroovySpecificGeneratedSourcesOnFoldersUpdate.

public void testUpdatingGroovySpecificGeneratedSourcesOnFoldersUpdate() throws Exception {
    try {
        importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + "  <plugins>" + "    <plugin>" + "      <groupId>org.codehaus.groovy.maven</groupId>" + "      <artifactId>gmaven-plugin</artifactId>" + "      <executions>" + "        <execution>" + "          <goals>" + "            <goal>generateStubs</goal>" + "            <goal>generateTestStubs</goal>" + "          </goals>" + "        </execution>" + "      </executions>" + "    </plugin>" + "  </plugins>" + "</build>");
        ApplicationManager.getApplication().runWriteAction(() -> {
            MavenRootModelAdapter a = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom), getModule("project"), new IdeModifiableModelsProviderImpl(myProject));
            a.unregisterAll(getProjectPath() + "/target", true, true);
            a.getRootModel().commit();
        });
        assertSources("project");
        assertTestSources("project");
        assertExcludes("project");
        createProjectSubDirs("src/main/groovy", "src/test/groovy", "target/generated-sources/xxx/yyy", "target/generated-sources/groovy-stubs/main/foo", "target/generated-sources/groovy-stubs/test/bar");
        resolveFoldersAndImport();
        assertSources("project", "src/main/groovy", "target/generated-sources/xxx");
        assertTestSources("project", "src/test/groovy");
        assertExcludes("project", "target");
    } finally {
        // do not lock files by maven process
        MavenServerManager.getInstance().shutdown(true);
    }
}
Also used : IdeModifiableModelsProviderImpl(com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl)

Example 4 with IdeModifiableModelsProviderImpl

use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.

the class NdkModuleModelDataServiceTest method testGetTargetDataKey.

public void testGetTargetDataKey() {
    myModelsProvider = new IdeModifiableModelsProviderImpl(getProject());
    assertSame(NDK_MODEL, myDataService.getTargetDataKey());
}
Also used : IdeModifiableModelsProviderImpl(com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl)

Example 5 with IdeModifiableModelsProviderImpl

use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.

the class GradleModuleModelDataServiceTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    initMocks(this);
    myModelsProvider = new IdeModifiableModelsProviderImpl(getProject());
    myDataService = new GradleModuleModelDataService(myModuleSetup);
}
Also used : IdeModifiableModelsProviderImpl(com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl)

Aggregations

IdeModifiableModelsProviderImpl (com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl)36 IdeModifiableModelsProvider (com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider)18 Module (com.intellij.openapi.module.Module)16 Project (com.intellij.openapi.project.Project)9 File (java.io.File)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 DataNode (com.intellij.openapi.externalSystem.model.DataNode)4 Library (com.intellij.openapi.roots.libraries.Library)4 JavaModuleModel (com.android.tools.idea.gradle.project.model.JavaModuleModel)3 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)3 HashMap (java.util.HashMap)3 Set (java.util.Set)3 FacetManager (com.intellij.facet.FacetManager)2 ModifiableFacetModel (com.intellij.facet.ModifiableFacetModel)2 IdeUIModifiableModelsProvider (com.intellij.openapi.externalSystem.service.project.IdeUIModifiableModelsProvider)2 LibraryOrderEntry (com.intellij.openapi.roots.LibraryOrderEntry)2 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)2 ArrayList (java.util.ArrayList)2 MavenRootModelAdapter (org.jetbrains.idea.maven.importing.MavenRootModelAdapter)2 AndroidProject (com.android.builder.model.AndroidProject)1