ModuleManager.newModule() also accepts module type ID

This commit is contained in:
Dmitry Jemerov
2012-05-17 13:04:32 +02:00
parent 0acac64246
commit cc7f68e10c
15 changed files with 73 additions and 27 deletions
@@ -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.codeInsight.completion;
import com.intellij.JavaTestUtil;
@@ -211,7 +226,8 @@ public class ClassNameCompletionTest extends CompletionTestCase {
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Exception {
final Module module = ModuleManager.getInstance(getProject()).newModule("second.iml", new JavaModuleType());
final JavaModuleType type = new JavaModuleType();
final Module module = ModuleManager.getInstance(getProject()).newModule("second.iml", type.getId());
createClass(module, "package foo.bar; class AxBxCxDxEx {}");
}
}.execute().throwException();
@@ -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.roots;
import com.intellij.openapi.application.ApplicationManager;
@@ -121,7 +136,7 @@ public class DirectoryIndexImplTest extends IdeaTestCase {
// fill roots of module2
{
VirtualFile moduleFile = myModule2Dir.createChildData(null, "module2.iml");
myModule2 = moduleManager.newModule(moduleFile.getPath(), StdModuleTypes.JAVA);
myModule2 = moduleManager.newModule(moduleFile.getPath(), StdModuleTypes.JAVA.getId());
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule2).getModifiableModel();
ContentEntry contentEntry = rootModel.addContentEntry(myModule2Dir);
@@ -139,7 +154,7 @@ public class DirectoryIndexImplTest extends IdeaTestCase {
// fill roots of module3
{
VirtualFile moduleFile = myModule3Dir.createChildData(null, "module3.iml");
myModule3 = moduleManager.newModule(moduleFile.getPath(), StdModuleTypes.JAVA);
myModule3 = moduleManager.newModule(moduleFile.getPath(), StdModuleTypes.JAVA.getId());
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule3).getModifiableModel();
rootModel.addContentEntry(myModule3Dir);
@@ -295,7 +310,7 @@ public class DirectoryIndexImplTest extends IdeaTestCase {
VirtualFile newModuleContent = myRootVFile.createChildDirectory(null, "newModule");
newModuleContent.createChildDirectory(null, "subDir");
ModuleManager moduleManager = ModuleManager.getInstance(myProject);
Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA);
Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA.getId());
ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
rootModel.addContentEntry(newModuleContent);
rootModel.commit();
@@ -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.
@@ -85,7 +85,7 @@ public abstract class ModuleTestCase extends IdeaTestCase {
new Computable<Module>() {
@Override
public Module compute() {
return ModuleManager.getInstance(myProject).newModule(path, moduleType);
return ModuleManager.getInstance(myProject).newModule(path, moduleType.getId());
}
}
);