com.intellij.openapi.module.Module.setOption()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中com.intellij.openapi.module.Module.setOption()方法的一些代码示例,展示了Module.setOption()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.setOption()方法的具体详情如下:
包路径:com.intellij.openapi.module.Module
类名称:Module
方法名:setOption

Module.setOption介绍

暂无

代码示例

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

@NotNull
private static EditorNotificationPanel createPanel(@NotNull Project project, @NotNull Module module) {
 EditorNotificationPanel panel = new EditorNotificationPanel();
 panel.setText("'" + module.getName() + "' is not Go Module, some code insight might not work here");
 panel.createActionLabel("Change module type to Go and reload project", () -> {
  int message = Messages.showOkCancelDialog(project, "Updating module type requires project reload. Proceed?", "Update Module Type",
                       "Reload project", "Cancel", null);
  if (message == Messages.YES) {
   module.setOption(Module.ELEMENT_TYPE, GoModuleType.getInstance().getId());
   project.save();
   EditorNotifications.getInstance(project).updateAllNotifications();
   ProjectManager.getInstance().reloadProject(project);
  }
 });
 panel.createActionLabel("Don't show again for this module", () -> {
  Set<String> ignoredModules = getIgnoredModules(project);
  ignoredModules.add(module.getName());
  PropertiesComponent.getInstance(project).setValue(DONT_ASK_TO_CHANGE_MODULE_TYPE_KEY, StringUtil.join(ignoredModules, ","));
  EditorNotifications.getInstance(project).updateAllNotifications();
 });
 return panel;
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

@Override
  public void configure(@NotNull final HybrisModuleDescriptor moduleDescriptor, @NotNull final Module javaModule) {
    final HybrisModuleDescriptorType descriptorType = moduleDescriptor.getDescriptorType();
    javaModule.setOption(HybrisConstants.DESCRIPTOR_TYPE, descriptorType.name());

    final boolean hasReadOnlySettings = moduleDescriptor.getRootProjectDescriptor()
                              .isImportOotbModulesInReadOnlyMode();
    final boolean isReadOnlyType = descriptorType == HybrisModuleDescriptorType.OOTB ||
                    descriptorType == HybrisModuleDescriptorType.PLATFORM ||
                    descriptorType == HybrisModuleDescriptorType.EXT;
    String readOnly = Boolean.valueOf(hasReadOnlySettings && isReadOnlyType).toString();

    javaModule.setOption(HybrisConstants.READ_ONLY, readOnly);
  }
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

private void moveEclipseModulesToGroup(
    @NotNull final Project project,
    @NotNull final List<Module> eclipseModules,
    @NotNull final Map<String,String[]> eclipseGroupMapping
  ) {
    final ModifiableModuleModel modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel();

    for (Module module : eclipseModules) {
      module.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.ECLIPSE.name());
      modifiableModuleModel.setModuleGroupPath(module, eclipseGroupMapping.get(module.getName()));
    }
    AccessToken token = null;
    try {
      token = ApplicationManager.getApplication().acquireWriteActionLock(getClass());
      modifiableModuleModel.commit();
    } finally {
      if (token != null) {
        token.finish();
      }
    }
  }
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

private void moveGradleModulesToGroup(
    final Project project,
    final Module gradleModule,
    final Map<String, String[]> gradleRootGroupMapping
  ) {
    if (gradleModule == null) {
      return;
    }
    final ModifiableModuleModel modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel();

    gradleModule.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.GRADLE.name());
    modifiableModuleModel.setModuleGroupPath(gradleModule, gradleRootGroupMapping.get(gradleModule.getName()));

    ApplicationManager.getApplication().runWriteAction(modifiableModuleModel::commit);
  }
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

private void moveMavenModulesToGroup(
  final @NotNull Project project,
  final @NotNull List<Module> mavenModules,
  final @NotNull Map<String, String[]> mavenGroupMapping
) {
  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(mavenGroupMapping.get(module.getName()), groupPath));
    }
  } finally {
    if (token != null) {
      token.finish();
    }
  }
  ApplicationManager.getApplication().invokeAndWait(() -> WriteAction.run(modifiableModuleModel::commit));
}

代码示例来源:origin: liias/monkey

module.setOption(Module.ELEMENT_TYPE, monkeyModuleType.getId());

相关文章