WorkspaceEntity (@NotNull MutableEntityStorage diff, @NotNull EntitySource source, @NotNull Project project) { WorkspaceEntity existingEntity = getExistingEntity(diff); if (existingEntity != null) return existingEntity; String moduleName = this.getModuleName(); ModuleOutputPackagingElementEntity addedEntity; if (moduleName != null) { addedEntity = diff.addEntity(ModuleOutputPackagingElementEntity.create(source, entityBuilder -> { entityBuilder.setModule(new ModuleId(moduleName)); return Unit.INSTANCE; })); } else { addedEntity = diff.addEntity(ModuleOutputPackagingElementEntity.create(source)); } diff.getMutableExternalMapping("intellij.artifacts.packaging.elements").addMapping(addedEntity, this); return addedEntity; }