public class HTMLExporter extends ModelExporter
This example shows how the Export API and JET can be used to generate a HTML documentation for Ecore packages.
As any example, this code was NOT extensively tested and is not necessary to cover all the possible nuances of Ecore models.
ModelExporter.EPackageExportInfo, ModelExporter.ExportData, ModelExporter.GenPackagesTreeIterator, ModelExporter.ReferencedGenPackageExportInfoModelConverter.EPackageConvertInfo, ModelConverter.ReferencedEPackageFilter, ModelConverter.ReferencedGenPackageConvertInfodirectoryURI, ePackageToGenPackageMap, GENANNOTATION_KEY_DIRECTORY_URI, GENANNOTATION_SOURCE_PREFIX, GENANNOTATION_SOURCE_SELECTED_EPACKAGES, GENANNOTATION_SOURCE_SELECTED_REFERENCES, genBaseToDetailsMap, saveEPackageArtifactURI, saveExporterePackages, ePackageToInfoMap, externalGenModelList, externalGenModelResourceSet, genModel, referencedEPackageFilter, referencedEPackageFilterToConvert, referencedGenPackages, referencedGenPackageToInfoMap| Constructor and Description |
|---|
HTMLExporter() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
computeClassifierLabel(EClassifier classifier) |
java.lang.String |
computeConstraints(EModelElement modelElement) |
java.lang.String |
computeEKeys(EReference reference) |
java.lang.String |
computeLabel(EClassifier classifier) |
java.lang.String |
computeLabel(EEnumLiteral enumLiteral) |
protected java.lang.String |
computeLabel(EGenericType genericType) |
protected java.lang.String |
computeLabel(ENamedElement namedElement) |
java.lang.String |
computeLabel(EOperation operation) |
java.lang.String |
computeTypedElementLabel(ETypedElement typedElement) |
protected java.lang.String |
computeTypeParameterLabel(ETypeParameter typeParameter) |
protected java.lang.String |
doCheckEPackageArtifactLocation(java.lang.String location,
java.lang.String packageName) |
protected Diagnostic |
doExport(Monitor monitor,
ModelExporter.ExportData exportData)
Subclasses should overwrite this method, adding the code that performs the
actions required to export the model.
|
static java.lang.String |
escape(java.lang.String string) |
GenPackage |
getCurrentGenPackage() |
protected java.lang.String |
getDefaultArtifactLocation(EPackage ePackage) |
protected java.util.List<EStructuralFeature> |
getDefaultEStructuralFeatureDetails() |
java.util.List<EStructuralFeature> |
getDetails(EAttribute attribute)
Returns the list of 'details', ie
EStructuralFeatures, that should
presented for each EAttribute. |
java.util.List<EStructuralFeature> |
getDetails(EClass eClass)
Returns the list of 'details', ie
EStructuralFeatures, that should
presented for each EClass. |
java.util.List<EStructuralFeature> |
getDetails(EDataType dataType)
Returns the list of 'details', ie
EStructuralFeatures, that should
presented for each EDataType. |
java.util.List<EStructuralFeature> |
getDetails(EEnumLiteral enumLiteral)
Returns the list of 'details', ie
EStructuralFeatures, that should
presented for each EEnumLiteral. |
java.util.List<EStructuralFeature> |
getDetails(EOperation operation)
Returns the list of 'details', ie
EStructuralFeatures, that should
presented for each EOperation. |
java.util.List<EStructuralFeature> |
getDetails(EReference reference)
Returns the list of 'details', ie
EStructuralFeatures, that should
presented for each EReference. |
java.lang.String |
getID() |
java.lang.String |
getLongText(java.lang.String string)
Returns a text that is suitable for displaying in HTML.
|
URI |
getPackageArtifacttURI(EPackage ePackage) |
protected void |
save(java.lang.String content) |
adjustGenModel, canConvert, checkEPackageArtifactLocation, computeArtifactURI, createEncodedURI, createEPackageInfo, createEPackagesList, createGenPackageConvertInfo, createReferencedEPackageFilterToConvert, createReferencedGenPackagesList, dispose, export, getArtifactURIs, getConverterGenAnnotationSource, getDefaultArtifactFileName, getDirectoryURI, getEPackageExportInfo, getEPackageToGenPackageMap, getExporterGenAnnotationDetails, getExporterNestedGenAnnotationDetails, getExporterNestedGenAnnotations, getGenBaseToGenAnnotationDetailsMap, getReferencedGenPackageExportInfo, isSaveEPackageArtifactURI, isSaveExporter, isValidEPackage, isValidReferencedGenPackage, loadGenModel, printExportData, save, saveEPackageArtifactURI, saveExporter, setDirectoryURI, setDirectoryURI, setGenModel, setSaveEPackageArtifactURI, setSaveExporter, validateDirectoryURIclearEPackageConvertInfoCache, clearEPackagesCollections, clearReferenceGenPackageConvertInfoCache, computeEPackagesToConvert, computeValidReferencedGenPackages, createExternalGenModelResourceSet, createReferencedEPackageFilter, createResourceSet, filterReferencedEPackages, filterReferencedEPackagesToConvert, getEPackageConvertInfo, getEPackages, getEPackageToInfoMap, getExternalGenModels, getGenModel, getGenmodelSaveOptions, getGenModelSaveOptions, getReferencedGenPackages, getReferencedGenPackageToInfoMap, getReferenceGenPackageConvertInfo, getReferredEPackage, makeEPackageConvertDataUniquepublic static java.lang.String escape(java.lang.String string)
public java.lang.String getID()
getID in class ModelConverterprotected java.lang.String getDefaultArtifactLocation(EPackage ePackage)
getDefaultArtifactLocation in class ModelExporterprotected java.lang.String doCheckEPackageArtifactLocation(java.lang.String location,
java.lang.String packageName)
doCheckEPackageArtifactLocation in class ModelExporterprotected Diagnostic doExport(Monitor monitor, ModelExporter.ExportData exportData) throws java.lang.Exception
ModelExporterSubclasses should overwrite this method, adding the code that performs the actions required to export the model.
The Diagnostic returned by this method should be used to provide
the user some information regarding a successfull export. If the
export fails, an exception should be thrown.
doExport in class ModelExporterDiagnosticjava.lang.Exceptionpublic GenPackage getCurrentGenPackage()
public java.lang.String computeClassifierLabel(EClassifier classifier)
protected java.lang.String computeTypeParameterLabel(ETypeParameter typeParameter)
public java.lang.String computeLabel(EClassifier classifier)
public java.util.List<EStructuralFeature> getDetails(EClass eClass)
EStructuralFeatures, that should
presented for each EClass.EStructuralFeaturespublic java.util.List<EStructuralFeature> getDetails(EDataType dataType)
EStructuralFeatures, that should
presented for each EDataType.EStructuralFeaturesprotected java.lang.String computeLabel(ENamedElement namedElement)
protected java.lang.String computeLabel(EGenericType genericType)
public java.lang.String computeTypedElementLabel(ETypedElement typedElement)
public java.util.List<EStructuralFeature> getDetails(EAttribute attribute)
EStructuralFeatures, that should
presented for each EAttribute.EStructuralFeaturespublic java.util.List<EStructuralFeature> getDetails(EReference reference)
EStructuralFeatures, that should
presented for each EReference.EStructuralFeaturesprotected java.util.List<EStructuralFeature> getDefaultEStructuralFeatureDetails()
public java.lang.String computeEKeys(EReference reference)
public java.lang.String computeLabel(EOperation operation)
public java.util.List<EStructuralFeature> getDetails(EOperation operation)
EStructuralFeatures, that should
presented for each EOperation.EStructuralFeaturespublic java.lang.String computeLabel(EEnumLiteral enumLiteral)
public java.util.List<EStructuralFeature> getDetails(EEnumLiteral enumLiteral)
EStructuralFeatures, that should
presented for each EEnumLiteral.EStructuralFeaturesprotected void save(java.lang.String content)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getLongText(java.lang.String string)
string, checking whether it is already formated for HTML. If it is not, it replaces
line breaks by <br />.string - the string to be analyzedpublic java.lang.String computeConstraints(EModelElement modelElement)