本文整理汇总了Java中com.intellij.openapi.module.ModifiableModuleModel.loadModule方法的典型用法代码示例。如果您正苦于以下问题:Java ModifiableModuleModel.loadModule方法的具体用法?Java ModifiableModuleModel.loadModule怎么用?Java ModifiableModuleModel.loadModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.module.ModifiableModuleModel
的用法示例。
在下文中一共展示了ModifiableModuleModel.loadModule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
final Project project = getEventProject(e);
if (files == null || project == null) return;
try {
final ModifiableModuleModel model = ModuleManager.getInstance(project).getModifiableModel();
for (VirtualFile file : files) {
model.loadModule(file.getPath());
}
AccessToken token = WriteAction.start();
try {
model.commit();
}
finally {
token.finish();
}
}
catch (Exception ex) {
LOG.info(ex);
Messages.showErrorDialog(project, "Cannot import module: " + ex.getMessage(), CommonBundle.getErrorTitle());
}
}
示例2: actionPerformed
import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
final Project project = getEventProject(e);
if (files == null || project == null) return;
try {
final ModifiableModuleModel model = ModuleManager.getInstance(project).getModifiableModel();
for (VirtualFile file : files) {
model.loadModule(file.getPath());
}
AccessToken token = WriteAction.start();
try {
model.commit();
}
finally {
token.finish();
}
}
catch (Exception ex) {
LOG.info(ex);
Messages.showErrorDialog(project, "Cannot import module: " + ex.getMessage(), CommonBundle.getErrorTitle());
}
}
示例3: createModule
import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@NotNull
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
LOG.assertTrue(getName() != null);
final String moduleFilePath = getModuleFilePath();
LOG.assertTrue(moduleFilePath != null);
LOG.assertTrue(new File(moduleFilePath).exists());
return moduleModel.loadModule(moduleFilePath);
}