org.eclipse.emf.exporter.html
Class HTMLExporter

java.lang.Object
  extended by org.eclipse.emf.converter.ModelConverter
      extended by org.eclipse.emf.exporter.ModelExporter
          extended by org.eclipse.emf.exporter.html.HTMLExporter

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.

Since:
2.2.0

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.exporter.ModelExporter
ModelExporter.EPackageExportInfo, ModelExporter.ExportData, ModelExporter.GenPackagesTreeIterator, ModelExporter.ReferencedGenPackageExportInfo
 
Nested classes/interfaces inherited from class org.eclipse.emf.converter.ModelConverter
ModelConverter.EPackageConvertInfo, ModelConverter.ReferencedEPackageFilter, ModelConverter.ReferencedGenPackageConvertInfo
 
Field Summary
 
Fields inherited from class org.eclipse.emf.exporter.ModelExporter
directoryURI, ePackageToGenPackageMap, GENANNOTATION_KEY_DIRECTORY_URI, GENANNOTATION_SOURCE_PREFIX, GENANNOTATION_SOURCE_SELECTED_EPACKAGES, GENANNOTATION_SOURCE_SELECTED_REFERENCES, genBaseToDetailsMap, saveEPackageArtifactURI, saveExporter
 
Fields inherited from class org.eclipse.emf.converter.ModelConverter
ePackages, ePackageToInfoMap, externalGenModelList, externalGenModelResourceSet, genModel, referencedEPackageFilter, referencedEPackageFilterToConvert, referencedGenPackages, referencedGenPackageToInfoMap
 
Constructor Summary
HTMLExporter()
           
 
Method Summary
 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)
           
 
Methods inherited from class org.eclipse.emf.exporter.ModelExporter
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, validateDirectoryURI
 
Methods inherited from class org.eclipse.emf.converter.ModelConverter
clearEPackageConvertInfoCache, clearEPackagesCollections, clearReferenceGenPackageConvertInfoCache, computeEPackagesToConvert, computeValidReferencedGenPackages, createExternalGenModelResourceSet, createReferencedEPackageFilter, createResourceSet, filterReferencedEPackages, filterReferencedEPackagesToConvert, getEPackageConvertInfo, getEPackages, getEPackageToInfoMap, getExternalGenModels, getGenModel, getGenmodelSaveOptions, getGenModelSaveOptions, getReferencedGenPackages, getReferencedGenPackageToInfoMap, getReferenceGenPackageConvertInfo, getReferredEPackage, makeEPackageConvertDataUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLExporter

public HTMLExporter()
Method Detail

escape

public static java.lang.String escape(java.lang.String string)

getID

public java.lang.String getID()
Specified by:
getID in class ModelConverter

getDefaultArtifactLocation

protected java.lang.String getDefaultArtifactLocation(EPackage ePackage)
Overrides:
getDefaultArtifactLocation in class ModelExporter

doCheckEPackageArtifactLocation

protected java.lang.String doCheckEPackageArtifactLocation(java.lang.String location,
                                                           java.lang.String packageName)
Overrides:
doCheckEPackageArtifactLocation in class ModelExporter

doExport

protected Diagnostic doExport(Monitor monitor,
                              ModelExporter.ExportData exportData)
                       throws java.lang.Exception
Description copied from class: ModelExporter

Subclasses 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.

Overrides:
doExport in class ModelExporter
Returns:
Diagnostic
Throws:
java.lang.Exception

getCurrentGenPackage

public GenPackage getCurrentGenPackage()

getPackageArtifacttURI

public URI getPackageArtifacttURI(EPackage ePackage)

computeClassifierLabel

public java.lang.String computeClassifierLabel(EClassifier classifier)

computeTypeParameterLabel

protected java.lang.String computeTypeParameterLabel(ETypeParameter typeParameter)

computeLabel

public java.lang.String computeLabel(EClassifier classifier)

getDetails

public java.util.List<EStructuralFeature> getDetails(EClass eClass)
Returns the list of 'details', ie EStructuralFeatures, that should presented for each EClass.

Returns:
a list of EStructuralFeatures

getDetails

public java.util.List<EStructuralFeature> getDetails(EDataType dataType)
Returns the list of 'details', ie EStructuralFeatures, that should presented for each EDataType.

Returns:
a list of EStructuralFeatures

computeLabel

protected java.lang.String computeLabel(ENamedElement namedElement)

computeLabel

protected java.lang.String computeLabel(EGenericType genericType)

computeTypedElementLabel

public java.lang.String computeTypedElementLabel(ETypedElement typedElement)

getDetails

public java.util.List<EStructuralFeature> getDetails(EAttribute attribute)
Returns the list of 'details', ie EStructuralFeatures, that should presented for each EAttribute.

Returns:
a list of EStructuralFeatures

getDetails

public java.util.List<EStructuralFeature> getDetails(EReference reference)
Returns the list of 'details', ie EStructuralFeatures, that should presented for each EReference.

Returns:
a list of EStructuralFeatures

getDefaultEStructuralFeatureDetails

protected java.util.List<EStructuralFeature> getDefaultEStructuralFeatureDetails()

computeEKeys

public java.lang.String computeEKeys(EReference reference)

computeLabel

public java.lang.String computeLabel(EOperation operation)

getDetails

public java.util.List<EStructuralFeature> getDetails(EOperation operation)
Returns the list of 'details', ie EStructuralFeatures, that should presented for each EOperation.

Returns:
a list of EStructuralFeatures

computeLabel

public java.lang.String computeLabel(EEnumLiteral enumLiteral)

getDetails

public java.util.List<EStructuralFeature> getDetails(EEnumLiteral enumLiteral)
Returns the list of 'details', ie EStructuralFeatures, that should presented for each EEnumLiteral.

Returns:
a list of EStructuralFeatures

save

protected void save(java.lang.String content)
             throws java.io.IOException
Throws:
java.io.IOException

getLongText

public java.lang.String getLongText(java.lang.String string)
Returns a text that is suitable for displaying in HTML. This method analyzes the specified string, checking whether it is already formated for HTML. If it is not, it replaces line breaks by <br />.

Parameters:
string - the string to be analyzed
Returns:
a text that is suitable for displaying in HTML

computeConstraints

public java.lang.String computeConstraints(EModelElement modelElement)

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.