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


Java ModifiableModuleModel类代码示例

本文整理汇总了Java中com.intellij.openapi.module.ModifiableModuleModel的典型用法代码示例。如果您正苦于以下问题:Java ModifiableModuleModel类的具体用法?Java ModifiableModuleModel怎么用?Java ModifiableModuleModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModifiableModuleModel类属于com.intellij.openapi.module包,在下文中一共展示了ModifiableModuleModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: moveMavenModulesToGroup

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
private void moveMavenModulesToGroup(
    final Project project,
    final List<Module> mavenModules,
    final String[] rootGroup
) {
    AccessToken token = null;
    final ModifiableModuleModel modifiableModuleModel;
    try {
        token = ApplicationManager.getApplication().acquireReadActionLock();
        modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel();

        for (Module module : mavenModules) {
            module.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.MAVEN.name());
            final String[] groupPath = modifiableModuleModel.getModuleGroupPath(module);
            modifiableModuleModel.setModuleGroupPath(module, ArrayUtils.addAll(rootGroup, groupPath));
        }
    } finally {
        if (token != null) {
            token.finish();
        }
    }
    ApplicationManager.getApplication().invokeAndWait(() -> WriteAction.run(modifiableModuleModel::commit));
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:24,代码来源:DefaultMavenConfigurator.java

