本文整理匯總了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));
}