本文整理汇总了Java中com.intellij.openapi.module.ModuleTypeManager类的典型用法代码示例。如果您正苦于以下问题:Java ModuleTypeManager类的具体用法?Java ModuleTypeManager怎么用?Java ModuleTypeManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModuleTypeManager类属于com.intellij.openapi.module包,在下文中一共展示了ModuleTypeManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGroupTemplates
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
private static List<ArchivedProjectTemplate> createGroupTemplates(Element groupElement) {
return ContainerUtil.mapNotNull(groupElement.getChildren(TEMPLATE), new NullableFunction<Element, ArchivedProjectTemplate>() {
@Override
public ArchivedProjectTemplate fun(final Element element) {
if (!checkRequiredPlugins(element)) {
return null;
}
final ModuleType moduleType = ModuleTypeManager.getInstance().findByID(element.getChildText("moduleType"));
final String path = element.getChildText("path");
final String description = element.getChildTextTrim("description");
String name = element.getChildTextTrim("name");
RemoteProjectTemplate template = new RemoteProjectTemplate(name, element, moduleType, path, description);
template.populateFromElement(element);
return template;
}
});
}
示例2: configureProject
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
@Override
public void configureProject(final Project project, @NotNull final VirtualFile baseDir, final Ref<Module> moduleRef) {
final ModuleManager moduleManager = ModuleManager.getInstance(project);
final Module[] modules = moduleManager.getModules();
if (modules.length == 0) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
String moduleName = baseDir.getName().replace(":", ""); // correct module name when opening root of drive as project (RUBY-5181)
String imlName = baseDir.getPath() + "/.idea/" + moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION;
ModuleTypeManager instance = ModuleTypeManager.getInstance();
String id = instance == null ? "unknown" : instance.getDefaultModuleType().getId();
final Module module = moduleManager.newModule(imlName, id);
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
ModifiableRootModel rootModel = rootManager.getModifiableModel();
if (rootModel.getContentRoots().length == 0) {
rootModel.addContentEntry(baseDir);
}
rootModel.inheritSdk();
rootModel.commit();
moduleRef.set(module);
}
});
}
}
示例3: computeModuleType
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
@NotNull
private static ModuleType computeModuleType(LocalArchivedTemplate template) {
String iml = template.readEntry(new Condition<ZipEntry>() {
@Override
public boolean value(ZipEntry entry) {
return entry.getName().endsWith(".iml");
}
});
if (iml == null) return ModuleType.EMPTY;
try {
Document document = JDOMUtil.loadDocument(iml);
String type = document.getRootElement().getAttributeValue(Module.ELEMENT_TYPE);
return ModuleTypeManager.getInstance().findByID(type);
}
catch (Exception e) {
return ModuleType.EMPTY;
}
}
示例4: configureProject
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
@Override
public void configureProject(final Project project, @NotNull final VirtualFile baseDir, final Ref<Module> moduleRef) {
final ModuleManager moduleManager = ModuleManager.getInstance(project);
final Module[] modules = moduleManager.getModules();
if (modules.length == 0) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
String moduleName = baseDir.getName().replace(":", ""); // correct module name when opening root of drive as project (RUBY-5181)
String imlName = baseDir.getPath() + "/.idea/" + moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION;
final Module module = moduleManager.newModule(imlName, ModuleTypeManager.getInstance().getDefaultModuleType().getId());
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
ModifiableRootModel rootModel = rootManager.getModifiableModel();
if (rootModel.getContentRoots().length == 0) {
rootModel.addContentEntry(baseDir);
}
rootModel.inheritSdk();
rootModel.commit();
moduleRef.set(module);
}
});
}
}
示例5: load
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
@Override
public void load() throws IOException, StateStorageException {
super.load();
final ModuleFileData storageData = getMainStorageData();
final String moduleTypeId = storageData.myOptions.get(Module.ELEMENT_TYPE);
myModule.setOption(Module.ELEMENT_TYPE, ModuleTypeManager.getInstance().findByID(moduleTypeId).getId());
if (ApplicationManager.getApplication().isHeadlessEnvironment() || ApplicationManager.getApplication().isUnitTestMode()) return;
final TrackingPathMacroSubstitutor substitutor = getStateStorageManager().getMacroSubstitutor();
if (substitutor != null) {
final Collection<String> macros = substitutor.getUnknownMacros(null);
if (!macros.isEmpty()) {
final Project project = myModule.getProject();
StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
StorageUtil.notifyUnknownMacros(substitutor, project, null);
}
});
}
}
}
示例6: computeModuleType
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
@NotNull
private static ModuleType computeModuleType(LocalArchivedTemplate template) {
String iml = template.readEntry(".iml");
if (iml == null) return ModuleType.EMPTY;
try {
Document document = JDOMUtil.loadDocument(iml);
String type = document.getRootElement().getAttributeValue(Module.ELEMENT_TYPE);
return ModuleTypeManager.getInstance().findByID(type);
}
catch (Exception e) {
return ModuleType.EMPTY;
}
}
示例7: getInstance
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
public static ProcessingModuleType getInstance() {
return (ProcessingModuleType) ModuleTypeManager.getInstance().findByID(id);
}
示例8: getInstance
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
@NotNull
public static LuaModuleType getInstance() {
return (LuaModuleType) ModuleTypeManager.getInstance().findByID(ID);
}
示例9: getInstance
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
public static CloudSlangModuleType getInstance() {
return (CloudSlangModuleType) ModuleTypeManager.getInstance().findByID(ID);
}
示例10: getInstance
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
public static ArmaModuleType getInstance() {
return (ArmaModuleType) ModuleTypeManager.getInstance().findByID(ID);
}
示例11: isModuleAccepted
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
public boolean isModuleAccepted(final Module module) {
return ModuleTypeManager.getInstance().isClasspathProvider(ModuleType.get(module));
}
示例12: getInstance
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
public static ModuleType getInstance() {
return ModuleTypeManager.getInstance().findByID(PYTHON_MODULE);
}
示例13: getInstance
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
@NotNull
public static PlatformPythonModuleType getInstance() {
return (PlatformPythonModuleType)ModuleTypeManager.getInstance().findByID(PYTHON_MODULE);
}
示例14: getInstance
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
@NotNull
public static SquirrelModuleType getInstance() {
return (SquirrelModuleType)ModuleTypeManager.getInstance().findByID(MODULE_TYPE_ID);
}
示例15: getModuleType
import com.intellij.openapi.module.ModuleTypeManager; //导入依赖的package包/类
public static ModuleType getModuleType() {
return ModuleTypeManager.getInstance().findByID(MODULE_TYPE);
}