LiveTemplateContextsState () { List<LiveTemplateContextBean> allBeans = LiveTemplateContextBean.EP_NAME.getExtensionList(); Map<String, LiveTemplateContext> allIdsMap = new LinkedHashMap<>(); for (LiveTemplateContextBean bean : allBeans) { allIdsMap.put(bean.getContextId(), bean); } for (LiveTemplateContextProvider provider : LiveTemplateContextProvider.EP_NAME.getExtensionList()) { for (LiveTemplateContext contextType : provider.createContexts()) { allIdsMap.put(contextType.getContextId(), contextType); } } var internalIds = LiveTemplateInternalContextBean.EP_NAME.getExtensionList().stream() .collect(Collectors.toMap(it -> it.internalContextId, it -> it.contextId)); return new LiveTemplateContextsState(allIdsMap, internalIds); }