Module org.nasdanika.html.ecore
Package org.nasdanika.html.ecore
Class EModelElementActionSupplier<T extends EModelElement>
- java.lang.Object
-
- org.nasdanika.html.ecore.EObjectActionSupplier<T>
-
- org.nasdanika.html.ecore.EModelElementActionSupplier<T>
-
- All Implemented Interfaces:
AutoCloseable,BiFunction<EClass,org.nasdanika.common.ProgressMonitor,org.nasdanika.html.model.app.Action>,org.nasdanika.common.Diagnosable,org.nasdanika.common.ExecutionParticipant,org.nasdanika.common.ExecutionParticipantInfo,org.nasdanika.common.Function<EClass,org.nasdanika.html.model.app.Action>,EcoreActionSupplier
- Direct Known Subclasses:
ENamedElementActionSupplier
public class EModelElementActionSupplier<T extends EModelElement> extends EObjectActionSupplier<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected org.nasdanika.common.Contextcontextprotected intdescriptionTabLengthThresholdDescriptions shorter than this value are put on the top of the tabs, longer ones end up in their own tab.protected Predicate<EModelElement>elementPredicateprotected Comparator<ENamedElement>eNamedElementComparatorprotected Function<EPackage,String>ePackagePathComputerstatic StringICONS_BASEprotected BiFunction<ENamedElement,String,String>labelProvider-
Fields inherited from class org.nasdanika.html.ecore.EObjectActionSupplier
eObject
-
-
Constructor Summary
Constructors Constructor Description EModelElementActionSupplier(T value, org.nasdanika.common.Context context, Function<EPackage,String> ePackagePathComputer, Predicate<EModelElement> elementPredicate, BiFunction<ENamedElement,String,String> labelProvider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidaddContent(org.nasdanika.html.model.app.Action action, String content)Adds textual content.protected static Stringcardinality(ETypedElement typedElement)protected StringcomputeLabel(EGenericType genericType, org.nasdanika.common.ProgressMonitor monitor)StringencodeEPackage(EPackage ePackage)Encodes ePackage path.org.nasdanika.html.model.app.Actionexecute(EClass contextClass, org.nasdanika.common.ProgressMonitor progressMonitor)protected StringgenericName(EGenericType eGenericType)protected StringgenericName(ETypeParameter typeParameter)protected voidgenericType(EGenericType eGenericType, EClassifier contextClassifier, Consumer<String> accumulator, org.nasdanika.common.ProgressMonitor monitor)Generates generic type text with links to classifiers.protected StringgenericTypeArguments(EGenericType eGenericType)protected voidgenericTypeArguments(EGenericType eGenericType, EClassifier contextClassifier, Consumer<String> accumulator, org.nasdanika.common.ProgressMonitor monitor)protected StringgetEModelElementFirstDocSentence(EModelElement modelElement)protected Collection<EClass>getReferrers(EClass eClass)In situations where classes referencing this class are known this method can be overridden.protected Collection<EClass>getUses(EClassifier eClassifier)Finds all type uses in the resourceset.protected voidheader(org.nasdanika.html.model.app.Action action, org.nasdanika.common.ProgressMonitor progressMonitor)Content before documentation.protected org.nasdanika.exec.content.MarkdowninterpolatedMarkdown(String markdown, URI location, org.nasdanika.common.ProgressMonitor progressMonitor)protected Stringlink(EClassifier eClassifier, EClassifier contextClassifier)protected Stringlink(EStructuralFeature feature, EClassifier contextClassifier)Stringname()protected Stringpath(EClassifier eClassifier, EClassifier contextClassifier)protected <M extends EModelElement>
List<M>retainDocumentable(Collection<M> elements)Filters the collection retaining only model elements which shall be documented.doublesize()protected StringtypeParameters(EClassifier eClassifier)-
Methods inherited from class org.nasdanika.html.ecore.EObjectActionSupplier
adaptChild
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.function.BiFunction
andThen
-
-
-
-
Field Detail
-
labelProvider
protected BiFunction<ENamedElement,String,String> labelProvider
-
eNamedElementComparator
protected Comparator<ENamedElement> eNamedElementComparator
-
ICONS_BASE
public static final String ICONS_BASE
- See Also:
- Constant Field Values
-
descriptionTabLengthThreshold
protected int descriptionTabLengthThreshold
Descriptions shorter than this value are put on the top of the tabs, longer ones end up in their own tab.
-
context
protected org.nasdanika.common.Context context
-
ePackagePathComputer
protected Function<EPackage,String> ePackagePathComputer
-
elementPredicate
protected Predicate<EModelElement> elementPredicate
-
-
Constructor Detail
-
EModelElementActionSupplier
public EModelElementActionSupplier(T value, org.nasdanika.common.Context context, Function<EPackage,String> ePackagePathComputer, Predicate<EModelElement> elementPredicate, BiFunction<ENamedElement,String,String> labelProvider)
-
-
Method Detail
-
execute
public org.nasdanika.html.model.app.Action execute(EClass contextClass, org.nasdanika.common.ProgressMonitor progressMonitor)
-
header
protected void header(org.nasdanika.html.model.app.Action action, org.nasdanika.common.ProgressMonitor progressMonitor)
Content before documentation.- Parameters:
action-progressMonitor-
-
size
public double size()
-
interpolatedMarkdown
protected org.nasdanika.exec.content.Markdown interpolatedMarkdown(String markdown, URI location, org.nasdanika.common.ProgressMonitor progressMonitor)
- Parameters:
markdown- Markdown text- Returns:
- Spec for interpolating markdown and then converting to HTML.
-
getEModelElementFirstDocSentence
protected String getEModelElementFirstDocSentence(EModelElement modelElement)
-
getReferrers
protected Collection<EClass> getReferrers(EClass eClass)
In situations where classes referencing this class are known this method can be overridden.- Returns:
-
getUses
protected Collection<EClass> getUses(EClassifier eClassifier)
Finds all type uses in the resourceset.- Returns:
-
cardinality
protected static String cardinality(ETypedElement typedElement)
-
computeLabel
protected String computeLabel(EGenericType genericType, org.nasdanika.common.ProgressMonitor monitor)
-
typeParameters
protected String typeParameters(EClassifier eClassifier)
- Parameters:
eClassifier-- Returns:
- Type parameters string.
-
genericName
protected String genericName(ETypeParameter typeParameter)
-
genericName
protected String genericName(EGenericType eGenericType)
-
genericTypeArguments
protected String genericTypeArguments(EGenericType eGenericType)
-
genericType
protected void genericType(EGenericType eGenericType, EClassifier contextClassifier, Consumer<String> accumulator, org.nasdanika.common.ProgressMonitor monitor)
Generates generic type text with links to classifiers.- Parameters:
eGenericType-accumulator-
-
path
protected String path(EClassifier eClassifier, EClassifier contextClassifier)
- Parameters:
eClassifier-- Returns:
- Relative path to the argument
EClassifieror null if the classifier is not part of the documentation resource set.
-
link
protected String link(EClassifier eClassifier, EClassifier contextClassifier)
- Returns:
- Link to
EClassifierif it is part of the doc or plain text if it is not.
-
link
protected String link(EStructuralFeature feature, EClassifier contextClassifier)
- Returns:
- Link to
EClassifierif it is part of the doc or plain text if it is not.
-
genericTypeArguments
protected void genericTypeArguments(EGenericType eGenericType, EClassifier contextClassifier, Consumer<String> accumulator, org.nasdanika.common.ProgressMonitor monitor)
-
encodeEPackage
public String encodeEPackage(EPackage ePackage)
Encodes ePackage path.- Parameters:
ePackage-- Returns:
-
addContent
protected static void addContent(org.nasdanika.html.model.app.Action action, String content)
Adds textual content.- Parameters:
content-
-
retainDocumentable
protected <M extends EModelElement> List<M> retainDocumentable(Collection<M> elements)
Filters the collection retaining only model elements which shall be documented.- Type Parameters:
M-- Parameters:
elements-- Returns:
-
-