예제 #1
0
  private void createEditors(@Nullable Module module) {
    if (module == null) return;

    ModuleConfigurationState state = createModuleConfigurationState();
    for (ModuleConfigurationEditorProvider provider : collectProviders(module)) {
      ModuleConfigurationEditor[] editors = provider.createEditors(state);
      if (editors.length > 0
          && provider instanceof ModuleConfigurationEditorProviderEx
          && ((ModuleConfigurationEditorProviderEx) provider).isCompleteEditorSet()) {
        myEditors.clear();
        ContainerUtil.addAll(myEditors, editors);
        break;
      } else {
        ContainerUtil.addAll(myEditors, editors);
      }
    }

    for (Configurable moduleConfigurable : ServiceKt.getComponents(module, Configurable.class)) {
      reportDeprecatedModuleEditor(moduleConfigurable.getClass());
      myEditors.add(new ModuleConfigurableWrapper(moduleConfigurable));
    }
    for (ModuleConfigurableEP extension : module.getExtensions(MODULE_CONFIGURABLES)) {
      if (extension.canCreateConfigurable()) {
        Configurable configurable = extension.createConfigurable();
        if (configurable != null) {
          reportDeprecatedModuleEditor(configurable.getClass());
          myEditors.add(new ModuleConfigurableWrapper(configurable));
        }
      }
    }
  }
예제 #2
0
 private static ModuleConfigurationEditorProvider[] collectProviders(@NotNull Module module) {
   List<ModuleConfigurationEditorProvider> result = new ArrayList<>();
   result.addAll(ServiceKt.getComponents(module, ModuleConfigurationEditorProvider.class));
   for (ModuleConfigurationEditorProvider component : result) {
     reportDeprecatedModuleEditor(component.getClass());
   }
   ContainerUtil.addAll(
       result, Extensions.getExtensions(ModuleConfigurationEditorProvider.EP_NAME, module));
   return result.toArray(new ModuleConfigurationEditorProvider[result.size()]);
 }