From a965309737839608006806be734ffa2df2300cee Mon Sep 17 00:00:00 2001 From: Alexander Schulz-Rosengarten Date: Thu, 14 Apr 2022 12:28:11 +0200 Subject: [PATCH 1/4] diagrams: Fixed license in one class --- .../diagram/synthesis/util/ModeDiagrams.java | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/org.lflang.diagram/src/org/lflang/diagram/synthesis/util/ModeDiagrams.java b/org.lflang.diagram/src/org/lflang/diagram/synthesis/util/ModeDiagrams.java index fe31ccac6c..77436059d5 100644 --- a/org.lflang.diagram/src/org/lflang/diagram/synthesis/util/ModeDiagrams.java +++ b/org.lflang.diagram/src/org/lflang/diagram/synthesis/util/ModeDiagrams.java @@ -1,15 +1,27 @@ -/* - * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient - * - * http://rtsys.informatik.uni-kiel.de/kieler - * - * Copyright 2021 by - * + Kiel University - * + Department of Computer Science - * + Real-Time and Embedded Systems Group - * - * This code is provided under the terms of the Eclipse Public License (EPL). - */ +/************* +* Copyright (c) 2021, Kiel University. +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +***************/ package org.lflang.diagram.synthesis.util; From 928e432c35f7abc49e2a3eddb4c026d9f1167192 Mon Sep 17 00:00:00 2001 From: Alexander Schulz-Rosengarten Date: Thu, 14 Apr 2022 13:43:33 +0200 Subject: [PATCH 2/4] diagrams: Improved handling of reaction port adjustment --- .../synthesis/LinguaFrancaSynthesis.java | 89 +++++++++++-------- .../styles/LinguaFrancaShapeExtensions.java | 5 +- 2 files changed, 51 insertions(+), 43 deletions(-) diff --git a/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index f02a9b35ae..5920db07dd 100644 --- a/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -24,38 +24,6 @@ ***************/ package org.lflang.diagram.synthesis; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Multimap; -import com.google.common.collect.Table; -import de.cau.cs.kieler.klighd.DisplayedActionData; -import de.cau.cs.kieler.klighd.SynthesisOption; -import de.cau.cs.kieler.klighd.kgraph.KEdge; -import de.cau.cs.kieler.klighd.kgraph.KLabel; -import de.cau.cs.kieler.klighd.kgraph.KNode; -import de.cau.cs.kieler.klighd.kgraph.KPort; -import de.cau.cs.kieler.klighd.krendering.Colors; -import de.cau.cs.kieler.klighd.krendering.HorizontalAlignment; -import de.cau.cs.kieler.klighd.krendering.KContainerRendering; -import de.cau.cs.kieler.klighd.krendering.KPolyline; -import de.cau.cs.kieler.klighd.krendering.KRectangle; -import de.cau.cs.kieler.klighd.krendering.KRendering; -import de.cau.cs.kieler.klighd.krendering.KRoundedRectangle; -import de.cau.cs.kieler.klighd.krendering.KStyle; -import de.cau.cs.kieler.klighd.krendering.KText; -import de.cau.cs.kieler.klighd.krendering.LineCap; -import de.cau.cs.kieler.klighd.krendering.LineStyle; -import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared; -import de.cau.cs.kieler.klighd.krendering.extensions.KContainerRenderingExtensions; -import de.cau.cs.kieler.klighd.krendering.extensions.KEdgeExtensions; -import de.cau.cs.kieler.klighd.krendering.extensions.KLabelExtensions; -import de.cau.cs.kieler.klighd.krendering.extensions.KNodeExtensions; -import de.cau.cs.kieler.klighd.krendering.extensions.KPolylineExtensions; -import de.cau.cs.kieler.klighd.krendering.extensions.KPortExtensions; -import de.cau.cs.kieler.klighd.krendering.extensions.KRenderingExtensions; -import de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis; -import de.cau.cs.kieler.klighd.util.KlighdProperties; import java.util.ArrayList; import java.util.Collection; import java.util.EnumSet; @@ -65,7 +33,11 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import javax.inject.Inject; + import org.eclipse.elk.alg.layered.options.EdgeStraighteningStrategy; import org.eclipse.elk.alg.layered.options.FixedAlignment; import org.eclipse.elk.alg.layered.options.GreedySwitchType; @@ -97,6 +69,7 @@ import org.lflang.diagram.synthesis.action.FilterCycleAction; import org.lflang.diagram.synthesis.action.MemorizingExpandCollapseAction; import org.lflang.diagram.synthesis.action.ShowCycleAction; +import org.lflang.diagram.synthesis.postprocessor.ReactionPortAdjustment; import org.lflang.diagram.synthesis.styles.LinguaFrancaShapeExtensions; import org.lflang.diagram.synthesis.styles.LinguaFrancaStyleExtensions; import org.lflang.diagram.synthesis.styles.ReactorFigureComponents; @@ -121,6 +94,40 @@ import org.lflang.lf.Reactor; import org.lflang.util.FileUtil; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Iterables; +import com.google.common.collect.Multimap; +import com.google.common.collect.Table; + +import de.cau.cs.kieler.klighd.DisplayedActionData; +import de.cau.cs.kieler.klighd.SynthesisOption; +import de.cau.cs.kieler.klighd.kgraph.KEdge; +import de.cau.cs.kieler.klighd.kgraph.KLabel; +import de.cau.cs.kieler.klighd.kgraph.KNode; +import de.cau.cs.kieler.klighd.kgraph.KPort; +import de.cau.cs.kieler.klighd.krendering.Colors; +import de.cau.cs.kieler.klighd.krendering.HorizontalAlignment; +import de.cau.cs.kieler.klighd.krendering.KContainerRendering; +import de.cau.cs.kieler.klighd.krendering.KPolyline; +import de.cau.cs.kieler.klighd.krendering.KRectangle; +import de.cau.cs.kieler.klighd.krendering.KRendering; +import de.cau.cs.kieler.klighd.krendering.KRoundedRectangle; +import de.cau.cs.kieler.klighd.krendering.KStyle; +import de.cau.cs.kieler.klighd.krendering.KText; +import de.cau.cs.kieler.klighd.krendering.LineCap; +import de.cau.cs.kieler.klighd.krendering.LineStyle; +import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared; +import de.cau.cs.kieler.klighd.krendering.extensions.KContainerRenderingExtensions; +import de.cau.cs.kieler.klighd.krendering.extensions.KEdgeExtensions; +import de.cau.cs.kieler.klighd.krendering.extensions.KLabelExtensions; +import de.cau.cs.kieler.klighd.krendering.extensions.KNodeExtensions; +import de.cau.cs.kieler.klighd.krendering.extensions.KPolylineExtensions; +import de.cau.cs.kieler.klighd.krendering.extensions.KPortExtensions; +import de.cau.cs.kieler.klighd.krendering.extensions.KRenderingExtensions; +import de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis; +import de.cau.cs.kieler.klighd.util.KlighdProperties; + /** * Diagram synthesis for Lingua Franca programs. * @@ -715,7 +722,15 @@ private Collection transformReactorNetwork( setLayoutOption(node, CoreOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); setLayoutOption(node, LayeredOptions.POSITION, new KVector(0, idx + 1)); // try order reactions vertically if in one layer (+1 to account for startup) - _linguaFrancaShapeExtensions.addReactionFigure(node, reaction); + var figure = _linguaFrancaShapeExtensions.addReactionFigure(node, reaction); + + int inputSize = Stream.concat(reaction.triggers.stream(), reaction.sources.stream()).collect(Collectors.toSet()).size(); + int outputSize = reaction.effects.size(); + if (!getBooleanValue(REACTIONS_USE_HYPEREDGES) && (inputSize > 1 || outputSize > 1)) { + // If this node will have more than one input/output port, the port positions must be adjusted to the + // pointy shape. However, this is only possible after the layout. + ReactionPortAdjustment.apply(node, figure); + } // connect input KPort port = null; @@ -725,9 +740,7 @@ private Collection transformReactorNetwork( port = addInvisiblePort(node); setLayoutOption(port, CoreOptions.PORT_SIDE, PortSide.WEST); - int triggersSize = reaction.triggers != null ? reaction.triggers.size() : 0; - int sourcesSize = reaction.sources != null ? reaction.sources.size() : 0; - if (getBooleanValue(REACTIONS_USE_HYPEREDGES) || triggersSize + sourcesSize == 1) { + if (getBooleanValue(REACTIONS_USE_HYPEREDGES) || inputSize == 1) { // manual adjustment disabling automatic one setLayoutOption(port, CoreOptions.PORT_BORDER_OFFSET, (double) -LinguaFrancaShapeExtensions.REACTION_POINTINESS); @@ -774,9 +787,7 @@ private Collection transformReactorNetwork( port = addInvisiblePort(node); setLayoutOption(port, CoreOptions.PORT_SIDE, PortSide.WEST); - int triggersSize = reaction.triggers != null ? reaction.triggers.size() : 0; - int sourcesSize = reaction.sources != null ? reaction.sources.size() : 0; - if (getBooleanValue(REACTIONS_USE_HYPEREDGES) || triggersSize + sourcesSize == 1) { + if (getBooleanValue(REACTIONS_USE_HYPEREDGES) || inputSize == 1) { // manual adjustment disabling automatic one setLayoutOption(port, CoreOptions.PORT_BORDER_OFFSET, (double) -LinguaFrancaShapeExtensions.REACTION_POINTINESS); diff --git a/org.lflang.diagram/src/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java b/org.lflang.diagram/src/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java index f85f70301d..dfc0d1ab60 100644 --- a/org.lflang.diagram/src/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java +++ b/org.lflang.diagram/src/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java @@ -343,10 +343,7 @@ public KPolygon addReactionFigure(KNode node, ReactionInstance reaction) { _kRenderingExtensions.createKPosition(LEFT, REACTION_POINTINESS, 0, BOTTOM, 0, 0.5f) ) ); - - // For a shape like this, ports can only positioned correctly after the layout. - ReactionPortAdjustment.apply(node, baseShape); - + KRectangle contentContainer = _kContainerRenderingExtensions.addRectangle(baseShape); associateWith(contentContainer, reaction); _kRenderingExtensions.setInvisible(contentContainer, true); From 7677b6c752c4149bb76cfd82b73e93abe2f35c89 Mon Sep 17 00:00:00 2001 From: Alexander Schulz-Rosengarten Date: Thu, 14 Apr 2022 15:11:02 +0200 Subject: [PATCH 3/4] diagrams: Added option to display state variables in reactors Is off by default. --- .../synthesis/LinguaFrancaSynthesis.java | 105 ++++++++++++++++-- 1 file changed, 95 insertions(+), 10 deletions(-) diff --git a/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index 5920db07dd..e59320751f 100644 --- a/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -64,6 +64,7 @@ import org.eclipse.xtext.xbase.lib.Pair; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.lflang.ASTUtils; +import org.lflang.InferredType; import org.lflang.diagram.synthesis.action.CollapseAllReactorsAction; import org.lflang.diagram.synthesis.action.ExpandAllReactorsAction; import org.lflang.diagram.synthesis.action.FilterCycleAction; @@ -92,6 +93,7 @@ import org.lflang.lf.Connection; import org.lflang.lf.Model; import org.lflang.lf.Reactor; +import org.lflang.lf.StateVar; import org.lflang.util.FileUtil; import com.google.common.collect.HashBasedTable; @@ -200,7 +202,8 @@ public class LinguaFrancaSynthesis extends AbstractDiagramSynthesis { public static final SynthesisOption SHOW_REACTOR_HOST = SynthesisOption.createCheckOption("Reactor Host Addresses", true).setCategory(APPEARANCE); public static final SynthesisOption SHOW_INSTANCE_NAMES = SynthesisOption.createCheckOption("Reactor Instance Names", false).setCategory(APPEARANCE); public static final SynthesisOption REACTOR_PARAMETER_MODE = SynthesisOption.createChoiceOption("Reactor Parameters", ((List)Conversions.doWrapArray(ReactorParameterDisplayModes.values())), ReactorParameterDisplayModes.NONE).setCategory(APPEARANCE); - public static final SynthesisOption REACTOR_PARAMETER_TABLE_COLS = SynthesisOption.createRangeOption("Reactor Parameter Table Columns", 1, 10, 1).setCategory(APPEARANCE); + public static final SynthesisOption SHOW_STATE_VARIABLES = SynthesisOption.createCheckOption("Reactor State Variables", false).setCategory(APPEARANCE); + public static final SynthesisOption REACTOR_BODY_TABLE_COLS = SynthesisOption.createRangeOption("Reactor Parameter/Variable Columns", 1, 10, 1).setCategory(APPEARANCE); /** Synthesis actions */ public static final DisplayedActionData COLLAPSE_ALL = DisplayedActionData.create(CollapseAllReactorsAction.ID, "Hide all Details"); @@ -227,7 +230,8 @@ public List getDisplayedSynthesisOptions() { SHOW_REACTOR_HOST, SHOW_INSTANCE_NAMES, REACTOR_PARAMETER_MODE, - REACTOR_PARAMETER_TABLE_COLS + SHOW_STATE_VARIABLES, + REACTOR_BODY_TABLE_COLS ); } @@ -342,13 +346,30 @@ private Collection createReactorNode( _kRenderingExtensions.to( _kRenderingExtensions.from( _kRenderingExtensions.setGridPlacementData(rectangle), - _kRenderingExtensions.LEFT, 8, 0, + _kRenderingExtensions.LEFT, 6, 0, _kRenderingExtensions.TOP, 0, 0), - _kRenderingExtensions.RIGHT, 8, 0, + _kRenderingExtensions.RIGHT, 6, 0, _kRenderingExtensions.BOTTOM, 4, 0); _kRenderingExtensions.setHorizontalAlignment(rectangle, HorizontalAlignment.LEFT); addParameterList(rectangle, reactorInstance.parameters); } + + if (getBooleanValue(SHOW_STATE_VARIABLES)) { + var variables = ASTUtils.allStateVars(reactor); + if (!variables.isEmpty()) { + KRectangle rectangle = _kContainerRenderingExtensions.addRectangle(figure); + _kRenderingExtensions.setInvisible(rectangle, true); + _kRenderingExtensions.to( + _kRenderingExtensions.from( + _kRenderingExtensions.setGridPlacementData(rectangle), + _kRenderingExtensions.LEFT, 6, 0, + _kRenderingExtensions.TOP, 0, 0), + _kRenderingExtensions.RIGHT, 6, 0, + _kRenderingExtensions.BOTTOM, 4, 0); + _kRenderingExtensions.setHorizontalAlignment(rectangle, HorizontalAlignment.LEFT); + addStateVariableList(rectangle, variables); + } + } if (reactorInstance.recursive) { nodes.add(addErrorComment(node, TEXT_ERROR_RECURSIVE)); @@ -409,22 +430,49 @@ private Collection createReactorNode( _kRenderingExtensions.to( _kRenderingExtensions.from( _kRenderingExtensions.setGridPlacementData(rectangle), - _kRenderingExtensions.LEFT, 8, 0, + _kRenderingExtensions.LEFT, 6, 0, _kRenderingExtensions.TOP, 0, 0), - _kRenderingExtensions.RIGHT, 8, 0, + _kRenderingExtensions.RIGHT, 6, 0, _kRenderingExtensions.BOTTOM, 4, 0); } else { _kRenderingExtensions.to( _kRenderingExtensions.from( _kRenderingExtensions.setGridPlacementData(rectangle), - _kRenderingExtensions.LEFT, 8, 0, + _kRenderingExtensions.LEFT, 6, 0, _kRenderingExtensions.TOP, 4, 0), - _kRenderingExtensions.RIGHT, 8, 0, + _kRenderingExtensions.RIGHT, 6, 0, _kRenderingExtensions.BOTTOM, 0, 0); } _kRenderingExtensions.setHorizontalAlignment(rectangle, HorizontalAlignment.LEFT); addParameterList(rectangle, instance.parameters); } + + if (getBooleanValue(SHOW_STATE_VARIABLES)) { + var variables = ASTUtils.allStateVars(reactor); + if (!variables.isEmpty()) { + KRectangle rectangle = _kContainerRenderingExtensions.addRectangle(comps.getReactor()); + _kRenderingExtensions.setInvisible(rectangle, true); + if (!getBooleanValue(SHOW_HYPERLINKS)) { + _kRenderingExtensions.to( + _kRenderingExtensions.from( + _kRenderingExtensions.setGridPlacementData(rectangle), + _kRenderingExtensions.LEFT, 6, 0, + _kRenderingExtensions.TOP, 0, 0), + _kRenderingExtensions.RIGHT, 6, 0, + _kRenderingExtensions.BOTTOM, 4, 0); + } else { + _kRenderingExtensions.to( + _kRenderingExtensions.from( + _kRenderingExtensions.setGridPlacementData(rectangle), + _kRenderingExtensions.LEFT, 6, 0, + _kRenderingExtensions.TOP, 4, 0), + _kRenderingExtensions.RIGHT, 6, 0, + _kRenderingExtensions.BOTTOM, 0, 0); + } + _kRenderingExtensions.setHorizontalAlignment(rectangle, HorizontalAlignment.LEFT); + addStateVariableList(rectangle, variables); + } + } if (instance.recursive) { comps.getFigures().forEach(_linguaFrancaStyleExtensions::errorStyle); @@ -1049,7 +1097,7 @@ private String createReactorLabel(ReactorInstance reactorInstance) { private void addParameterList(KContainerRendering container, List parameters) { int cols = 1; try { - cols = getIntValue(REACTOR_PARAMETER_TABLE_COLS); + cols = getIntValue(REACTOR_BODY_TABLE_COLS); } catch (Exception e) {} // ignore if (cols > parameters.size()) { cols = parameters.size(); @@ -1059,13 +1107,14 @@ private void addParameterList(KContainerRendering container, List variables) { + int cols = 1; + try { + cols = getIntValue(REACTOR_BODY_TABLE_COLS); + } catch (Exception e) {} // ignore + if (cols > variables.size()) { + cols = variables.size(); + } + _kContainerRenderingExtensions.setGridPlacement(container, cols); + for (var variable : variables) { + KText varText = _kContainerRenderingExtensions.addText(container, createStateVariableLabel(variable, true)); + _kRenderingExtensions.setFontSize(varText, 8); + _kRenderingExtensions.setHorizontalAlignment(varText, HorizontalAlignment.LEFT); + _kRenderingExtensions.setSurroundingSpaceGrid(varText, 2, 0, 0, 0); + associateWith(varText, variable); + } + } + + private String createStateVariableLabel(StateVar variable, boolean bullet) { + StringBuilder b = new StringBuilder(); + if (bullet) { + b.append("\u229a "); + } + b.append(variable.getName()); + if (variable.getType() != null) { + var t = InferredType.fromAST(variable.getType()); + b.append(":").append(t.toText()); + } + if (!IterableExtensions.isNullOrEmpty(variable.getInit())) { + b.append("("); + b.append(IterableExtensions.join(variable.getInit(), ", ", _utilityExtensions::toText)); + b.append(")"); + } + return b.toString(); + } + private KEdge createDelayEdge(Object associate) { KEdge edge = _kEdgeExtensions.createEdge(); associateWith(edge, associate); From 1fc131102f754420ef2d6364fc2d2fba2e7486d9 Mon Sep 17 00:00:00 2001 From: Alexander Schulz-Rosengarten Date: Wed, 20 Apr 2022 18:40:54 +0200 Subject: [PATCH 4/4] diagrams: Fixed support for target code in initial values. Effective in states variables and parameters. --- .../synthesis/util/UtilityExtensions.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/org.lflang.diagram/src/org/lflang/diagram/synthesis/util/UtilityExtensions.java b/org.lflang.diagram/src/org/lflang/diagram/synthesis/util/UtilityExtensions.java index 0c1c3760a2..fe88a612f7 100644 --- a/org.lflang.diagram/src/org/lflang/diagram/synthesis/util/UtilityExtensions.java +++ b/org.lflang.diagram/src/org/lflang/diagram/synthesis/util/UtilityExtensions.java @@ -24,12 +24,6 @@ ***************/ package org.lflang.diagram.synthesis.util; -import de.cau.cs.kieler.klighd.internal.util.KlighdInternalProperties; -import de.cau.cs.kieler.klighd.kgraph.KGraphElement; -import de.cau.cs.kieler.klighd.kgraph.KGraphFactory; -import de.cau.cs.kieler.klighd.kgraph.KIdentifier; -import de.cau.cs.kieler.klighd.kgraph.KNode; -import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -42,14 +36,20 @@ import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.StringExtensions; -import org.lflang.ASTUtils; import org.lflang.diagram.synthesis.AbstractSynthesisExtensions; import org.lflang.generator.ReactorInstance; import org.lflang.lf.Code; import org.lflang.lf.Host; import org.lflang.lf.Reactor; import org.lflang.lf.Value; +import org.lflang.util.StringUtil; +import de.cau.cs.kieler.klighd.internal.util.KlighdInternalProperties; +import de.cau.cs.kieler.klighd.kgraph.KGraphElement; +import de.cau.cs.kieler.klighd.kgraph.KGraphFactory; +import de.cau.cs.kieler.klighd.kgraph.KIdentifier; +import de.cau.cs.kieler.klighd.kgraph.KNode; +import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared; /** * Extension class that provides various utility methods for the synthesis. @@ -75,7 +75,7 @@ public String toText(Value value) { } else if (value.getLiteral() != null) { return value.getLiteral(); } else if (value.getCode() != null) { - ASTUtils.toText(value.getCode()); + return StringUtil.trimCodeBlock(value.getCode().getBody()); } } return "";