本文整理汇总了Java中com.intellij.openapi.module.Module.getProject方法的典型用法代码示例。如果您正苦于以下问题:Java Module.getProject方法的具体用法?Java Module.getProject怎么用?Java Module.getProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.module.Module
的用法示例。
在下文中一共展示了Module.getProject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureModule
import com.intellij.openapi.module.Module; //导入方法依赖的package包/类
@Override
public void configureModule(@NotNull Module module) {
final Project project = module.getProject();
StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> {
final VirtualFile baseDir = project.getBaseDir();
final String testHelper = EduNames.TEST_HELPER;
if (baseDir.findChild(testHelper) != null) return;
final FileTemplate template = FileTemplateManager.getInstance(project).getInternalTemplate("test_helper");
final PsiDirectory projectDir = PsiManager.getInstance(project).findDirectory(baseDir);
if (projectDir == null) return;
try {
FileTemplateUtil.createFromTemplate(template, testHelper, null, projectDir);
}
catch (Exception exception) {
LOG.error("Can't copy test_helper.py " + exception.getMessage());
}
});
}
示例2: createModule
import com.intellij.openapi.module.Module; //导入方法依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
String languageName = myCourse.getLanguageID();
Language language = Language.findLanguageByID(languageName);
if (language != null) {
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
if (configurator != null) {
Project project = baseModule.getProject();
myGenerator.setSelectedCourse(myCourse);
myGenerator.generateProject(project, project.getBaseDir());
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
LOG.info("failed to generate course");
return baseModule;
}
configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
}
}
return baseModule;
}
示例3: createModule
import com.intellij.openapi.module.Module; //导入方法依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
if (mySelectedCourse != null) {
String languageName = mySelectedCourse.getLanguageID();
Language language = Language.findLanguageByID(languageName);
if (language != null) {
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
if (configurator != null) {
myGenerator.setSelectedCourse(mySelectedCourse);
Project project = baseModule.getProject();
myGenerator.generateProject(project, project.getBaseDir());
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
LOG.info("failed to generate course");
return baseModule;
}
configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
}
}
}
return baseModule;
}
示例4: createModule
import com.intellij.openapi.module.Module; //导入方法依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
Project project = baseModule.getProject();
EduProjectGenerator generator = new EduProjectGenerator();
if (myCourse == null) {
File courseRoot = StudyUtils.getBundledCourseRoot(DEFAULT_COURSE_NAME, EduKotlinKoansModuleBuilder.class);
final Course course = generator.addLocalCourse(FileUtil.join(courseRoot.getPath(), DEFAULT_COURSE_NAME));
if (course == null) {
LOG.info("Failed to find course " + DEFAULT_COURSE_NAME);
return baseModule;
}
}
myCourse.setLanguage("kotlin");
EduModuleBuilderUtils.createCourseFromCourseInfo(moduleModel, project, generator, myCourse, getModuleFileDirectory());
return baseModule;
}
示例5: createModule
import com.intellij.openapi.module.Module; //导入方法依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
String directory = getModuleFileDirectory();
if (directory == null) {
return baseModule;
}
VirtualFile moduleDir = VfsUtil.findFileByIoFile(new File(directory), true);
if (moduleDir == null) {
return baseModule;
}
VirtualFile src = moduleDir.findChild(EduNames.SRC);
if (src == null) {
return baseModule;
}
Project project = baseModule.getProject();
StartupManager.getInstance(project).registerPostStartupActivity(() -> DumbService.getInstance(project).runWhenSmart(() -> ApplicationManager.getApplication().runWriteAction(() -> {
EduIntellijUtils.addTemplate(project, src, "EduTestRunner.java");
})));
EduIntellijUtils.addJUnit(baseModule);
if (myAdditionalMaterials != null) {
final List<Task> taskList = myAdditionalMaterials.getTaskList();
if (taskList.size() == 1) {
final Task task = taskList.get(0);
for (Map.Entry<String, String> entry : task.getTestsText().entrySet()) {
StudyGenerator.createChildFile(project.getBaseDir(), entry.getKey(), entry.getValue());
}
}
}
return baseModule;
}
示例6: createModule
import com.intellij.openapi.module.Module; //导入方法依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
throws InvalidDataException, IOException, ModuleWithNameAlreadyExists,
JDOMException, ConfigurationException {
Module module = super.createModule(moduleModel);
Project project = module.getProject();
final Course course = new Course();
course.setName(myPanel.getName());
course.setAuthorsAsString(myPanel.getAuthors());
course.setDescription(myPanel.getDescription());
LanguageWrapper wrapper = (LanguageWrapper)myLanguageComboBox.getSelectedItem();
Language language = wrapper.getLanguage();
course.setLanguage(language.getID());
course.setCourseMode(CCUtils.COURSE_MODE);
StudyTaskManager.getInstance(project).setCourse(course);
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
String languageName = language.getDisplayName();
if (configurator == null) {
LOG.error("EduPluginConfigurator for language " + languageName + " not found");
return module;
}
configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> new WriteCommandAction.Simple(project) {
@Override
protected void run() throws Throwable {
PsiDirectory baseDir = PsiManager.getInstance(project).findDirectory(project.getBaseDir());
if (baseDir == null) {
return;
}
PsiDirectory lessonDir = new CCCreateLesson().createItem(null, project, baseDir, course);
if (lessonDir == null) {
LOG.error("Failed to create lesson");
return;
}
new CCCreateTask().createItem(null, project, lessonDir, course);
}
}.execute());
return module;
}
示例7: configureModule
import com.intellij.openapi.module.Module; //导入方法依赖的package包/类
@Override
public void configureModule(@NotNull Module module) {
super.configureModule(module);
Project project = module.getProject();
StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> EduKotlinLibConfigurator.configureLib(project));
}