«check.label» («check.defaultSeverity.name().toLowerCase»)
- «val formattedCheckDescription = check.description.formatDescription»
- «IF formattedCheckDescription !== null»
- «formattedCheckDescription»
- «ENDIF»
-
Message: «check.message.replacePlaceholder»
- «ENDFOR»
- «FOR category:catalog.categories»
-
-
«category.label»
- «val formattedCateogryDescription = category.description.formatDescription»
- «IF formattedCateogryDescription !== null»
- «formattedCateogryDescription»
- «ENDIF»
- «FOR check:category.checks»
-
-
«check.label» («check.defaultSeverity.name().toLowerCase»)
- «val formattedCheckDescription = check.description.formatDescription»
- «IF formattedCheckDescription !== null»
- «formattedCheckDescription»
- «ENDIF»
-
Message: «check.message.replacePlaceholder»
-
- «ENDFOR»
-
- «ENDFOR»
- '''
-
- /*
- * Creates an IssueCodes file for a Check Catalog. Every Check Catalog will have its own file
- * of issue codes.
- */
- def compileIssueCodes(CheckCatalog catalog) {
- val allIssues = catalog.checkAndImplementationIssues // all Issue instances
- val allIssueNames = allIssues.toMap([issue|issue.issueCode()], [issue|issue.issueName()]) // *all* issue names, unordered
-
- '''
- «IF !(catalog.packageName.isNullOrEmpty)»
- package «catalog.packageName»;
- «ENDIF»
-
- /**
- * Issue codes which may be used to address validation issues (for instance in quickfixes).
- */
- @SuppressWarnings("all")
- public final class «catalog.issueCodesClassName» {
-
- «FOR issueCode:allIssueNames.keySet.sort»
- public static final String «issueCode» = "«issueCodeValue(catalog, allIssueNames.get(issueCode))»";
- «ENDFOR»
-
- private «catalog.issueCodesClassName»() {
- // Prevent instantiation.
- }
- }
- '''
- }
-
- /*
- * Generates the Java standalone setup class which will be called by the ServiceRegistry.
- */
- def compileStandaloneSetup(CheckCatalog catalog) {
- '''
- «IF !(catalog.packageName.isNullOrEmpty)»
- package «catalog.packageName»;
- «ENDIF»
-
- import org.apache.logging.log4j.Logger;
- import org.apache.logging.log4j.LogManager;
-
- import com.avaloq.tools.ddk.check.runtime.configuration.ModelLocation;
- import com.avaloq.tools.ddk.check.runtime.registry.ICheckCatalogRegistry;
- import com.avaloq.tools.ddk.check.runtime.registry.ICheckValidatorRegistry;
- import com.avaloq.tools.ddk.check.runtime.registry.ICheckValidatorStandaloneSetup;
-
- /**
- * Standalone setup for «catalog.name» as required by the standalone builder.
- */
- @SuppressWarnings("nls")
- public class «catalog.standaloneSetupClassName» implements ICheckValidatorStandaloneSetup {
-
- private static final Logger LOG = LogManager.getLogger(«catalog.standaloneSetupClassName».class);
- «IF catalog.grammar !== null»
- private static final String GRAMMAR_NAME = "«catalog.grammar.name»";
- «ENDIF»
- private static final String CATALOG_FILE_PATH = "«catalog.checkFilePath»";
-
- @Override
- public void doSetup() {
- ICheckValidatorRegistry.INSTANCE.registerValidator(«IF catalog.grammar !== null»GRAMMAR_NAME,«ENDIF» new «catalog.validatorClassName»());
- ICheckCatalogRegistry.INSTANCE.registerCatalog(«IF catalog.grammar !== null»GRAMMAR_NAME,«ENDIF» new ModelLocation(
- «catalog.standaloneSetupClassName».class.getClassLoader().getResource(CATALOG_FILE_PATH), CATALOG_FILE_PATH));
- LOG.info("Standalone setup done for «catalog.checkFilePath»");
- }
-
- @Override
- public String toString() {
- return "CheckValidatorSetup(«catalog.eResource.URI.path»)";
- }
- }
- '''
- }
-
- /*
- * Writes contents of the service registry file containing fully qualified class names of all validators.
- * See also http://docs.oracle.com/javase/1.4.2/docs/api/javax/imageio/spi/ServiceRegistry.html
- */
- def generateServiceRegistry(CheckCatalog catalog, String serviceRegistryFileName, IFileSystemAccess fsa) {
- val config = (fsa as AbstractFileSystemAccess).outputConfigurations.get(CheckGeneratorConstants::CHECK_REGISTRY_OUTPUT)
- val path = config.outputDirectory + "/" + serviceRegistryFileName
- val contents = catalog.getContents(path)
- contents.add(catalog.qualifiedStandaloneSetupClassName)
- '''
- «FOR c:contents»
- «c»
- «ENDFOR»
- '''
- }
-
- override ITreeAppendable _generateMember(JvmField field, ITreeAppendable appendable, GeneratorConfig config) {
- // Suppress generation of the "artificial" fields for FormalParameters in check impls, but not elsewhere.
- if (field.final && !field.static) { // A bit hacky to use this as the distinction...
- val FormalParameter parameter = compiler.getFormalParameter(field);
- if (parameter !== null) {
- return appendable;
- }
- }
- return super._generateMember(field, appendable, config);
- }
-}
-
diff --git a/com.avaloq.tools.ddk.check.core/src/com/avaloq/tools/ddk/check/standalone/CheckDocApplication.java b/com.avaloq.tools.ddk.check.core/src/com/avaloq/tools/ddk/check/standalone/CheckDocApplication.java
new file mode 100644
index 0000000000..560f3e7908
--- /dev/null
+++ b/com.avaloq.tools.ddk.check.core/src/com/avaloq/tools/ddk/check/standalone/CheckDocApplication.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2026 Avaloq Group AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Avaloq Group AG - initial API and implementation
+ *******************************************************************************/
+package com.avaloq.tools.ddk.check.standalone;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.xtext.resource.XtextResourceSet;
+
+import com.avaloq.tools.ddk.check.CheckStandaloneSetup;
+import com.avaloq.tools.ddk.check.check.CheckCatalog;
+import com.avaloq.tools.ddk.check.generator.CheckDocumentationTemplates;
+import com.avaloq.tools.ddk.check.generator.CheckGenerator;
+import com.google.inject.Injector;
+import com.google.inject.Provider;
+
+
+/**
+ * Eclipse application that emits the full Check documentation tree (HTML pages
+ * plus the Eclipse-Help {@code toc.xml} / {@code contexts.xml}) from every
+ * {@code .check} file under a source directory, without requiring an Eclipse
+ * workbench.
+ *
+ * Arguments (positional): {@code