diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/importSources/impl/ProjectFromSourcesBuilderImpl.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/importSources/impl/ProjectFromSourcesBuilderImpl.java index 2980c4e25b09..7a671c5e146f 100644 --- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/importSources/impl/ProjectFromSourcesBuilderImpl.java +++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/importSources/impl/ProjectFromSourcesBuilderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -280,7 +280,7 @@ public class ProjectFromSourcesBuilderImpl extends ProjectBuilder implements Pro final String moduleFilePath = descriptor.computeModuleFilePath(); ModuleBuilder.deleteModuleFile(moduleFilePath); - final Module module = moduleModel.newModule(moduleFilePath, descriptor.getModuleType()); + final Module module = moduleModel.newModule(moduleFilePath, descriptor.getModuleType().getId()); final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel(); setupRootModel(projectDescriptor, descriptor, modifiableModel, projectLibs); descriptor.updateModuleConfiguration(module, modifiableModel); diff --git a/java/java-tests/testSrc/com/intellij/module/ModulePointerTest.java b/java/java-tests/testSrc/com/intellij/module/ModulePointerTest.java index 2fba11069a25..55bc15f7c0b6 100644 --- a/java/java-tests/testSrc/com/intellij/module/ModulePointerTest.java +++ b/java/java-tests/testSrc/com/intellij/module/ModulePointerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,7 +70,7 @@ public class ModulePointerTest extends PlatformTestCase { final ModulePointer pointer = getPointerManager().create("xxx"); final ModifiableModuleModel modifiableModel = getModuleManager().getModifiableModel(); - final Module module = modifiableModel.newModule(myProject.getBaseDir().getPath() + "/xxx.iml", EmptyModuleType.getInstance()); + final Module module = modifiableModel.newModule(myProject.getBaseDir().getPath() + "/xxx.iml", EmptyModuleType.getInstance().getId()); assertSame(pointer, getPointerManager().create(module)); assertSame(pointer, getPointerManager().create("xxx")); @@ -89,7 +89,7 @@ public class ModulePointerTest extends PlatformTestCase { private Module addModule(final String name) { final ModifiableModuleModel model = getModuleManager().getModifiableModel(); - final Module module = model.newModule(myProject.getBaseDir().getPath() + "/" + name + ".iml", EmptyModuleType.getInstance()); + final Module module = model.newModule(myProject.getBaseDir().getPath() + "/" + name + ".iml", EmptyModuleType.getInstance().getId()); commitModel(model); disposeOnTearDown(new Disposable() { @Override diff --git a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java index 93614eae30b7..b7cd434142e2 100644 --- a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.resolve; import com.intellij.openapi.application.ApplicationManager; @@ -197,7 +212,7 @@ public class ResolveClassTest extends ResolveTestCase { @Override public void run() { ModifiableModuleModel modifiableModel = ModuleManager.getInstance(getProject()).getModifiableModel(); - Module module = modifiableModel.newModule("a.iml", StdModuleTypes.JAVA); + Module module = modifiableModel.newModule("a.iml", StdModuleTypes.JAVA.getId()); modifiableModel.commit(); ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel(); diff --git a/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java b/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java index 4be491c3f5d2..e06de7cec18e 100644 --- a/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.search; import com.intellij.JavaTestUtil; @@ -117,7 +132,7 @@ public class FindUsagesTest extends PsiTestCase{ @Override protected void run(Result result) throws Throwable { final ModifiableModuleModel moduleModel = ModuleManager.getInstance(getProject()).getModifiableModel(); - moduleModel.newModule("independent/independent.iml", StdModuleTypes.JAVA); + moduleModel.newModule("independent/independent.iml", StdModuleTypes.JAVA.getId()); moduleModel.commit(); tdf.createFile("plugin.xml", "\n" + diff --git a/java/java-tests/testSrc/com/intellij/roots/ExportingModulesTest.java b/java/java-tests/testSrc/com/intellij/roots/ExportingModulesTest.java index c9aa2cdaa327..7406ee69cc55 100644 --- a/java/java-tests/testSrc/com/intellij/roots/ExportingModulesTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/ExportingModulesTest.java @@ -1,6 +1,17 @@ /* - * Copyright (c) 2000-2004 by JetBrains s.r.o. All Rights Reserved. - * Use is subject to license terms. + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.intellij.roots; @@ -36,9 +47,9 @@ public class ExportingModulesTest extends IdeaTestCase { @Override public void run() { final ModifiableModuleModel moduleModel = ModuleManager.getInstance(myProject).getModifiableModel(); - final Module moduleA = moduleModel.newModule("A.iml", StdModuleTypes.JAVA); - final Module moduleB = moduleModel.newModule("B.iml", StdModuleTypes.JAVA); - final Module moduleC = moduleModel.newModule("C.iml", StdModuleTypes.JAVA); + final Module moduleA = moduleModel.newModule("A.iml", StdModuleTypes.JAVA.getId()); + final Module moduleB = moduleModel.newModule("B.iml", StdModuleTypes.JAVA.getId()); + final Module moduleC = moduleModel.newModule("C.iml", StdModuleTypes.JAVA.getId()); moduleModel.commit(); configureModule(moduleA, testRoot, "A"); diff --git a/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java b/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java index 39e9049f68cd..e604800c57c6 100644 --- a/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/MultiModuleEditingTest.java @@ -68,8 +68,8 @@ public class MultiModuleEditingTest extends ModuleTestCase { { final ModifiableModuleModel modifiableModel = moduleManager.getModifiableModel(); - moduleA = modifiableModel.newModule("a.iml", StdModuleTypes.JAVA); - moduleB = modifiableModel.newModule("b.iml", StdModuleTypes.JAVA); + moduleA = modifiableModel.newModule("a.iml", StdModuleTypes.JAVA.getId()); + moduleB = modifiableModel.newModule("b.iml", StdModuleTypes.JAVA.getId()); assertEquals("Changes are not applied until commit", 0, moduleManager.getModules().length); //noinspection SSBasedInspection moduleListener.assertCorrectEvents(new String[0][]); @@ -115,8 +115,8 @@ public class MultiModuleEditingTest extends ModuleTestCase { final Module moduleB; { final ModifiableModuleModel moduleModel = moduleManager.getModifiableModel(); - moduleA = moduleModel.newModule("a.iml", StdModuleTypes.JAVA); - moduleB = moduleModel.newModule("b.iml", StdModuleTypes.JAVA); + moduleA = moduleModel.newModule("a.iml", StdModuleTypes.JAVA.getId()); + moduleB = moduleModel.newModule("b.iml", StdModuleTypes.JAVA.getId()); final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel(); final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel(); rootModelB.addModuleOrderEntry(moduleA); @@ -157,9 +157,9 @@ public class MultiModuleEditingTest extends ModuleTestCase { { final ModifiableModuleModel moduleModel = moduleManager.getModifiableModel(); - moduleA = moduleModel.newModule("a.iml", StdModuleTypes.JAVA); - moduleB = moduleModel.newModule("b.iml", StdModuleTypes.JAVA); - final Module moduleC = moduleModel.newModule("c.iml", StdModuleTypes.JAVA); + moduleA = moduleModel.newModule("a.iml", StdModuleTypes.JAVA.getId()); + moduleB = moduleModel.newModule("b.iml", StdModuleTypes.JAVA.getId()); + final Module moduleC = moduleModel.newModule("c.iml", StdModuleTypes.JAVA.getId()); final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel(); rootModelB.addModuleOrderEntry(moduleC); moduleModel.disposeModule(moduleC); diff --git a/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java b/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java index 04a228641b48..97e7ed4e17a5 100644 --- a/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java +++ b/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -162,7 +162,7 @@ public abstract class ModuleBuilder extends ProjectBuilder{ deleteModuleFile(myModuleFilePath); final ModuleType moduleType = getModuleType(); - final Module module = moduleModel.newModule(myModuleFilePath, moduleType); + final Module module = moduleModel.newModule(myModuleFilePath, moduleType.getId()); final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel(); setupRootModel(modifiableModel); for (ModuleConfigurationUpdater updater : myUpdaters) { diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java index 4faca390161c..e5fe7d6adad2 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java @@ -475,7 +475,7 @@ public class ModuleManagerImpl extends ModuleManager implements ProjectComponent public Module newModule(@NotNull String filePath, @NotNull ModuleType moduleType) { myModificationCount++; final ModifiableModuleModel modifiableModel = getModifiableModel(); - final Module module = modifiableModel.newModule(filePath, moduleType); + final Module module = modifiableModel.newModule(filePath, moduleType.getId()); modifiableModel.commit(); return module; } @@ -688,19 +688,21 @@ public class ModuleManagerImpl extends ModuleManager implements ProjectComponent } @NotNull - public Module newModule(@NotNull String filePath, @NotNull ModuleType moduleType) { - return newModule(filePath,moduleType,null); + public Module newModule(@NotNull String filePath, final String moduleTypeId) { + return newModule(filePath, moduleTypeId, null); } @NotNull - public Module newModule(@NotNull String filePath, @NotNull ModuleType moduleType, @Nullable Map options) { + public Module newModule(@NotNull String filePath, + final String moduleTypeId, + @Nullable Map options) { assertWritable(); filePath = resolveShortWindowsName(filePath); ModuleImpl module = getModuleByFilePath(filePath); if (module == null) { module = new ModuleImpl(filePath, myProject); - module.setOption(Module.ELEMENT_TYPE, moduleType.getId()); + module.setOption(Module.ELEMENT_TYPE, moduleTypeId); if (options != null) { for ( Map.Entry option : options.entrySet()) { module.setOption(option.getKey(),option.getValue()); diff --git a/platform/lang-api/src/com/intellij/openapi/module/ModifiableModuleModel.java b/platform/projectModel-api/src/com/intellij/openapi/module/ModifiableModuleModel.java similarity index 93% rename from platform/lang-api/src/com/intellij/openapi/module/ModifiableModuleModel.java rename to platform/projectModel-api/src/com/intellij/openapi/module/ModifiableModuleModel.java index 4f33e81c9f68..b6c893779ccb 100644 --- a/platform/lang-api/src/com/intellij/openapi/module/ModifiableModuleModel.java +++ b/platform/projectModel-api/src/com/intellij/openapi/module/ModifiableModuleModel.java @@ -43,22 +43,23 @@ public interface ModifiableModuleModel { * bring the changes in effect. * * @param filePath the path at which the module is created. - * @param moduleType the type of the module to create. + * @param moduleTypeId the ID of the module type to create. * @return the module instance. */ - @NotNull Module newModule(@NotNull String filePath, @NotNull ModuleType moduleType); + @NotNull Module newModule(@NotNull String filePath, final String moduleTypeId); /** * Creates a module of the specified type at the specified path and adds it to the project * to which the module manager is related. {@link #commit()} must be called to * bring the changes in effect. * + * * @param filePath the path at which the module is created. - * @param moduleType the type of the module to create. + * @param moduleTypeId ID of the module type to create. * @param options map of module options to be used when creating the module * @return the module instance. */ - @NotNull Module newModule(@NotNull String filePath, @NotNull ModuleType moduleType, @Nullable Map options); + @NotNull Module newModule(@NotNull String filePath, final String moduleTypeId, @Nullable Map options); /** * Loads a module from an .iml file with the specified path and adds it to the project. diff --git a/platform/lang-api/src/com/intellij/openapi/module/ModuleWithNameAlreadyExists.java b/platform/projectModel-api/src/com/intellij/openapi/module/ModuleWithNameAlreadyExists.java similarity index 100% rename from platform/lang-api/src/com/intellij/openapi/module/ModuleWithNameAlreadyExists.java rename to platform/projectModel-api/src/com/intellij/openapi/module/ModuleWithNameAlreadyExists.java diff --git a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java index d8dc84b67e6f..a00f422cd3e4 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java @@ -323,7 +323,7 @@ import java.util.List; @Override protected void run(Result result) throws Throwable { final ModifiableModuleModel moduleModel = ModuleManager.getInstance(project).getModifiableModel(); - String moduleName = moduleModel.newModule(root.getPath() + "/" + name + ".iml", type).getName(); + String moduleName = moduleModel.newModule(root.getPath() + "/" + name + ".iml", type.getId()).getName(); moduleModel.commit(); final Module dep = ModuleManager.getInstance(project).findModuleByName(moduleName); diff --git a/plugins/android/src/org/jetbrains/android/maven/AndroidFacetImporterBase.java b/plugins/android/src/org/jetbrains/android/maven/AndroidFacetImporterBase.java index 7f565fa7993e..2eaa9968d45e 100644 --- a/plugins/android/src/org/jetbrains/android/maven/AndroidFacetImporterBase.java +++ b/plugins/android/src/org/jetbrains/android/maven/AndroidFacetImporterBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -372,7 +372,7 @@ public abstract class AndroidFacetImporterBase extends FacetImporter implement if (modulesDirectory == null) { modulesDirectory = path; } - final Module module = moduleModel.newModule(modulesDirectory + "/" + EclipseProjectFinder.findProjectName(path) + IdeaXml.IML_EXT, StdModuleTypes.JAVA); + final Module module = moduleModel.newModule(modulesDirectory + "/" + EclipseProjectFinder.findProjectName(path) + IdeaXml.IML_EXT, + StdModuleTypes.JAVA.getId()); result.add(module); final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel(); rootModels[idx++] = rootModel; diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/importing/GradleModulesImporter.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/importing/GradleModulesImporter.java index 84d9ee550c4f..08ef34e3d882 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/importing/GradleModulesImporter.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/importing/GradleModulesImporter.java @@ -186,7 +186,7 @@ public class GradleModulesImporter { Application application = ApplicationManager.getApplication(); application.assertWriteAccessAllowed(); final String moduleFilePath = module.getModuleFilePath(); - return model.newModule(moduleFilePath, StdModuleTypes.JAVA); + return model.newModule(moduleFilePath, StdModuleTypes.JAVA.getId()); } /** diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java index a0b2aa5acae7..2f9bd16b5223 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java @@ -557,7 +557,7 @@ public class MvcModuleStructureUtil { } } - moduleModel.newModule(moduleFilePath, StdModuleTypes.JAVA); + moduleModel.newModule(moduleFilePath, StdModuleTypes.JAVA.getId()); moduleModel.commit(); Module pluginsModule = moduleManager.findModuleByName(moduleName); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java index 886cd49ee7e9..d84d6630478d 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jetbrains.plugins.groovy.compiler; import com.intellij.compiler.CompileServerManager; @@ -161,7 +176,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC final VirtualFile depRoot = myFixture.getTempDirFixture().findOrCreateDir(name); final ModifiableModuleModel moduleModel = ModuleManager.getInstance(getProject()).getModifiableModel(); - String moduleName = moduleModel.newModule(depRoot.getPath() + "/" + name + ".iml", StdModuleTypes.JAVA).getName(); + String moduleName = moduleModel.newModule(depRoot.getPath() + "/" + name + ".iml", StdModuleTypes.JAVA.getId()).getName(); moduleModel.commit(); final Module dep = ModuleManager.getInstance(getProject()).findModuleByName(moduleName); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenProjectImporter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenProjectImporter.java index af639dae5c95..56f965a00cb9 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenProjectImporter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenProjectImporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -464,7 +464,7 @@ public class MavenProjectImporter { // have to remove it beforehand. deleteExistingImlFile(path); - final Module module = myModuleModel.newModule(path, project.getModuleType()); + final Module module = myModuleModel.newModule(path, project.getModuleType().getId()); myMavenProjectToModule.put(project, module); myCreatedModules.add(module); return true;