当前位置: 首页>>代码示例>>Java>>正文


Java Module.getProject方法代码示例

本文整理汇总了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());
    }
  });
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:19,代码来源:PyEduPluginConfigurator.java

示例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;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:24,代码来源:EduRemoteCourseModuleBuilder.java

示例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;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:26,代码来源:EduCustomCourseModuleBuilder.java

示例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;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:19,代码来源:EduKotlinKoansModuleBuilder.java

示例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;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:34,代码来源:EduUtilModuleBuilder.java

示例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;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:41,代码来源:EduCCModuleBuilder.java

示例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));
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:7,代码来源:EduKotlinPluginConfigurator.java


注:本文中的com.intellij.openapi.module.Module.getProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。