示例2: moveGradleModulesToGroup

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
private void moveGradleModulesToGroup(
    final Project project,
    final List<Module> gradleModules,
    final String[] gradleGroup
) {
    final ModifiableModuleModel modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel();

    for (Module module : gradleModules) {
        if (module == null) {
            // https://youtrack.jetbrains.com/issue/IDEA-177512
            continue;
        }
        module.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.GRADLE.name());
        modifiableModuleModel.setModuleGroupPath(module, gradleGroup);
    }
    AccessToken token = null;
    try {
        token = ApplicationManager.getApplication().acquireWriteActionLock(getClass());
        modifiableModuleModel.commit();
    } finally {
        if (token != null) {
            token.finish();
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:DefaultGradleConfigurator.java

示例3: moveEclipseModulesToGroup

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
private void moveEclipseModulesToGroup(
    @NotNull final Project project,
    @NotNull final List<Module> eclipseModules,
    @Nullable final String[] eclipseGroup
) {
    final ModifiableModuleModel modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel();

    for (Module module : eclipseModules) {
        module.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.ECLIPSE.name());
        modifiableModuleModel.setModuleGroupPath(module, eclipseGroup);
    }
    AccessToken token = null;
    try {
        token = ApplicationManager.getApplication().acquireWriteActionLock(getClass());
        modifiableModuleModel.commit();
    } finally {
        if (token != null) {
            token.finish();
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:22,代码来源:DefaultEclipseConfigurator.java

示例4: removeOldProjectData

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
private static void removeOldProjectData(@NotNull final Project project) {
    final ModifiableModuleModel moduleModel = ModuleManager.getInstance(project).getModifiableModel();

    for (Module module : moduleModel.getModules()) {
        moduleModel.disposeModule(module);
    }
    final LibraryTable.ModifiableModel libraryModel = ProjectLibraryTable.getInstance(project).getModifiableModel();

    for (Library library : libraryModel.getLibraries()) {
        libraryModel.removeLibrary(library);
    }
    ApplicationManager.getApplication().runWriteAction(() -> {
        moduleModel.commit();
        libraryModel.commit();
    });
    final GradleSupport gradleSupport = GradleSupport.getInstance();

    if (gradleSupport != null) {
        gradleSupport.clearLinkedProjectSettings(project);
    }
    final AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(project);

    for (AntBuildFile antBuildFile : antConfiguration.getBuildFiles()) {
        antConfiguration.removeBuildFile(antBuildFile);
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:ProjectRefreshAction.java

示例5: commitModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
@Nullable
@Override
public Module commitModule(@NotNull Project project, @Nullable ModifiableModuleModel model) {
  Module module = super.commitModule(project, model);
  if (module == null) {
    return null;
  }
  String languageName = myCourse.getLanguageID();
  Language language = Language.findLanguageByID(languageName);
  if (language == null) {
    return module;
  }
  EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
  if (configurator == null) {
    return module;
  }
  configurator.configureModule(module);
  return module;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:20,代码来源:EduRemoteCourseModuleBuilder.java

示例6: createModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的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

示例7: createCourseFromCourseInfo

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
public static void createCourseFromCourseInfo(@NotNull ModifiableModuleModel moduleModel,
                                       @NotNull Project project,
                                       @NotNull StudyProjectGenerator generator,
                                       @NotNull Course course,
                                       @Nullable String moduleDir) throws JDOMException, ModuleWithNameAlreadyExists, ConfigurationException, IOException {
  generator.setSelectedCourse(course);
  generator.generateProject(project, project.getBaseDir());
  updateAdaptiveCourseTaskFileNames(project, course);

  course = StudyTaskManager.getInstance(project).getCourse();
  if (course == null) {
    LOG.info("failed to generate course");
    return;
  }
  createCourseModuleContent(moduleModel, project, course, moduleDir);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:17,代码来源:EduModuleBuilderUtils.java

示例8: createModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
  Module module = super.createModule(moduleModel);
  Course course = myTask.getLesson().getCourse();
  String directory = getModuleFileDirectory();
  if (directory == null) {
    return module;
  }
  VirtualFile moduleDir = VfsUtil.findFileByIoFile(new File(directory), true);
  if (moduleDir == null) {
    return module;
  }
  VirtualFile src = moduleDir.findChild(EduNames.SRC);
  if (src == null) {
    return module;
  }
  createTask(module.getProject(), course, src);
  ModuleRootModificationUtil.addDependency(module, myUtilModule);
  EduIntellijUtils.addJUnit(module);
  return module;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:23,代码来源:EduTaskModuleBuilder.java

示例9: commitModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
@Nullable
@Override
public Module commitModule(@NotNull Project project, @Nullable ModifiableModuleModel model) {
  Module module = super.commitModule(project, model);
  if (module == null) {
    return null;
  }
  String languageName = mySelectedCourse.getLanguageID();
  Language language = Language.findLanguageByID(languageName);
  if (language == null) {
    return module;
  }
  EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
  if (configurator == null) {
    return module;
  }
  configurator.configureModule(module);
  return module;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:20,代码来源:EduCustomCourseModuleBuilder.java

示例10: createModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的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

示例11: createModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的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

示例12: commit

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
@Nullable
@Override
public List<Module> commit(Project project,
                           ModifiableModuleModel modifiableModuleModel,
                           ModulesProvider modulesProvider,
                           ModifiableArtifactModel modifiableArtifactModel) {

    logger.debug("Initializing module builder instance.");
    ProcessingModuleBuilder processingModuleBuilder = new ProcessingModuleBuilder();
    processingModuleBuilder.setGenerateTemplateSketchClass(false);

    logger.debug("Creating modules for project '" + project + "' at path '" + getParameters().projectCreationRoot + "'.");

    List<Module> modules = processingModuleBuilder.commit(project, modifiableModuleModel, modulesProvider);

    Collection<VirtualFile> importablePdeFiles = new LinkedList<>(getParameters().importablePdeFiles);

    logger.info("Identified a total of " + importablePdeFiles.size() + " PDE files for import from '" + getParameters().root + "'.");

    ImportSketchClasses importSketchClasses = new ImportSketchClasses(this, project, modules, importablePdeFiles);
    DumbService.getInstance(project).smartInvokeLater(importSketchClasses);

    return modules;
}
 
开发者ID:mistodev,项目名称:processing-idea,代码行数:25,代码来源:ProcessingImportBuilder.java

示例13: createModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
private static Module createModule(
        ProjectDescriptor projectDescriptor,
        final ModuleDescriptor descriptor,
        final Map<LibraryDescriptor, Library> projectLibs,
        final ModifiableModuleModel moduleModel) {

    logger.info("Starting createModule in ProjectFromSourcesBuilderImplModified");
    final String moduleFilePath = descriptor.computeModuleFilePath();
    ModuleBuilder.deleteModuleFile(moduleFilePath);

    final Module module =
            moduleModel.newModule(moduleFilePath, descriptor.getModuleType().getId());
    final ModifiableRootModel modifiableModel =
            ModuleRootManager.getInstance(module).getModifiableModel();
    setupRootModel(projectDescriptor, descriptor, modifiableModel, projectLibs);
    descriptor.updateModuleConfiguration(module, modifiableModel);
    modifiableModel.commit();
    logger.info("ending createModule in ProjectFromSourcesBuilderImplModified");
    return module;
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:21,代码来源:ProjectFromSourcesBuilderImplModified.java

示例14: testModuleInIgnoredDir

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
public void testModuleInIgnoredDir() throws IOException {
  final VirtualFile ignored = createChildDirectory(myRootVFile, "RCS");
  assertTrue(FileTypeManager.getInstance().isFileIgnored(ignored));
  
  new WriteCommandAction.Simple(getProject()) {
    @Override
    protected void run() throws Throwable {
      ModuleManager moduleManager = ModuleManager.getInstance(myProject);
      ModifiableModuleModel model = moduleManager.getModifiableModel();
      model.disposeModule(myModule);
      model.disposeModule(myModule2);
      model.disposeModule(myModule3);
      model.commit();
      Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA.getId());
      PsiTestUtil.addContentRoot(module, ignored);
      checkInfo(ignored, module, false, false, null, null);
    }
  }.execute().throwException();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DirectoryIndexTest.java

示例15: setDisplayName

import com.intellij.openapi.module.ModifiableModuleModel; //导入依赖的package包/类
@Override
public void setDisplayName(String name) {
  name = name.trim();
  final ModifiableModuleModel modifiableModuleModel = myConfigurator.getModuleModel();
  if (StringUtil.isEmpty(name)) return; //empty string comes on double click on module node
  if (Comparing.strEqual(name, myModuleName)) return; //nothing changed
  try {
    modifiableModuleModel.renameModule(myModule, name);
  }
  catch (ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
    //do nothing
  }
  myConfigurator.moduleRenamed(myModule, myModuleName, name);
  myModuleName = name;
  myConfigurator.setModified(!Comparing.strEqual(myModuleName, myModule.getName()));
  myContext.getDaemonAnalyzer().queueUpdateForAllElementsWithErrors();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ModuleConfigurable.java


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