Skip to content

Commit

Permalink
[SAFRAN-1146] Do not show inactive (precondition=false) representatio…
Browse files Browse the repository at this point in the history
…n descriptions in the M2Doc services help
  • Loading branch information
vrichard12 committed Dec 6, 2023
1 parent 4c3c9d6 commit 8eeaa60
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ <h2>Cinematic Views</h2>
<li><b>Flow Diagram</b> : a flow diagram allowing to represent and edit a flow.</li>
</ul>
</p>
<h3>Diagram Reused Description</h3>
<p>ID:
Reused Description </p>
<p>Layers:<ul>
</ul></p>
<h3>Diagram Flow Diagram</h3>
<p>ID:
Flow Diagram </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ <h2>Database</h2>
<li><b>Schema Diagram</b> : a diagram allowing to represent and edit a schema strucure.</li>
</ul>
</p>
<h3>Diagram Reused Description</h3>
<p>ID:
Reused Description </p>
<p>Layers:<ul>
<li>Default (ID: Default)</lil>
</ul></p>
<h3>Diagram Database Diagram</h3>
<p>ID:
Database Diagram </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ <h2>Graal Methodology</h2>
<li><b>User Stories Table</b> : a cross table showing the assignations of Tasks to User Stories for a System, allowing to create User Stories.</li>
</ul>
</p>
<h3>Diagram Reused Description</h3>
<p>ID:
Reused Description </p>
<p>Layers:<ul>
<li>Default (ID: Default)</lil>
</ul></p>
<h3>Diagram Tasks Graph</h3>
<p>ID:
Tasks Graph </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ <h3>Diagram Component Contract Diagram</h3>
<p>Layers:<ul>
<li>Default Layer (ID: Default Layer)</lil>
<li>Meta Types (ID: MetaTypes)</lil>
</ul></p>
<h3>Diagram Reused Tools</h3>
<p>ID:
Reused Tools </p>
<p>Layers:<ul>
<li>Default (ID: Default)</lil>
</ul></p>
<h3>Diagram DTO Namespaces Hierarchy</h3>
<p>ID:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.sirius.diagram.model.business.internal.helper.LayerModelHelper;
import org.eclipse.sirius.diagram.description.DiagramDescription;
import org.eclipse.sirius.diagram.description.DiagramImportDescription;
import org.eclipse.sirius.diagram.description.Layer;
import org.eclipse.sirius.diagram.model.business.internal.helper.LayerModelHelper;
import org.eclipse.sirius.table.metamodel.table.description.TableDescription;
import org.eclipse.sirius.tree.description.TreeDescription;
import org.eclipse.sirius.viewpoint.description.Group;
Expand Down Expand Up @@ -451,7 +451,7 @@ public static StringBuffer computeIndexBody(String metamodelName, Collection<Cla
if (representation instanceof DiagramImportDescription) {
representation = ((DiagramImportDescription) representation).getImportedDiagram();
}
if (representation instanceof DiagramDescription) {
if (representation instanceof DiagramDescription && !preconditionIsFalse(((DiagramDescription)representation).getPreconditionExpression())) {
if (representation.getLabel() != null) {
buffer.append(" <h3>Diagram " + representation.getLabel() + "</h3>").append(LS);
} else {
Expand All @@ -469,7 +469,7 @@ public static StringBuffer computeIndexBody(String metamodelName, Collection<Cla
}
}
buffer.append(" </ul></p>").append(LS);
} else if (representation instanceof TableDescription) {
} else if (representation instanceof TableDescription && !preconditionIsFalse(((TableDescription)representation).getPreconditionExpression())) {
if (representation.getLabel() != null) {
buffer.append(" <h3>Table " + representation.getLabel() + "</h3>").append(LS);
} else {
Expand All @@ -491,6 +491,14 @@ public static StringBuffer computeIndexBody(String metamodelName, Collection<Cla

return buffer;
}

private static boolean preconditionIsFalse(String precondition) {
if(precondition != null) {
precondition = precondition.trim();
return precondition.equals("aql:false") || precondition.equals("false");
}
return false;
}

private static boolean isRelated(String metamodelName, RepresentationDescription representation) {
return getDomainClass(representation).startsWith(metamodelName.toLowerCase() + ".");
Expand Down

0 comments on commit 8eeaa60

Please sign in to comment.