Skip to content

Commit

Permalink
Dispays the examples in the usages (online doc)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed Sep 1, 2024
1 parent 771e2cd commit 45808cb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*******************************************************************************************************
*
* GamlAnnotations.java, in gama.annotations, is part of the source code of the GAMA modeling and simulation
* platform .
* GamlAnnotations.java, in gama.annotations, is part of the source code of the GAMA modeling and simulation platform .
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
Expand Down Expand Up @@ -444,7 +443,6 @@ boolean internal()
doc[] doc() default {};
}


/**
*
* The class action. Used to tag a method that will be considered as an action (or primitive) in GAML. The method
Expand Down Expand Up @@ -1096,9 +1094,16 @@ String comment()
* An @usage can also be used for defining a template for a GAML structure, and in that case requires the following
* to be defined :
*
* A name (attribute "name"), optional, but better A description (attribute "value"), optional A menu name
* (attribute "menu"), optional A hierarchical path within this menu (attribute "path"), optional A pattern
* (attribute "pattern" or concatenation of the @example present in "examples" that define "isPattern" as true)
* A name (attribute "name"), optional, but better
*
* A description (attribute "value"), optional
*
* A menu name (attribute "menu"), optional
*
* A hierarchical path within this menu (attribute "path"), optional
*
* A pattern (attribute "pattern" or concatenation of the @example present in "examples" that define "isPattern" as
* true)
*
* (see <code>org.eclipse.jface.text.templates.Template</code>) These templates are then classified and accessible
* during runtime for editing models
Expand Down
14 changes: 11 additions & 3 deletions gama.core/src/gama/gaml/compilation/GamlAddition.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*******************************************************************************************************
*
* GamlAddition.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform
* .
* GamlAddition.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform .
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
Expand All @@ -13,6 +12,7 @@
import java.lang.reflect.AnnotatedElement;

import gama.annotations.precompiler.GamlAnnotations.doc;
import gama.annotations.precompiler.GamlAnnotations.example;
import gama.annotations.precompiler.GamlAnnotations.usage;
import gama.gaml.interfaces.IGamlDescription;

Expand Down Expand Up @@ -76,7 +76,15 @@ public Doc getDocumentation() {
String s = d.value();
if (s != null && !s.isEmpty()) { documentation.append(s).append("<br/>"); }
usage[] usages = d.usages();
for (usage u : usages) { documentation.append(u.value()).append("<br/>"); }
for (usage u : usages) {
documentation.append(u.value()).append("<br/><pre>");
for (example e : u.examples()) {
s = e.value();
if (s != null && !s.isEmpty()) { documentation.append("<t/>&#x09;").append(s).append("<br/>"); }
}
documentation.append("</pre>");

}
s = d.deprecated();
if (s != null && !s.isEmpty()) {
documentation.append("<b>Deprecated</b>: ").append("<i>").append(s).append("</i><br/>");
Expand Down

0 comments on commit 45808cb

Please sign in to comment.