diff --git a/plugins/de.cau.cs.kieler.kicool.ui/META-INF/MANIFEST.MF b/plugins/de.cau.cs.kieler.kicool.ui/META-INF/MANIFEST.MF index c714d0f6c2..fd2b04d63f 100644 --- a/plugins/de.cau.cs.kieler.kicool.ui/META-INF/MANIFEST.MF +++ b/plugins/de.cau.cs.kieler.kicool.ui/META-INF/MANIFEST.MF @@ -58,6 +58,7 @@ Export-Package: de.cau.cs.kieler.kicool.ui, de.cau.cs.kieler.kicool.ui.quickfix, de.cau.cs.kieler.kicool.ui.synthesis, de.cau.cs.kieler.kicool.ui.synthesis.actions, + de.cau.cs.kieler.kicool.ui.synthesis.colors, de.cau.cs.kieler.kicool.ui.synthesis.feedback, de.cau.cs.kieler.kicool.ui.synthesis.styles, de.cau.cs.kieler.kicool.ui.synthesis.updates, diff --git a/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/klighd/syntheses/CodePlaceHolderSynthesis.xtend b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/klighd/syntheses/CodePlaceHolderSynthesis.xtend index dbb8bcd1ee..c24f407abf 100644 --- a/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/klighd/syntheses/CodePlaceHolderSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/klighd/syntheses/CodePlaceHolderSynthesis.xtend @@ -27,6 +27,8 @@ import de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis import com.google.inject.Inject import static extension de.cau.cs.kieler.klighd.syntheses.DiagramSyntheses.* +import de.cau.cs.kieler.kicool.ui.synthesis.colors.DefaultColorStore +import de.cau.cs.kieler.kicool.ui.synthesis.colors.AbstractColorStore.GeneralColor /** * Diagram synthesis for a {@link CodePlaceHolder}. @@ -49,6 +51,9 @@ class CodePlaceHolderSynthesis extends AbstractDiagramSynthesis @Inject extension KColorExtensions + + @Inject + extension DefaultColorStore // ------------------------------------------------------------------------- // Constants @@ -63,6 +68,8 @@ class CodePlaceHolderSynthesis extends AbstractDiagramSynthesis // Synthesis override KNode transform(CodePlaceHolder placeholder) { val startTime = System.currentTimeMillis + configureAllColors(usedContext) + val rootNode = createNode(); rootNode.children += createNode(placeholder) => [ it.associateWith(placeholder); @@ -70,12 +77,14 @@ class CodePlaceHolderSynthesis extends AbstractDiagramSynthesis it.addRoundedRectangle(8, 8) => [ it.addDoubleClickAction(OpenCodeInEditorAction.ID); it.setGridPlacement(1); + it.foreground = GeneralColor.FOREGROUND.color; // title val titleText = if (placeholder.name.nullOrEmpty) placeholder.typeLabel else placeholder.typeLabel + " - " + placeholder.name it.addText(titleText) => [ it.fontSize = 11; it.fontBold = true; + it.foreground = GeneralColor.FOREGROUND.color; it.setGridPlacementData().from(LEFT, 8, 0, TOP, 4, 0).to(RIGHT, 8, 0, BOTTOM, 4, 0); it.suppressSelectability; ] @@ -90,12 +99,15 @@ class CodePlaceHolderSynthesis extends AbstractDiagramSynthesis ] // separator - it.addHorizontalSeperatorLine(1, 0); + it.addHorizontalSeperatorLine(1, 0) => [ + it.foreground = GeneralColor.FOREGROUND.color; + ] // code preview it.addText(placeholder.code.generatePreview) => [ it.fontSize = 8; it.fontName = KlighdConstants.DEFAULT_MONOSPACE_FONT_NAME; + it.foreground = GeneralColor.FOREGROUND.color; it.setGridPlacementData().from(LEFT, 8, 0, TOP, 4, 0).to(RIGHT, 8, 0, BOTTOM, 4, 0); it.suppressSelectability; it.addDoubleClickAction(OpenCodeInEditorAction.ID); diff --git a/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/CodeContainerSynthesis.xtend b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/CodeContainerSynthesis.xtend index b180e46956..ba90e31669 100644 --- a/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/CodeContainerSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/CodeContainerSynthesis.xtend @@ -21,6 +21,7 @@ import de.cau.cs.kieler.klighd.SynthesisOption import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared import de.cau.cs.kieler.klighd.krendering.extensions.KNodeExtensions import de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis +import de.cau.cs.kieler.klighd.util.KlighdProperties /** * Generic synthesis for strings. @@ -62,6 +63,11 @@ class CodeContainerSynthesis extends AbstractDiagramSynthesis { val cphNode = if (diagramVC.viewModel.children.head.children.nullOrEmpty) diagramVC.viewModel.children.head else diagramVC.viewModel.children.head.children.head + + // transfer canvas color from child context + if (diagramVC.hasProperty(KlighdProperties.CANVAS_COLOR)) { + myViewContext.setProperty(KlighdProperties.CANVAS_COLOR, diagramVC.getProperty(KlighdProperties.CANVAS_COLOR)) + } rootNode.children += cphNode } diff --git a/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/AbstractColorStore.java b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/AbstractColorStore.java new file mode 100644 index 0000000000..c285027599 --- /dev/null +++ b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/AbstractColorStore.java @@ -0,0 +1,189 @@ +/* + * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient + * + * http://rtsys.informatik.uni-kiel.de/kieler + * + * Copyright 2023 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). + */ +package de.cau.cs.kieler.kicool.ui.synthesis.colors; + +import java.awt.Color; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.ecore.util.EcoreUtil; + +import de.cau.cs.kieler.klighd.ViewContext; +import de.cau.cs.kieler.klighd.krendering.Colors; +import de.cau.cs.kieler.klighd.krendering.KColor; +import de.cau.cs.kieler.klighd.krendering.KRenderingFactory; +import de.cau.cs.kieler.klighd.util.ColorPreferences; +import de.cau.cs.kieler.klighd.util.KlighdProperties; + +/** + * A general color store. + * + * @author als + */ +public abstract class AbstractColorStore { + + public interface IColor { + /** + * @return the default color + */ + public KColor getDefaultColor(); + } + + + public enum GeneralColor implements IColor { + FOREGROUND(Colors.BLACK), + BACKGROUND(Colors.WHITE), + HIGHLIGHT(Colors.RED); + + /** the default color */ + private final KColor defaultColor = KRenderingFactory.eINSTANCE.createKColor(); + + /** + * Hidden constructor. + * + * @param red + * the red component of the desired color in range of 0 to 255 + * @param green + * the green component of the desired color in range of 0 to 255 + * @param blue + * the blue component of the desired color in range of 0 to 255 + */ + private GeneralColor(final int red, final int green, final int blue) { + defaultColor.setRed(red); + defaultColor.setGreen(green); + defaultColor.setBlue(blue); + } + + /** + * Hidden constructor. + * + * @param color + * the {@link Colors} color + */ + private GeneralColor(final Colors color) { + defaultColor.setColor(color); + } + + /** + * @return the default color + */ + public KColor getDefaultColor() { + return defaultColor; + } + }; + + private final static KRenderingFactory FACTORY = KRenderingFactory.eINSTANCE; + + /** the configuration */ + private Map configuration = new HashMap(); + + /** + * Configures the entire color store based on the configuration in the view context. + * + * @param context + * the ViewContext + */ + public void configureAllColors(final ViewContext context) { + ColorPreferences preferences = context.getProperty(KlighdProperties.COLOR_PREFERENCES); + if (preferences != null) { + configureColor(GeneralColor.FOREGROUND, preferences.getForeground()); + configureColor(GeneralColor.BACKGROUND, preferences.getBackground()); + configureColor(GeneralColor.HIGHLIGHT, preferences.getHighlight()); + + boolean confirm = configureOwnColors(preferences); + + if (confirm) { + // Complete handshake with Klighd + KColor kBackgroundColor = getColor(GeneralColor.BACKGROUND); + context.setProperty(KlighdProperties.CANVAS_COLOR, new Color(kBackgroundColor.getRed(), kBackgroundColor.getGreen(), kBackgroundColor.getBlue())); + } + } + } + + /** + * Handles the color adjustment for the colors of the deriving class. + * + * @param preferences + * @return true if the color theme was accepted (is supported), false if a fallback to a white + * canvas is requested. + */ + protected abstract boolean configureOwnColors(ColorPreferences preferences); + + /** + * Configures the given color with RGB values. + * + * @param color + * the color to configure + * @param red + * the red component of the desired color in range of 0 to 255 + * @param green + * the green component of the desired color in range of 0 to 255 + * @param blue + * the blue component of the desired color in range of 0 to 255 + */ + public void configureColor(final IColor color, final int red, final int green, final int blue) { + KColor kColor = FACTORY.createKColor(); + kColor.setRed(red); + kColor.setGreen(green); + kColor.setBlue(blue); + configuration.put(color, kColor); + } + + /** + * Configures the given color with a {@link Colors} color. + * + * @param color + * the color to configure + * @param color + * the {@link Colors} color + */ + public void configureColor(final IColor color, final Colors cColor) { + KColor kColor = FACTORY.createKColor(); + kColor.setColor(cColor); + configuration.put(color, kColor); + } + + /** + * Configures the given color with a {@link Colors} color. + * + * @param color + * the color to configure + * @param color + * the {@link KColor} color + */ + public void configureColor(final IColor color, final KColor kColor) { + configuration.put(color, EcoreUtil.copy(kColor)); + } + + /** + * @param color + * the color + * @return a new {@link KColor} for the given color respecting all configurations. + */ + public KColor getColor(IColor color) { + if (configuration.containsKey(color)) { + return EcoreUtil.copy(configuration.get(color)); + } else if (color != null) { + return EcoreUtil.copy(color.getDefaultColor()); + } + return null; + } + + /** + * Resets the entire configuration of the color store to default colors. + * Use with caution! + */ + public void resetAllColors() { + configuration.clear(); + } +} diff --git a/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/ColorUtil.java b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/ColorUtil.java new file mode 100644 index 0000000000..f72d50b617 --- /dev/null +++ b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/ColorUtil.java @@ -0,0 +1,41 @@ +/* + * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient + * + * http://rtsys.informatik.uni-kiel.de/kieler + * + * Copyright 2023 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). + */ +package de.cau.cs.kieler.kicool.ui.synthesis.colors; + +import de.cau.cs.kieler.klighd.krendering.KColor; +import de.cau.cs.kieler.klighd.krendering.KRenderingFactory; + +/** + * @author als + */ +public class ColorUtil { + + private final static KRenderingFactory FACTORY = KRenderingFactory.eINSTANCE; + + /** + * Adjusts the brightness of the given color. + */ + public static KColor adjustBrightness(KColor color, float adjustment) { + var HSB = java.awt.Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); + HSB[2] += adjustment; + HSB[2] = Math.max(0, Math.min(1, HSB[2])); + var RGB = java.awt.Color.getHSBColor(HSB[0],HSB[1],HSB[2]); + + var newColor = FACTORY.createKColor(); + newColor.setRed(RGB.getRed()); + newColor.setGreen(RGB.getGreen()); + newColor.setBlue(RGB.getBlue()); + + return newColor; + } +} diff --git a/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/DefaultColorStore.java b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/DefaultColorStore.java new file mode 100644 index 0000000000..38eb7d9b39 --- /dev/null +++ b/plugins/de.cau.cs.kieler.kicool.ui/src/de/cau/cs/kieler/kicool/ui/synthesis/colors/DefaultColorStore.java @@ -0,0 +1,30 @@ +/* + * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient + * + * http://rtsys.informatik.uni-kiel.de/kieler + * + * Copyright 2023 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). + */ +package de.cau.cs.kieler.kicool.ui.synthesis.colors; + +import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared; +import de.cau.cs.kieler.klighd.util.ColorPreferences; + +/** + * Only the general colors. + * + * @author als + */ +@ViewSynthesisShared +public class DefaultColorStore extends AbstractColorStore { + + @Override + public boolean configureOwnColors(final ColorPreferences preferences) { + return true; + } +} diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/circuit/OperatorExpressionArithmetical.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/circuit/OperatorExpressionArithmetical.kgt index d868cd6dd8..ecdb753abc 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/circuit/OperatorExpressionArithmetical.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/circuit/OperatorExpressionArithmetical.kgt @@ -6,7 +6,6 @@ knode operator { krectangle { styles: lineStyle = solid - foreground = 190r, 190g, 190b } kport in1 { diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Input.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Input.kgt index 548ef37776..35ecac2856 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Input.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Input.kgt @@ -1,19 +1,19 @@ knode source { size: width = 25 height = 12 properties: - org.eclipse.elk.portLabels.placement = INSIDE - org.eclipse.elk.portConstraints = FIXED_ORDER + org.eclipse.elk.portLabels.placement = INSIDE + org.eclipse.elk.portConstraints = FIXED_ORDER - kpolygon { + kpolygon [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { points: - left,top; - right 6,top; - right, top 50%; - right 6, bottom; - left,bottom - styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) + left,top; + right 6,top; + right, top 50%; + right 6, bottom; + left,bottom + styles: lineStyle = solid } kport out { diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/InputOutput.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/InputOutput.kgt index 5bed61d51d..4fdb4e75bd 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/InputOutput.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/InputOutput.kgt @@ -4,7 +4,9 @@ knode source { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - kpolygon { + kpolygon [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { points: left, top 50%; left 6,top; @@ -13,8 +15,6 @@ knode source { right 6, bottom; left 6,bottom styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) fontSize = 4pt } diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Local.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Local.kgt index 352297d0d5..88d612f305 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Local.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Local.kgt @@ -4,7 +4,9 @@ knode source { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - kpolygon { + kpolygon [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { points: left 50%, top; right, top 6; @@ -12,8 +14,6 @@ knode source { left, bottom; left, top 6 styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) fontSize = 4pt } diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpression.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpression.kgt index 6a51393e35..9a296488ef 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpression.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpression.kgt @@ -4,10 +4,10 @@ knode operator { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - krectangle { + krectangle [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) } kport in1 { diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionArithmetical.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionArithmetical.kgt index 574962ef16..8405ad2483 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionArithmetical.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionArithmetical.kgt @@ -4,10 +4,10 @@ knode operator { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - krectangle { + krectangle [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) } kport in1 { diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionCONDITIONAL.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionCONDITIONAL.kgt index ba6424737e..7fe335e677 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionCONDITIONAL.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionCONDITIONAL.kgt @@ -4,14 +4,14 @@ knode operator { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_POS - kpolygon { + kpolygon [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { points: right, top 20%; left,top 0%; left,bottom 0%; right,bottom 20% styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) } kport in1 { @@ -41,7 +41,7 @@ knode operator { kport in0 { pos: x = 6 y = 25 - size: width = 2 height = 2 + size: width = 0 height = 0 properties: org.eclipse.elk.port.side = SOUTH org.eclipse.elk.port.borderOffset = -3.0 org.eclipse.elk.layered.allowNonFlowPortsToSwitchSides = true @@ -56,7 +56,7 @@ knode operator { kport out { pos: x = 14.5 y = 11.5 - size: width = 2 height = 2 + size: width = 0 height = 0 properties: org.eclipse.elk.port.side = EAST diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionINIT.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionINIT.kgt index 6e6da58586..cf1087405b 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionINIT.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionINIT.kgt @@ -4,10 +4,10 @@ knode operator { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - krectangle { + krectangle [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) kpolyline{ gridData: diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionPRE.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionPRE.kgt index 38b8de8457..a607270e0c 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionPRE.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionPRE.kgt @@ -11,10 +11,10 @@ knode operator { } } - krectangle { + krectangle [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) } kport in0 { diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionPRE2.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionPRE2.kgt index 9836776115..90afb0836b 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionPRE2.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionPRE2.kgt @@ -4,10 +4,10 @@ knode operator { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - krectangle { + krectangle [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) krectangle { gridData: diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUPDATE.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUPDATE.kgt index 1f7e870ef8..fb82fa81d6 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUPDATE.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUPDATE.kgt @@ -5,14 +5,14 @@ knode operator { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_POS - kpolygon { + kpolygon [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { points: right, top 25%; left, top 25%; left,bottom 0%; right,bottom 25% styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) } kport in1 { diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUPDATE2.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUPDATE2.kgt index f2df20a0a1..79fe413c91 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUPDATE2.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUPDATE2.kgt @@ -4,10 +4,10 @@ knode operator { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - krectangle { + krectangle [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) kpolyline{ gridData: diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUnary.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUnary.kgt index fb89744581..3c13f09673 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUnary.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/OperatorExpressionUnary.kgt @@ -4,10 +4,10 @@ knode operator { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - krectangle { + krectangle [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) } kport in0 { diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Output.kgt b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Output.kgt index 8a7a911c3d..41887d738b 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Output.kgt +++ b/plugins/de.cau.cs.kieler.sccharts.ui/resources/skins/default/Output.kgt @@ -4,7 +4,9 @@ knode source { org.eclipse.elk.portLabels.placement = INSIDE org.eclipse.elk.portConstraints = FIXED_ORDER - kpolygon { + kpolygon [ + de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts = true + ] { points: right,top; left 6,top; @@ -12,8 +14,6 @@ knode source { left 6, bottom; right,bottom styles: lineStyle = solid - foreground = 190r, 190g, 190b - background = 248r, 249g, 253b, 255a -> 205r, 220g, 243b, 243a (90) fontSize = 4pt } diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/AdaptiveZoom.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/AdaptiveZoom.xtend index fb694c058c..a7f0f7938f 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/AdaptiveZoom.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/AdaptiveZoom.xtend @@ -16,9 +16,11 @@ import de.cau.cs.kieler.annotations.CommentAnnotation import de.cau.cs.kieler.kexpressions.Declaration 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.krendering.KText import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared +import de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis import de.cau.cs.kieler.sccharts.Action import de.cau.cs.kieler.sccharts.Region import de.cau.cs.kieler.sccharts.State @@ -26,7 +28,6 @@ import de.cau.cs.kieler.sccharts.Transition import com.google.inject.Inject import static extension de.cau.cs.kieler.klighd.syntheses.DiagramSyntheses.* -import de.cau.cs.kieler.klighd.kgraph.KLabel /** * @author als @@ -41,8 +42,7 @@ class AdaptiveZoom { static val TUNNEL_EFFECT = 0.85 static val DEFAULT_LOWER_SCALE_BOUND = 0.15 - @Inject - SCChartsSynthesis synthesis + @Inject AbstractDiagramSynthesis synthesis dispatch def configureNodeLOD(KNode node, Region region) { // Create a tunnel effect with regions to benifit from adaptive zoom diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/DataflowRegionSynthesis.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/DataflowRegionSynthesis.xtend index bd4528692c..2ba0189078 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/DataflowRegionSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/DataflowRegionSynthesis.xtend @@ -104,7 +104,7 @@ class DataflowRegionSynthesis extends SubSynthesis { if (CIRCUIT.booleanValue) { node.addLayoutParam(LayeredOptions::CROSSING_MINIMIZATION_SEMI_INTERACTIVE, true) - node.addLayoutParam(LayeredOptions::CROSSING_MINIMIZATION_GREEDY_SWITCH_TYPE, GreedySwitchType::TWO_SIDED) + node.addLayoutParam(LayeredOptions::CROSSING_MINIMIZATION_GREEDY_SWITCH_TYPE, GreedySwitchType::TWO_SIDED) node.setLayoutOption(CoreOptions::SPACING_NODE_NODE, 10d); //10.5 // 8f node.setLayoutOption(CoreOptions::PADDING, new ElkPadding(4d)); diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/EquationSynthesis.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/EquationSynthesis.xtend index 9f4f86694c..732d2d9da7 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/EquationSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/EquationSynthesis.xtend @@ -34,15 +34,22 @@ import de.cau.cs.kieler.kexpressions.keffects.Assignment import de.cau.cs.kieler.kexpressions.kext.DeclarationScope import de.cau.cs.kieler.kexpressions.kext.extensions.KExtDeclarationExtensions import de.cau.cs.kieler.kicool.ui.synthesis.KGTLoader +import de.cau.cs.kieler.kicool.ui.synthesis.colors.AbstractColorStore.GeneralColor import de.cau.cs.kieler.klighd.SynthesisOption import de.cau.cs.kieler.klighd.kgraph.KIdentifier 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.KArc +import de.cau.cs.kieler.klighd.krendering.KBackground import de.cau.cs.kieler.klighd.krendering.KContainerRendering +import de.cau.cs.kieler.klighd.krendering.KEllipse +import de.cau.cs.kieler.klighd.krendering.KForeground import de.cau.cs.kieler.klighd.krendering.KPolygon 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.KText import de.cau.cs.kieler.klighd.krendering.LineStyle import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared @@ -59,6 +66,8 @@ import de.cau.cs.kieler.sccharts.extensions.SCChartsReferenceExtensions import de.cau.cs.kieler.sccharts.extensions.SCChartsSerializeHRExtensions import de.cau.cs.kieler.sccharts.ui.SCChartsUiModule import de.cau.cs.kieler.sccharts.ui.synthesis.actions.ReferenceExpandAction +import de.cau.cs.kieler.sccharts.ui.synthesis.styles.ActorSkins +import de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore import de.cau.cs.kieler.sccharts.ui.synthesis.styles.EquationStyles import de.cau.cs.kieler.sccharts.ui.synthesis.styles.TransitionStyles import java.util.EnumSet @@ -79,10 +88,12 @@ import org.eclipse.elk.core.options.SizeConstraint import org.eclipse.emf.ecore.EObject import static de.cau.cs.kieler.sccharts.ide.synthesis.EquationSynthesisProperties.* +import static de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore.Color.* import static extension de.cau.cs.kieler.annotations.ide.klighd.CommonSynthesisUtil.* import static extension de.cau.cs.kieler.klighd.syntheses.DiagramSyntheses.* import static extension org.eclipse.emf.ecore.util.EcoreUtil.* +import static extension com.google.common.collect.Iterables.concat /** * @author ssm @@ -131,7 +142,6 @@ class EquationSynthesis extends SubSynthesis { @Inject extension KExpressionsValuedObjectExtensions @Inject extension KExpressionsCreateExtensions @Inject extension SCChartsSerializeHRExtensions - @Inject extension SCChartsSynthesis @Inject extension EquationStyles @Inject extension KExtDeclarationExtensions @Inject extension AnnotationsExtensions @@ -141,6 +151,8 @@ class EquationSynthesis extends SubSynthesis { @Inject extension EquationSynthesisHelper @Inject extension EquationSimplification @Inject extension TransitionStyles + @Inject extension ActorSkins + @Inject extension ColorStore @Inject StateSynthesis stateSynthesis val HashMap referenceNodes = newHashMap @@ -308,7 +320,9 @@ class EquationSynthesis extends SubSynthesis { n.addLayoutParam(CoreOptions.NODE_SIZE_MINIMUM, new KVector(0, 0)) n.addLayoutParam(CoreOptions.PADDING, new ElkPadding(0, 0, 0, 0)) } - return nodes.reWireInlining.addMissingReferenceInputs + val finalNodes = nodes.reWireInlining.addMissingReferenceInputs + finalNodes.applyColors() + return finalNodes } /** @@ -901,7 +915,7 @@ class EquationSynthesis extends SubSynthesis { val referenceDeclaration = voRef.valuedObject.declaration as ReferenceDeclaration if (referenceDeclaration.hasAnnotation(ANNOTATION_FIGURE)) { newNode = referenceDeclaration.createKGTNode("OPERATOR", label) - newNode.setProperty(SCChartsSynthesis.SKINPATH, getSkinPath(usedContext)) + newNode.setProperty(ActorSkins.SKINPATH, getSkinPath(usedContext)) newNode.addNodeLabelWithPadding(label, INPUT_OUTPUT_TEXT_SIZE, PADDING_INPUT_LEFT, PADDING_INPUT_RIGHT) newNode.setProperty(REFERENCE_NODE, true) val rendering = newNode.data.filter(KContainerRendering).head @@ -918,7 +932,7 @@ class EquationSynthesis extends SubSynthesis { if (referenceDeclaration.reference !== null && referenceDeclaration.reference.asAnnotatable.hasAnnotation(ANNOTATION_FIGURE)) { newNode = referenceDeclaration.reference.createKGTNode("OPERATOR", label) - newNode.setProperty(SCChartsSynthesis.SKINPATH, getSkinPath(usedContext)) + newNode.setProperty(ActorSkins.SKINPATH, getSkinPath(usedContext)) newNode.addNodeLabelWithPadding(label, INPUT_OUTPUT_TEXT_SIZE, PADDING_INPUT_LEFT, PADDING_INPUT_RIGHT) newNode.setProperty(REFERENCE_NODE, true) val rendering = newNode.data.filter(KContainerRendering).head @@ -967,7 +981,7 @@ class EquationSynthesis extends SubSynthesis { EnumSet.of(SizeConstraint.PORTS, SizeConstraint.PORT_LABELS, SizeConstraint.MINIMUM_SIZE, SizeConstraint.NODE_LABELS )) - newNode.setProperty(SCChartsSynthesis.SKINPATH, getSkinPath(usedContext)) + newNode.setProperty(ActorSkins.SKINPATH, getSkinPath(usedContext)) newNode.setProperty(REFERENCE_NODE, true) return newNode } @@ -1159,20 +1173,97 @@ class EquationSynthesis extends SubSynthesis { if (portLabel !== null) { port.labels.remove(0) } - port.createLabel().configureOutsidePortLabel(label, PORT_LABEL_FONT_SIZE) + port.createLabel() => [ + it.configureOutsidePortLabel(label, PORT_LABEL_FONT_SIZE) + it.KRendering.foreground = TRANSITION_LABEL_FOREGROND.color + ] } else { if (portLabel !== null) { port.labels.remove(0) } - port.createLabel().configureInsidePortLabel(label, PORT_LABEL_FONT_SIZE) + port.createLabel() => [ + it.configureInsidePortLabel(label, PORT_LABEL_FONT_SIZE) + it.KRendering.foreground = TRANSITION_LABEL_FOREGROND.color + ] } } } else { if (portLabel === null) { - port.createLabel.configureInsidePortLabel(label, PORT_LABEL_FONT_SIZE) + port.createLabel() => [ + it.configureInsidePortLabel(label, PORT_LABEL_FONT_SIZE) + it.KRendering.foreground = TRANSITION_LABEL_FOREGROND.color + ] } else { portLabel.text = label } } } + + private def void applyColors(List nodes) { + val allNodes = newArrayList() + allNodes += nodes + for (n : nodes) { + allNodes += n.eAllContents.filter(KNode).toIterable + } + + for (node : allNodes) { + for (rendering : node.data.filter(KRendering)) { + rendering.applyColors() + } + for (edge : node.outgoingEdges) { + for (rendering : edge.data.filter(KRendering)) { + rendering.applyColors() + } + for (label : edge.labels) { + if (label.KRendering !== null) { + label.KRendering.applyColors() + } + } + } + for (label : node.labels.concat(node.ports.map[labels].flatten)) { + if (label.KRendering !== null) { + label.KRendering.applyColors() + } + } + } + } + + private def void applyColors(KRendering rendering) { + switch (rendering) { + KText: { + if (!rendering.styles.exists[it instanceof KForeground]) { + rendering.foreground = STATE_TEXT_FOREGROUND.color + } + } + KArc, + KEllipse, + KPolyline, + KRectangle, + KRoundedRectangle: { + if (rendering.hasProperty(ActorSkins.SKIN_STYLE_KEY_SCCHARTS)) { + // Apply SCCharts state style + rendering.foreground = STATE_FOREGROUND.color + rendering.setBackgroundGradient( + STATE_BACKGROUND_GRADIENT_1.color, + STATE_BACKGROUND_GRADIENT_2.color, + 90 + ); + } else { + if (!rendering.styles.exists[it instanceof KForeground]) { + rendering.foreground = GeneralColor.FOREGROUND.color + } + if (!rendering.styles.exists[it instanceof KBackground]) { + rendering.background = GeneralColor.BACKGROUND.color + } + } + } + } + + // continue recursive + if (rendering instanceof KContainerRendering) { + for (child : rendering.children) { + child.applyColors() + } + } + } } diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/SCChartsSynthesis.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/SCChartsSynthesis.xtend index 185c9493fa..b65ff3e3df 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/SCChartsSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/SCChartsSynthesis.xtend @@ -20,7 +20,6 @@ import de.cau.cs.kieler.kexpressions.VariableDeclaration import de.cau.cs.kieler.kicool.compilation.Compile import de.cau.cs.kieler.kicool.ide.klighd.KiCoDiagramViewProperties import de.cau.cs.kieler.klighd.LightDiagramServices -import de.cau.cs.kieler.klighd.ViewContext import de.cau.cs.kieler.klighd.internal.util.SourceModelTrackingAdapter import de.cau.cs.kieler.klighd.kgraph.KNode import de.cau.cs.kieler.klighd.krendering.Colors @@ -39,6 +38,8 @@ import de.cau.cs.kieler.sccharts.extensions.SCChartsInheritanceExtensions import de.cau.cs.kieler.sccharts.extensions.SCChartsScopeExtensions import de.cau.cs.kieler.sccharts.extensions.SCChartsSerializeHRExtensions import de.cau.cs.kieler.sccharts.ui.synthesis.hooks.SynthesisHooks +import de.cau.cs.kieler.sccharts.ui.synthesis.styles.ActorSkins +import de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore import de.cau.cs.kieler.sccharts.ui.synthesis.styles.TransitionStyles import java.util.HashMap import java.util.LinkedHashSet @@ -51,8 +52,6 @@ import org.eclipse.elk.core.options.CoreOptions import org.eclipse.elk.core.options.Direction import org.eclipse.elk.core.service.util.CompoundGraphElementVisitor import org.eclipse.elk.core.util.IGraphElementVisitor -import org.eclipse.elk.graph.properties.IProperty -import org.eclipse.elk.graph.properties.Property import static de.cau.cs.kieler.sccharts.ui.synthesis.GeneralSynthesisOptions.* import de.cau.cs.kieler.klighd.filtering.SemanticFilterRule @@ -79,6 +78,8 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis { @Inject extension PragmaExtensions @Inject extension TransitionStyles @Inject extension KPolylineExtensions + @Inject extension ColorStore + @Inject extension ActorSkins @Inject StateSynthesis stateSynthesis @Inject ControlflowRegionSynthesis controlflowSynthesis @Inject DataflowRegionSynthesis dataflowSynthesis @@ -88,9 +89,6 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis { @Inject PolicySynthesis policySynthesis @Inject package SynthesisHooks hooks - - public static final IProperty SKINPATH = new Property( - "de.cau.cs.kieler.sccharts.ui.synthesis.skinPath", ""); static val PRAGMA_SYMBOLS = "symbols" static val PRAGMA_SYMBOL = "symbol" @@ -99,7 +97,7 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis { static val PRAGMA_SYMBOLS_MATH_SCRIPT = "math script" static val PRAGMA_SYMBOLS_MATH_FRAKTUR = "math fraktur" static val PRAGMA_SYMBOLS_MATH_DOUBLESTRUCK = "math doublestruck" - static val PRAGMA_FONT = "font" + static val PRAGMA_FONT = "font" static val PRAGMA_SKINPATH = "skinpath" static val PRAGMA_HIDE_IMPORTED_SCCHARTS = "HideImportedSCCharts" @@ -151,7 +149,7 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis { return options.toList } - + override transform(SCCharts sccharts) { val startTime = System.currentTimeMillis @@ -178,7 +176,10 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis { // If dot is used draw edges first to prevent overlapping with states when layout is bad usedContext.setProperty(KlighdProperties.EDGES_FIRST, !USE_KLAY.booleanValue) - clearSymbols + // Configure color theme (before start to allow for changes by hooks) + configureAllColors(usedContext) + + clearSymbols() for(symbolTable : scc.getStringPragmas(PRAGMA_SYMBOLS)) { var prefix = "" if (symbolTable.values.size > 1) prefix = symbolTable.values.get(1) @@ -187,7 +188,7 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis { if (symbolTable.values.head.equals(PRAGMA_SYMBOLS_MATH_SCRIPT)) { defineMathScriptSymbols(prefix) } if (symbolTable.values.head.equals(PRAGMA_SYMBOLS_MATH_FRAKTUR)) { defineMathFrakturSymbols(prefix) } if (symbolTable.values.head.equals(PRAGMA_SYMBOLS_MATH_DOUBLESTRUCK)) { defineMathDoubleStruckSymbols(prefix) } - } + } for(symbol : scc.getStringPragmas(PRAGMA_SYMBOL)) { symbol.values.head.defineSymbol(symbol.values.get(1)) } @@ -338,23 +339,6 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis { } } - def String getSkinPath(ViewContext context) { - val rootNode = context.viewModel - var sp = rootNode.getProperty(SKINPATH) - if (sp.nullOrEmpty) { - sp = context.getProperty(SKINPATH) - if (!sp.nullOrEmpty) { - sp.setSkinPath(context) - } - } - return sp - } - - def void setSkinPath(String sp, ViewContext context) { - val rootNode = context.viewModel - rootNode.setProperty(SKINPATH, sp) - } - override List getAdditionalLayoutConfigs(KNode viewModel) { val List additionalLayoutRuns = newArrayList // Add interactive Layout run. diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/ScopeSynthesis.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/ScopeSynthesis.xtend index 2823dac6dd..1fe7889545 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/ScopeSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/ScopeSynthesis.xtend @@ -22,6 +22,7 @@ import de.cau.cs.kieler.sccharts.ControlflowRegion import de.cau.cs.kieler.sccharts.Scope import de.cau.cs.kieler.sccharts.State import de.cau.cs.kieler.sccharts.ui.synthesis.hooks.SynthesisHooks +import de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore import java.util.LinkedHashSet import static de.cau.cs.kieler.sccharts.ui.synthesis.GeneralSynthesisOptions.* @@ -38,6 +39,7 @@ import static de.cau.cs.kieler.sccharts.ui.synthesis.GeneralSynthesisOptions.* class ScopeSynthesis extends AbstractDiagramSynthesis { @Inject extension KNodeExtensions + @Inject extension ColorStore @Inject StateSynthesis stateSynthesis @Inject DataflowRegionSynthesis dataflowSynthesis @@ -68,6 +70,9 @@ class ScopeSynthesis extends AbstractDiagramSynthesis { override transform(Scope root) { val rootNode = createNode + + // Configure color theme (before start to allow for changes by hooks) + configureAllColors(usedContext) hooks.invokeStart(root, rootNode) diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/actions/ReferenceExpandAction.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/actions/ReferenceExpandAction.xtend index 7046054b6f..51ff35140a 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/actions/ReferenceExpandAction.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/actions/ReferenceExpandAction.xtend @@ -24,7 +24,7 @@ import de.cau.cs.kieler.klighd.util.KlighdSynthesisProperties import de.cau.cs.kieler.sccharts.Region import de.cau.cs.kieler.sccharts.State import de.cau.cs.kieler.sccharts.extensions.SCChartsScopeExtensions -import de.cau.cs.kieler.sccharts.ui.synthesis.SCChartsSynthesis +import de.cau.cs.kieler.sccharts.ui.synthesis.styles.ActorSkins import org.eclipse.elk.graph.properties.MapPropertyHolder /** @@ -76,7 +76,7 @@ class ReferenceExpandAction extends CollapseExpandAction { context.getKNode.data += node.data } } else if (modelElement instanceof ValuedObjectReference) { - val propagatedSkinPath = context.KNode.getProperty(SCChartsSynthesis.SKINPATH) + val propagatedSkinPath = context.KNode.getProperty(ActorSkins.SKINPATH) val declaration = modelElement.valuedObject.eContainer if (declaration instanceof ReferenceDeclaration) { @@ -85,7 +85,7 @@ class ReferenceExpandAction extends CollapseExpandAction { context.viewContext, new MapPropertyHolder => [ setProperty(KlighdSynthesisProperties.REQUESTED_DIAGRAM_SYNTHESIS, "de.cau.cs.kieler.sccharts.ui.synthesis.ScopeSynthesis") - setProperty(SCChartsSynthesis.SKINPATH, propagatedSkinPath) + setProperty(ActorSkins.SKINPATH, propagatedSkinPath) ] ) var extractedDataflow = diagram.children.head.children diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/hooks/BlackWhiteModeHook.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/hooks/BlackWhiteModeHook.xtend index 6928a62491..13a18879e4 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/hooks/BlackWhiteModeHook.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/hooks/BlackWhiteModeHook.xtend @@ -19,13 +19,14 @@ import de.cau.cs.kieler.klighd.kgraph.KNode import de.cau.cs.kieler.klighd.krendering.Colors import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared import de.cau.cs.kieler.klighd.krendering.extensions.KRenderingExtensions +import de.cau.cs.kieler.klighd.util.KlighdProperties import de.cau.cs.kieler.sccharts.Scope import de.cau.cs.kieler.sccharts.State -import de.cau.cs.kieler.sccharts.ui.synthesis.hooks.SynthesisHook import de.cau.cs.kieler.sccharts.ui.synthesis.GeneralSynthesisOptions import de.cau.cs.kieler.sccharts.ui.synthesis.StateSynthesis import de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore import de.cau.cs.kieler.sccharts.ui.synthesis.styles.StateStyles +import java.awt.Color import static de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore.Color.* @@ -33,8 +34,6 @@ import static de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore.Color.* * Applies paper color theme. * * @author als - * @kieler.design 2015-08-13 proposed - * @kieler.rating 2015-08-13 proposed yellow * */ @ViewSynthesisShared @@ -62,11 +61,14 @@ class BlackWhiteModeHook extends SynthesisHook { override start(Scope scope, KNode root) { if (PAPER_BW.booleanValue) { + // Reset to light theme + resetAllColors(); + configureColor(TRANSITION_DEFERRED_DECORATOR, Colors.GRAY); configureColor(TRANSITION_ABORT_DECORATOR, Colors.GRAY); configureColor(TRANSITION_TERMINATION_DECORATOR, Colors.GRAY); - configureColor(STATE_FOREGROND, Colors.BLACK); + configureColor(STATE_FOREGROUND, Colors.BLACK); configureColor(STATE_BACKGROUND_GRADIENT_1, Colors.GRAY_95); configureColor(STATE_BACKGROUND_GRADIENT_2, Colors.GRAY_95); configureColor(STATE_REFERENCED_BACKGROUND_GRADIENT_1, Colors.GRAY_97); @@ -75,6 +77,9 @@ class BlackWhiteModeHook extends SynthesisHook { configureColor(KEYWORD, Colors.DIM_GRAY); baseLineWidth = 2; + + // Set canvas to white + usedContext.setProperty(KlighdProperties.CANVAS_COLOR, new Color(255, 255, 255)); } } diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/hooks/LabelPlacementSideHook.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/hooks/LabelPlacementSideHook.xtend index 0cc76d070c..b809d26cca 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/hooks/LabelPlacementSideHook.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/hooks/LabelPlacementSideHook.xtend @@ -89,7 +89,8 @@ class LabelPlacementSideHook extends SynthesisHook { // Colors we shall use val foregroundKColor = REGION_FOREGROUND.color val foreground = new Color(foregroundKColor.red, foregroundKColor.green, foregroundKColor.blue); - val background = new Color(255, 255, 255, 220); + val backgroundKColor = REGION_BACKGROUND.color + val background = new Color(backgroundKColor.red, backgroundKColor.green, backgroundKColor.blue, 220); // Create and properly configure an inline label configurator that will do most of our work for us val inlineLabelConfigurator = LabelDecorationConfigurator.create.withInlineLabels(true) diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/ActorSkins.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/ActorSkins.xtend new file mode 100644 index 0000000000..7ffd06777e --- /dev/null +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/ActorSkins.xtend @@ -0,0 +1,48 @@ +/* + * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient + * + * http://rtsys.informatik.uni-kiel.de/kieler + * + * Copyright 2023 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). + */ +package de.cau.cs.kieler.sccharts.ui.synthesis.styles + +import de.cau.cs.kieler.klighd.ViewContext +import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared +import org.eclipse.elk.graph.properties.IProperty +import org.eclipse.elk.graph.properties.Property + +/** + * @author als + */ +@ViewSynthesisShared +class ActorSkins { + + public static final IProperty SKINPATH = new Property( + "de.cau.cs.kieler.sccharts.ui.synthesis.skinPath", ""); + + public static final IProperty SKIN_STYLE_KEY_SCCHARTS = new Property( + "de.cau.cs.kieler.sccharts.ui.synthesis.style.sccharts", false); + + def String getSkinPath(ViewContext context) { + val rootNode = context.viewModel + var sp = rootNode.getProperty(SKINPATH) + if (sp.nullOrEmpty) { + sp = context.getProperty(SKINPATH) + if (!sp.nullOrEmpty) { + sp.setSkinPath(context) + } + } + return sp + } + + def void setSkinPath(String sp, ViewContext context) { + val rootNode = context.viewModel + rootNode.setProperty(SKINPATH, sp) + } +} \ No newline at end of file diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/ColorStore.java b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/ColorStore.java index bf338515f5..92f09fb9dd 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/ColorStore.java +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/ColorStore.java @@ -12,28 +12,27 @@ */ package de.cau.cs.kieler.sccharts.ui.synthesis.styles; -import java.util.HashMap; - -import org.eclipse.emf.ecore.util.EcoreUtil; - +import de.cau.cs.kieler.kicool.ui.synthesis.colors.AbstractColorStore; import de.cau.cs.kieler.klighd.krendering.Colors; import de.cau.cs.kieler.klighd.krendering.KColor; import de.cau.cs.kieler.klighd.krendering.KRenderingFactory; import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared; +import de.cau.cs.kieler.klighd.util.ColorPreferences; +import de.cau.cs.kieler.klighd.util.ColorThemeKind; + +import static de.cau.cs.kieler.kicool.ui.synthesis.colors.ColorUtil.*; /** * The SCCharts colors. * * @author als - * @kieler.design 2015-10-27 proposed - * @kieler.rating 2015-10-27 proposed yellow */ @ViewSynthesisShared -public class ColorStore { - - public enum Color { - STATE_CONNECTOR(Colors.BLACK), - STATE_FOREGROND(Colors.GRAY), +public class ColorStore extends AbstractColorStore { + + public enum Color implements IColor { + STATE_FOREGROUND(Colors.GRAY), + STATE_TEXT_FOREGROUND(Colors.BLACK), STATE_INITIAL_FOREGROND(Colors.BLACK), STATE_FIANL_FOREGROND(Colors.BLACK), STATE_FINAL_FOREGROND_BACKGROUND(Colors.WHITE), @@ -41,10 +40,12 @@ public enum Color { STATE_BACKGROUND_GRADIENT_2(205, 220, 243), STATE_REFERENCED_BACKGROUND_GRADIENT_1(0xfc, 0xf7, 0xfc), STATE_REFERENCED_BACKGROUND_GRADIENT_2(0xe6, 0xcb, 0xf2), + STATE_CONNECTOR(Colors.BLACK), STATE_SHADOW(Colors.BLACK), STATE_VIOLATION_BACKGROUND_GRADIENT_1(253, 244, 240), STATE_VIOLATION_BACKGROUND_GRADIENT_2(245, 160, 163), + TRANSITION_FOREGROND(Colors.BLACK), TRANSITION_HISTORY(60, 60, 60), TRANSITION_HISTORY_DECORATOR(Colors.WHITE), TRANSITION_DEFERRED(Colors.RED), @@ -53,6 +54,7 @@ public enum Color { TRANSITION_TERMINATION_DECORATOR(Colors.GREEN), TRANSITION_PROBABILITY(Colors.STEEL_BLUE_2), TRANSITION_NONDETERMINISTIC(234, 154, 86), // darker SANDY_BROWN + TRANSITION_LABEL_FOREGROND(Colors.BLACK), REGION_FOREGROUND(Colors.GRAY), REGION_BACKGROUND(Colors.WHITE), @@ -63,19 +65,12 @@ public enum Color { REGION_BUTTON_FOREGROUND(Colors.WHITE), REGION_LABEL(Colors.DIM_GRAY), - REGION_ENTRY_BACKGROUND_GRADIENT_1(Colors.WHITE), - REGION_ENTRY_BACKGROUND_GRADIENT_2(120, 220, 120), - REGION_ENTRY_FOREGROUND(Colors.GREEN), - INPUTNODE_BACKGROUND_GRADIENT_1(248, 249, 253), INPUTNODE_BACKGROUND_GRADIENT_2(205, 220, 243), INPUTNODE_FOREGROUND(Colors.GRAY), OUTPUTNODE_BACKGROUND_GRADIENT_1(248, 249, 253), OUTPUTNODE_BACKGROUND_GRADIENT_2(205, 220, 243), OUTPUTNODE_FOREGROUND(Colors.GRAY), -// OPERATORNODE_BACKGROUND_GRADIENT_1(254, 254, 240), -// OPERATORNODE_BACKGROUND_GRADIENT_2(224, 176, 9), -// OPERATORNODE_FOREGROUND(Colors.GRAY), OPERATORNODE_BACKGROUND_GRADIENT_1(248, 249, 253), OPERATORNODE_BACKGROUND_GRADIENT_2(205, 220, 243), OPERATORNODE_FOREGROUND(Colors.GRAY), @@ -135,60 +130,93 @@ private Color(final Colors color) { /** * @return the default color */ - private KColor getDefaultColor() { + public KColor getDefaultColor() { return defaultColor; } }; - - private final static KRenderingFactory FACTORY = KRenderingFactory.eINSTANCE; - /** the configuration */ - private HashMap configuration = new HashMap(); - - /** - * Configures the given color with RGB values. - * - * @param color - * the color to configure - * @param red - * the red component of the desired color in range of 0 to 255 - * @param green - * the green component of the desired color in range of 0 to 255 - * @param blue - * the blue component of the desired color in range of 0 to 255 - */ - public void configureColor(final Color color, final int red, final int green, final int blue) { - KColor kColor = FACTORY.createKColor(); - kColor.setRed(red); - kColor.setGreen(green); - kColor.setBlue(blue); - configuration.put(color, kColor); - } - - /** - * Configures the given color with a {@link Colors} color. - * - * @param color - * the color to configure - * @param color - * the {@link Colors} color - */ - public void configureColor(final Color color, final Colors cColor) { - KColor kColor = FACTORY.createKColor(); - kColor.setColor(cColor); - configuration.put(color, kColor); - } - - /** - * @param color - * the color - * @return a new {@link KColor} for the given color respecting all configurations. - */ - public KColor getColor(Color color) { - if (configuration.containsKey(color)) { - return EcoreUtil.copy(configuration.get(color)); - } else if (color != null) { - return EcoreUtil.copy(color.getDefaultColor()); + + @Override + public boolean configureOwnColors(final ColorPreferences preferences) { + boolean dark = preferences.getKind() == ColorThemeKind.DARK || preferences.getKind() == ColorThemeKind.HIGH_CONTRAST_DARK; + + var fg = preferences.getForeground(); + var bg = preferences.getBackground(); + + if (dark) { + // Make normal background slightly brighter than canvas + bg = adjustBrightness(preferences.getBackground(), 0.05f); + + configureColor(Color.STATE_FOREGROUND, fg); + configureColor(Color.STATE_TEXT_FOREGROUND, fg); + configureColor(Color.STATE_INITIAL_FOREGROND, fg); + configureColor(Color.STATE_FIANL_FOREGROND, fg); + configureColor(Color.STATE_FINAL_FOREGROND_BACKGROUND, bg); + configureColor(Color.STATE_BACKGROUND_GRADIENT_1, 74, 90, 115); + configureColor(Color.STATE_BACKGROUND_GRADIENT_2, 98, 103, 125); + configureColor(Color.STATE_REFERENCED_BACKGROUND_GRADIENT_1, 103, 74, 115); + configureColor(Color.STATE_REFERENCED_BACKGROUND_GRADIENT_2, 125, 98, 125); + configureColor(Color.STATE_CONNECTOR, fg); + configureColor(Color.STATE_SHADOW, Colors.LIGHT_GRAY); + + configureColor(Color.TRANSITION_FOREGROND, fg); + configureColor(Color.TRANSITION_HISTORY, Colors.LIGHT_GRAY); + configureColor(Color.TRANSITION_HISTORY_DECORATOR, Colors.BLACK); + configureColor(Color.TRANSITION_DEFERRED, Colors.RED_3); + configureColor(Color.TRANSITION_DEFERRED_DECORATOR, fg); + configureColor(Color.TRANSITION_ABORT_DECORATOR, Colors.RED_3); + configureColor(Color.TRANSITION_TERMINATION_DECORATOR, Colors.GREEN_3); + configureColor(Color.TRANSITION_PROBABILITY, Colors.STEEL_BLUE_2); + configureColor(Color.TRANSITION_NONDETERMINISTIC, 234, 154, 86); + configureColor(Color.TRANSITION_LABEL_FOREGROND, fg); + + configureColor(Color.REGION_FOREGROUND, fg); + configureColor(Color.REGION_BACKGROUND, bg); + configureColor(Color.REGION_OVERRIDE_FOREGROUND, adjustBrightness(Color.REGION_OVERRIDE_FOREGROUND.defaultColor, 0.2f)); + configureColor(Color.REGION_OVERRIDE_BACKGROUND, bg); + configureColor(Color.REGION_ABORT_FOREGROUND, Colors.RED_3); + configureColor(Color.REGION_ABORT_BACKGROUND, bg); + configureColor(Color.REGION_BUTTON_FOREGROUND, bg); + configureColor(Color.REGION_LABEL, fg); + + configureColor(Color.INPUTNODE_BACKGROUND_GRADIENT_1, getColor(Color.STATE_BACKGROUND_GRADIENT_1)); + configureColor(Color.INPUTNODE_BACKGROUND_GRADIENT_2, getColor(Color.STATE_BACKGROUND_GRADIENT_2)); + configureColor(Color.INPUTNODE_FOREGROUND, getColor(Color.STATE_FOREGROUND)); + configureColor(Color.OUTPUTNODE_BACKGROUND_GRADIENT_1, getColor(Color.STATE_BACKGROUND_GRADIENT_1)); + configureColor(Color.OUTPUTNODE_BACKGROUND_GRADIENT_2, getColor(Color.STATE_BACKGROUND_GRADIENT_2)); + configureColor(Color.OUTPUTNODE_FOREGROUND, getColor(Color.STATE_FOREGROUND)); + configureColor(Color.OPERATORNODE_BACKGROUND_GRADIENT_1, getColor(Color.STATE_BACKGROUND_GRADIENT_1)); + configureColor(Color.OPERATORNODE_BACKGROUND_GRADIENT_2, getColor(Color.STATE_BACKGROUND_GRADIENT_2)); + configureColor(Color.OPERATORNODE_FOREGROUND, getColor(Color.STATE_FOREGROUND)); + configureColor(Color.REFERENCENODE_BACKGROUND_GRADIENT_1, getColor(Color.STATE_REFERENCED_BACKGROUND_GRADIENT_1)); + configureColor(Color.REFERENCENODE_BACKGROUND_GRADIENT_2, getColor(Color.STATE_REFERENCED_BACKGROUND_GRADIENT_2)); + configureColor(Color.REFERENCENODE_FOREGROUND, getColor(Color.STATE_FOREGROUND)); + + configureColor(Color.COMMENT_FOREGROND, Colors.ANTIQUE_WHITE_3); + configureColor(Color.COMMENT_FOREGROND_TRANSITION, Colors.ANTIQUE_WHITE_3); + configureColor(Color.COMMENT_BACKGROUND_GRADIENT_1, Colors.ANTIQUE_WHITE_4); + configureColor(Color.COMMENT_BACKGROUND_GRADIENT_2, Colors.ANTIQUE_WHITE_4); + configureColor(Color.COMMENT_TEXT, fg); + configureColor(Color.COMMENT_EDGE, Colors.ANTIQUE_WHITE_3); + + configureColor(Color.USER_SCHEDULE_COLOR, 0x28, 0x99, 0x7E); + configureColor(Color.DEPENDENCY_ABSWRITEREAD, 0, 192, 0); + configureColor(Color.DEPENDENCY_ABSWRITERELWRITE, 0, 0, 255); + configureColor(Color.DEPENDENCY_ABSWRITEABSWRITE, 255, 0, 0); + + configureColor(Color.METHOD_FOREGROUND, getColor(Color.REGION_FOREGROUND)); + configureColor(Color.METHOD_BACKGROUND, adjustBrightness(getColor(Color.REGION_BACKGROUND), 0.15f)); + + configureColor(Color.SELECTION, adjustBrightness(Color.SELECTION.defaultColor, 0.2f)); + + configureColor(Color.KEYWORD, 0xC5, 0x86, 0xC0); + } else { + // Adjust some background colors to light theme + configureColor(Color.REGION_BACKGROUND, bg); + configureColor(Color.REGION_OVERRIDE_BACKGROUND, bg); + configureColor(Color.REGION_ABORT_BACKGROUND, bg); + configureColor(Color.REGION_BUTTON_FOREGROUND, bg); } - return null; + + return true; } } diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/CommentStyles.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/CommentStyles.xtend index 582351e586..4dac47435e 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/CommentStyles.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/CommentStyles.xtend @@ -71,6 +71,7 @@ class CommentStyles { def KText addCommentText(KNode node, String text) { node.getKContainerRendering.addText(text) => [ fontSize = 7; + foreground = COMMENT_TEXT.color; setGridPlacementData().from(LEFT, 4, 0, TOP, 4, 0).to(RIGHT, 4, 0, BOTTOM, 4, 0); ] } diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/EquationStyles.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/EquationStyles.xtend index 558a172053..e08d089fdb 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/EquationStyles.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/EquationStyles.xtend @@ -15,11 +15,16 @@ package de.cau.cs.kieler.sccharts.ui.synthesis.styles import com.google.common.base.Joiner import com.google.inject.Inject +import de.cau.cs.kieler.kicool.ui.synthesis.colors.AbstractColorStore.GeneralColor +import de.cau.cs.kieler.klighd.kgraph.KEdge +import de.cau.cs.kieler.klighd.kgraph.KNode import de.cau.cs.kieler.klighd.krendering.Colors import de.cau.cs.kieler.klighd.krendering.KContainerRendering +import de.cau.cs.kieler.klighd.krendering.KFontSize import de.cau.cs.kieler.klighd.krendering.KPointPlacementData import de.cau.cs.kieler.klighd.krendering.KRectangle import de.cau.cs.kieler.klighd.krendering.KRenderingFactory +import de.cau.cs.kieler.klighd.krendering.KRoundedBendsPolyline import de.cau.cs.kieler.klighd.krendering.KRoundedRectangle import de.cau.cs.kieler.klighd.krendering.KText import de.cau.cs.kieler.klighd.krendering.LineStyle @@ -29,7 +34,9 @@ import de.cau.cs.kieler.klighd.krendering.extensions.KEdgeExtensions 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.KRenderingExtensions +import java.util.EnumSet import java.util.List +import org.eclipse.elk.core.math.ElkMargin import org.eclipse.elk.core.options.CoreOptions import org.eclipse.elk.core.options.SizeConstraint import org.eclipse.elk.graph.properties.IProperty @@ -38,12 +45,6 @@ import org.eclipse.elk.graph.properties.Property import static de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore.Color.* import static extension org.eclipse.emf.ecore.util.EcoreUtil.* -import de.cau.cs.kieler.klighd.krendering.KRoundedBendsPolyline -import de.cau.cs.kieler.klighd.kgraph.KNode -import de.cau.cs.kieler.klighd.kgraph.KEdge -import org.eclipse.elk.core.math.ElkMargin -import java.util.EnumSet -import de.cau.cs.kieler.klighd.krendering.KFontSize /** * Styles for {@link Equations}. @@ -242,7 +243,10 @@ class EquationStyles { def KEdge addWireFigure(KEdge edge) { edge.addRoundedBendsPolyline(4, 1) => [ - it.addJunctionPointDecorator + it.addJunctionPointDecorator => [ + it.foreground = GeneralColor.FOREGROUND.color + it.background = GeneralColor.FOREGROUND.color + ] ] return edge } @@ -334,7 +338,7 @@ class EquationStyles { // Mark this figure as container for further content setProperty(IS_CONTENT_CONTAINER, true); setBackgroundGradient(STATE_BACKGROUND_GRADIENT_1.color, STATE_BACKGROUND_GRADIENT_2.color, 90); - foreground = STATE_FOREGROND.color; + foreground = STATE_FOREGROUND.color; ] } @@ -347,7 +351,7 @@ class EquationStyles { // Mark this figure as container for further content setProperty(IS_CONTENT_CONTAINER, true); setBackgroundGradient(STATE_BACKGROUND_GRADIENT_1.color, STATE_BACKGROUND_GRADIENT_2.color, 90); - foreground = STATE_FOREGROND.color; + foreground = STATE_FOREGROUND.color; setGridPlacement(1); ] } diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/StateStyles.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/StateStyles.xtend index 8855cc614f..24c10137ea 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/StateStyles.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/StateStyles.xtend @@ -80,7 +80,7 @@ class StateStyles { /** This property is set a rendering and indicates the content container */ public static final IProperty IS_CONTENT_CONTAINER = new Property( "de.cau.cs.kieler.sccharts.ui.synthesis.style.state.content", false); - /** This property is set a rendering and indicates the redering is not visible and only present for layout purpose */ + /** This property is set a rendering and indicates the rendering is not visible and only present for layout purpose */ public static final IProperty IS_LAYOUT_ELEMENT = new Property( "de.cau.cs.kieler.sccharts.ui.synthesis.style.layout", false); /** This property is set on the content container rendering and points to the container holding the action labels */ @@ -119,7 +119,7 @@ class StateStyles { // Mark this figure as container for further content setProperty(IS_CONTENT_CONTAINER, true); setBackgroundGradient(STATE_BACKGROUND_GRADIENT_1.color, STATE_BACKGROUND_GRADIENT_2.color, 90); - foreground = STATE_FOREGROND.color; + foreground = STATE_FOREGROUND.color; ] } @@ -132,7 +132,7 @@ class StateStyles { // Mark this figure as container for further content setProperty(IS_CONTENT_CONTAINER, true); setBackgroundGradient(STATE_BACKGROUND_GRADIENT_1.color, STATE_BACKGROUND_GRADIENT_2.color, 90); - foreground = STATE_FOREGROND.color; + foreground = STATE_FOREGROUND.color; setGridPlacement(1); ] } @@ -238,6 +238,7 @@ class StateStyles { fontBold = true fontSize = stateLabelTextSize + foreground = STATE_TEXT_FOREGROUND.color suppressSelectability selectionTextUnderline = Underline.NONE // prevents default selection style // setProperty(KlighdProperties.IS_NODE_TITLE, true) @@ -322,6 +323,7 @@ class StateStyles { ktext = it.addText(builder.append(" ").toString) => [ horizontalAlignment = H_LEFT selectionTextUnderline = Underline.SINGLE + foreground = STATE_TEXT_FOREGROUND.color ] if (keyword == TextFormat.KEYWORD) { ktext.highlightKeyword @@ -342,6 +344,7 @@ class StateStyles { ktext = addText(builder.toString) => [ horizontalAlignment = H_LEFT selectionTextUnderline = Underline.SINGLE + foreground = STATE_TEXT_FOREGROUND.color ] if (keyword == TextFormat.KEYWORD) { ktext.highlightKeyword diff --git a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/TransitionStyles.xtend b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/TransitionStyles.xtend index 0705c545f5..5cda5f41e2 100644 --- a/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/TransitionStyles.xtend +++ b/plugins/de.cau.cs.kieler.sccharts.ui/src/de/cau/cs/kieler/sccharts/ui/synthesis/styles/TransitionStyles.xtend @@ -81,12 +81,14 @@ class TransitionStyles { */ def KSpline addTransitionSpline(KEdge edge) { edge.addSpline => [ + foreground = TRANSITION_FOREGROND.color; lineWidth = TRANSITION_LINE_WIDTH; ] } def KPolyline addTransitionPolyline(KEdge edge) { edge.addPolyline => [ + foreground = TRANSITION_FOREGROND.color; lineWidth = TRANSITION_LINE_WIDTH; ] } @@ -201,6 +203,7 @@ class TransitionStyles { } edge.line.addEllipse() => [ lineWidth = 1; + foreground = STATE_FOREGROUND.color; background = TRANSITION_DEFERRED.color; if (isAdditionalArrowHead) { setDecoratorPlacementData(10, 10, -19, 1, false); @@ -234,7 +237,8 @@ class TransitionStyles { edge.line.addEllipse() => [ setDecoratorPlacementData(10, 10, 4, 0, false); lineWidth = 1; - background = TRANSITION_ABORT_DECORATOR.color + foreground = STATE_FOREGROUND.color; + background = TRANSITION_ABORT_DECORATOR.color; ] } @@ -246,7 +250,8 @@ class TransitionStyles { edge.line.drawTriangle() => [ setDecoratorPlacementData(11, 11, 5, 0, true); lineWidth = 1; - background = TRANSITION_TERMINATION_DECORATOR.color + foreground = STATE_FOREGROUND.color; + background = TRANSITION_TERMINATION_DECORATOR.color; ] } @@ -261,6 +266,7 @@ class TransitionStyles { def configureTransitionLabelRendering(KRendering rendering) { rendering.fontSize = 11; rendering.fontBold = true; + rendering.foreground = TRANSITION_LABEL_FOREGROND.color; } def KLabel addLabel(KEdge edge, String text, KColor backgroundColor) { @@ -269,7 +275,7 @@ class TransitionStyles { label.getKRendering => [ // Configure text fontSize = 7; - foreground = COMMENT_FOREGROND_TRANSITION.color + foreground = COMMENT_TEXT.color background = backgroundColor ] return label; @@ -282,7 +288,7 @@ class TransitionStyles { //label.selectionFontBold = true //label.selectionForeground = SELECTION.color return label - } + } def configureTransitionTailLabelRendering(KRendering rendering) { rendering.fontSize = 8 diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/ColorStore.java b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/ColorStore.java index d9467e40d4..aca336089b 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/ColorStore.java +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/ColorStore.java @@ -12,25 +12,34 @@ */ package de.cau.cs.kieler.scg.klighd; -import java.util.HashMap; - -import org.eclipse.emf.ecore.util.EcoreUtil; +import static de.cau.cs.kieler.kicool.ui.synthesis.colors.ColorUtil.adjustBrightness; +import de.cau.cs.kieler.kicool.ui.synthesis.colors.AbstractColorStore; import de.cau.cs.kieler.klighd.krendering.Colors; import de.cau.cs.kieler.klighd.krendering.KColor; import de.cau.cs.kieler.klighd.krendering.KRenderingFactory; +import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared; +import de.cau.cs.kieler.klighd.util.ColorPreferences; +import de.cau.cs.kieler.klighd.util.ColorThemeKind; /** - * The SCCharts colors. + * The SCG colors. * * @author als - * @kieler.design 2015-10-27 proposed - * @kieler.rating 2015-10-27 proposed yellow */ -public class ColorStore { +@ViewSynthesisShared +public class ColorStore extends AbstractColorStore { - public enum Color { - SCCHARTSBLUE(205, 220, 243), + public enum Color implements IColor { + NODE_FOREGROUND(Colors.BLACK), + NODE_BACKGROUND(Colors.WHITE), + NODE_TEXT(Colors.BLACK), + NODE_SHADOW(Colors.BLACK), + NODE_REFERENCED_BACKGROUND_GRADIENT_1(0xfc, 0xf7, 0xfc), + NODE_REFERENCED_BACKGROUND_GRADIENT_2(0xe6, 0xcb, 0xf2), + + THREAD_LABEL(Colors.BLACK), + THREAD_BACKGROUND(205, 220, 243), COMMENT_FOREGROND(0xf0, 0xf0, 0x24), COMMENT_FOREGROND_TRANSITION(0x00, 0x00, 0x00), @@ -41,6 +50,7 @@ public enum Color { USER_SCHEDULE_COLOR(0x28, 0x99, 0x7E), + CONTROLFLOW_EDGE(0, 0, 0), DEPENDENCY_ABSWRITEREAD(0, 192, 0), DEPENDENCY_RELWRITEREAD(0, 192, 192), DEPENDENCY_ABSWRITERELWRITE(0, 0, 255), @@ -55,15 +65,12 @@ public enum Color { NODE_PRIORITY_COLOR(255, 30, 30), OPT_PRIORITY_COLOR(30, 30, 255), PASSIVE_REGION_COLOR(255, 101, 127), - STANDARD_CONTROLFLOWEDGE(0, 0, 0), - BASICBLOCKBORDER(248, 0, 253), - SCHEDULINGBLOCKBORDER(128, 0, 243), - SCHEDULEBORDER(0, 0, 128), + BASICBLOCK_BORDER(248, 0, 253), + SCHEDULINGBLOCK_BORDER(128, 0, 243), + SCHEDULE_BORDER(0, 0, 128), SCHEDULING_DEADCODE(128, 128, 128), - SCHEDULING_SCHEDULINGEDGE(128, 0, 253), - PROBLEM_COLOR(255, 0, 0), - - KEYWORD(115, 0, 65); + SCHEDULING_SCHEDULING_EDGE(128, 0, 253), + PROBLEM_COLOR(255, 0, 0); /** the default color */ private final KColor defaultColor = KRenderingFactory.eINSTANCE.createKColor(); @@ -97,64 +104,45 @@ private Color(final Colors color) { /** * @return the default color */ - private KColor getDefaultColor() { + public KColor getDefaultColor() { return defaultColor; } }; - private final static KRenderingFactory FACTORY = KRenderingFactory.eINSTANCE; - /** the configuration */ - private HashMap configuration = new HashMap(); + @Override + public boolean configureOwnColors(final ColorPreferences preferences) { + var fg = preferences.getForeground(); + var bg = preferences.getBackground(); - /** - * Configures the given color with RGB values. - * - * @param color - * the color to configure - * @param red - * the red component of the desired color in range of 0 to 255 - * @param green - * the green component of the desired color in range of 0 to 255 - * @param blue - * the blue component of the desired color in range of 0 to 255 - */ - public void configureColor(final Color color, final int red, final int green, final int blue) { - KColor kColor = FACTORY.createKColor(); - kColor.setRed(red); - kColor.setGreen(green); - kColor.setBlue(blue); - configuration.put(color, kColor); - } + configureColor(Color.NODE_FOREGROUND, fg); + configureColor(Color.NODE_BACKGROUND, bg); + configureColor(Color.NODE_TEXT, fg); + configureColor(Color.CONTROLFLOW_EDGE, fg); + + boolean dark = preferences.getKind() == ColorThemeKind.DARK || preferences.getKind() == ColorThemeKind.HIGH_CONTRAST_DARK; + + if (dark) { + // Make normal background slightly brighter than canvas + bg = adjustBrightness(preferences.getBackground(), 0.06f); + configureColor(Color.NODE_BACKGROUND, bg); + + configureColor(Color.NODE_SHADOW, bg); + configureColor(Color.NODE_REFERENCED_BACKGROUND_GRADIENT_1, 103, 74, 115); + configureColor(Color.NODE_REFERENCED_BACKGROUND_GRADIENT_2, 125, 98, 125); - /** - * Configures the given color with a {@link Colors} color. - * - * @param color - * the color to configure - * @param color - * the {@link Colors} color - */ - public void configureColor(final Color color, final Colors cColor) { - KColor kColor = FACTORY.createKColor(); - kColor.setColor(cColor); - configuration.put(color, kColor); - } + configureColor(Color.THREAD_LABEL, fg); + configureColor(Color.THREAD_BACKGROUND, 98, 103, 125); - /** - * @param color - * the color - * @return a new {@link KColor} for the given color respecting all configurations. - */ - public KColor getColor(Color color) { - if (configuration.containsKey(color)) { - return EcoreUtil.copy(configuration.get(color)); - } else if (color != null) { - return EcoreUtil.copy(color.getDefaultColor()); + configureColor(Color.COMMENT_FOREGROND, Colors.ANTIQUE_WHITE_3); + configureColor(Color.COMMENT_FOREGROND_TRANSITION, Colors.ANTIQUE_WHITE_3); + configureColor(Color.COMMENT_BACKGROUND_GRADIENT_1, Colors.ANTIQUE_WHITE_4); + configureColor(Color.COMMENT_BACKGROUND_GRADIENT_2, Colors.ANTIQUE_WHITE_4); + configureColor(Color.COMMENT_TEXT, fg); + configureColor(Color.COMMENT_EDGE, Colors.ANTIQUE_WHITE_3); + + configureColor(Color.SCHEDULINGBLOCK_BORDER, 161, 71, 243); } - return null; + + return true; } - - public KColor getColor2(Color color) { - return this.getColor(color); - } } diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphComponentSynthesis.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphComponentSynthesis.xtend index 80b6a0c605..9105a6fe44 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphComponentSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphComponentSynthesis.xtend @@ -91,10 +91,16 @@ class SCGraphComponentSynthesis { // Straightforward rectangle drawing val figure = node.addRoundedRectangle(SCGraphSynthesisHelper.CORNERRADIUS, SCGraphSynthesisHelper.CORNERRADIUS, SCGraphSynthesisHelper.LINEWIDTH) - figure.addText("").setSurroundingSpace(6, 0, 2, 0) + figure.addText("") => [ + it.setSurroundingSpace(6, 0, 2, 0) + it.foreground = NODE_TEXT.color + ] val proxyFigure = proxy.addRoundedRectangle(SCGraphSynthesisHelper.CORNERRADIUS, SCGraphSynthesisHelper.CORNERRADIUS, SCGraphSynthesisHelper.LINEWIDTH) - proxyFigure.addText("").setSurroundingSpace(6, 0, 2, 0) + proxyFigure.addText("") => [ + it.setSurroundingSpace(6, 0, 2, 0) + it.foreground = NODE_TEXT.color + ] var isSCGRef = false if (assignment.expression instanceof ReferenceCall) { val call = assignment.expression as ReferenceCall @@ -103,15 +109,12 @@ class SCGraphComponentSynthesis { isSCGRef = decl.reference instanceof SCGraph } } + + node.initialiseFigure(assignment) if (isSCGRef) { - figure.setBackgroundGradient("#fcf7fc".color, "#e6cbf2".color, 90.0f) + figure.setBackgroundGradient(NODE_REFERENCED_BACKGROUND_GRADIENT_1.color, NODE_REFERENCED_BACKGROUND_GRADIENT_2.color, 90.0f) proxyFigure.setBackgroundGradient("#fcf7fc".color, "#e6cbf2".color, 90.0f) - } else { - figure.background = "white".color; - proxyFigure.background = "white".color; } - node.initialiseFigure(assignment) - proxy.initialiseAssignmentProxyFigure() // Add ports for control-flow and dependency routing. if (isGuardSCG) { @@ -157,10 +160,12 @@ class SCGraphComponentSynthesis { } } else { if (assignment.hasAnnotation(SCGAnnotations.ANNOTATION_HEADNODE)) { - var sbHeadNodeName = assignment.getStringAnnotationValue(SCGAnnotations.ANNOTATION_HEADNODE) - sbHeadNodeName.createLabel(node).associateWith(assignment). - configureOutsideTopLeftNodeLabel(sbHeadNodeName, 9, KlighdConstants::DEFAULT_FONT_NAME). - KRendering.foreground = "black".color + val sbHeadNodeName = assignment.getStringAnnotationValue(SCGAnnotations.ANNOTATION_HEADNODE) + sbHeadNodeName.createLabel(node) => [ + it.associateWith(assignment) + it.configureOutsideTopLeftNodeLabel(sbHeadNodeName, 9, KlighdConstants::DEFAULT_FONT_NAME) + it.KRendering.foreground = NODE_TEXT.color + ] } } @@ -376,8 +381,11 @@ class SCGraphComponentSynthesis { if (ALIGN_ENTRYEXIT_NODES.booleanValue) node.addLayoutParam(LayeredOptions::LAYERING_LAYER_CONSTRAINT, LayerConstraint::FIRST) // Draw an ellipse figure for exit nodes... - val figure = node.addEllipse().background = "white".color; - figure.addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 1, 0) + val figure = node.addEllipse() + figure.addText("") => [ + it.setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 1, 0) + it.foreground = NODE_TEXT.color + ] val text = if(entry.hasAnnotation("label")) entry.getStringAnnotationValue("label") else "entry" node.initialiseFigure(SHOW_CAPTION.booleanValue ? text : "") if (scg.method) { @@ -448,8 +456,11 @@ class SCGraphComponentSynthesis { if (ALIGN_ENTRYEXIT_NODES.booleanValue) node.addLayoutParam(LayeredOptions::LAYERING_LAYER_CONSTRAINT, LayerConstraint::LAST) // Draw an ellipse for an exit node... - val figure = node.addEllipse().background = "white".color; - figure.addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 1, 0) + val figure = node.addEllipse() + figure.addText("") => [ + it.setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 1, 0) + it.foreground = NODE_TEXT.color + ] node.initialiseFigure(SHOW_CAPTION.booleanValue ? "exit" : "") if (exit.final) { diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphDiagramSynthesis.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphDiagramSynthesis.xtend index 31e78e2b5d..a436ca841f 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphDiagramSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphDiagramSynthesis.xtend @@ -107,7 +107,6 @@ class SCGraphDiagramSynthesis extends AbstractDiagramSynthesis { @Inject extension KPortExtensions @Inject extension KContainerRenderingExtensions @Inject extension KPolylineExtensions - @Inject extension KColorExtensions @Inject extension AnnotationsExtensions @Inject extension SCGCoreExtensions @Inject extension SCGControlFlowExtensions @@ -250,6 +249,9 @@ class SCGraphDiagramSynthesis extends AbstractDiagramSynthesis { scc = prioAuxData.stronglyConnectedComponents } } + + // Apply color theme + configureAllColors(usedContext) // Invoke the synthesis. SCGraph = model @@ -499,12 +501,13 @@ class SCGraphDiagramSynthesis extends AbstractDiagramSynthesis { aNode.setMinimalNodeSize(16, 16) aNode.addRoundedRectangle(1, 1, 1) => [ - setBackgroundGradient(COMMENT_BACKGROUND_GRADIENT_1.color2, COMMENT_BACKGROUND_GRADIENT_2.color2, 90); - foreground = COMMENT_FOREGROND.color2; + setBackgroundGradient(COMMENT_BACKGROUND_GRADIENT_1.color, COMMENT_BACKGROUND_GRADIENT_2.color, 90); + foreground = COMMENT_FOREGROND.color; ] aNode.getKContainerRendering.addText(commentText) => [ fontSize = 8; setGridPlacementData().from(LEFT, 4, 0, TOP, 4, 0).to(RIGHT, 4, 0, BOTTOM, 4, 0); + foreground = COMMENT_TEXT.color; ] val edge = createEdge() @@ -600,12 +603,14 @@ class SCGraphDiagramSynthesis extends AbstractDiagramSynthesis { edge.addRoundedBendsPolyline(8, CONTROLFLOW_THICKNESS.floatValue) => [ it.lineStyle = LineStyle::SOLID it.addHeadArrowDecorator - it.foreground = STANDARD_CONTROLFLOWEDGE.color + it.foreground = CONTROLFLOW_EDGE.color it.foreground.propagateToChildren = true ] // If the outgoing identifier indicates a 'then branch', add a 'then label'. if (outgoingPortId == SCGraphSynthesisHelper.SCGPORTID_OUTGOING_THEN) { - edge.createLabel.configureTailEdgeLabel('true', 9, KlighdConstants::DEFAULT_FONT_NAME) + edge.createLabel.configureTailEdgeLabel('true', 9, KlighdConstants::DEFAULT_FONT_NAME) => [ + it.KRendering.foreground = NODE_TEXT.color + ] } if (controlFlow.targetNode.schizophrenic) { @@ -627,12 +632,14 @@ class SCGraphDiagramSynthesis extends AbstractDiagramSynthesis { it.setPortSize(50, 20) it.KContainerRendering.setProperty(PRIO_STATEMENTS_PROPERTY, true) var rec = it.KContainerRendering.addRoundedRectangle(SCGraphSynthesisHelper.CORNERRADIUS, - SCGraphSynthesisHelper.CORNERRADIUS, SCGraphSynthesisHelper.LINEWIDTH) - rec.background = "white".color - var txt = rec.addText("prio(" + tgtPrio.value + ")") - txt.fontSize = 7 - var x = txt.setAreaPlacementData - x.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 1, 0, BOTTOM, 1, 0) + SCGraphSynthesisHelper.CORNERRADIUS, SCGraphSynthesisHelper.LINEWIDTH) => [ + background = NODE_BACKGROUND.color + ] + rec.addText("prio(" + tgtPrio.value + ")") => [ + fontSize = 7 + foreground = NODE_TEXT.color + setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 1, 0, BOTTOM, 1, 0) + ] ] } } @@ -792,7 +799,7 @@ class SCGraphDiagramSynthesis extends AbstractDiagramSynthesis { if (!nonScheduleDependencies.empty) { nonScheduleDependencies.forEach [ - colorDependency(SCHEDULING_SCHEDULINGEDGE.color) + colorDependency(SCHEDULING_SCHEDULING_EDGE.color) thickenDependency(CONTROLFLOW_SCHEDULINGEDGE_WIDTH) dependencyAlpha(SCHEDULING_SCHEDULINGEDGE_ALPHA) ] @@ -801,7 +808,7 @@ class SCGraphDiagramSynthesis extends AbstractDiagramSynthesis { it.source = sourceKNode it.target = targetKNode it.addRoundedBendsPolyline(8, CONTROLFLOW_SCHEDULINGEDGE_WIDTH) => [ - it.foreground = SCHEDULING_SCHEDULINGEDGE.color + it.foreground = SCHEDULING_SCHEDULING_EDGE.color it.foreground.alpha = SCHEDULING_SCHEDULINGEDGE_ALPHA it.addHeadArrowDecorator ] diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphHierarchySynthesis.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphHierarchySynthesis.xtend index 5b1c2aea45..a13dbf0788 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphHierarchySynthesis.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphHierarchySynthesis.xtend @@ -130,13 +130,13 @@ class SCGraphHierarchySynthesis { } else { label = entry.getStringAnnotationValue(ANNOTATION_REGIONNAME) } - val REGION_LABEL = label + val threadLabel = label entry.getThreadNodes.createHierarchy(NODEGROUPING_HIERARCHY, null) => [ var text = "" - if(!REGION_LABEL.nullOrEmpty) text = REGION_LABEL + if(!threadLabel.nullOrEmpty) text = threadLabel val threadPathType = threadTypes.get(entry) if (threadPathType !== null) { - if(!REGION_LABEL.nullOrEmpty) text = text + " - " + if(!threadLabel.nullOrEmpty) text = text + " - " text = text + threadPathType.toString2 + (entry.hasAnnotation(SCGAnnotations.ANNOTATION_CONTROLFLOWTHREADPATHTYPE_PREEMPTION) ? " " + entry.getStringAnnotationValue(SCGAnnotations.ANNOTATION_CONTROLFLOWTHREADPATHTYPE_PREEMPTION) : "" ) } @@ -146,9 +146,8 @@ class SCGraphHierarchySynthesis { threadSegmentIDText = "ThreadID: " + (entry.getAnnotation( PriorityAuxiliaryData.THREAD_SEGMENT_ANNOTATION) as IntAnnotation).value.toString - val labelTR = addOutsideTopLeftNodeLabel(threadSegmentIDText, 10, - KlighdConstants::DEFAULT_FONT_NAME) => [ - it.KRendering.setForeground(REGION_LABEL.color) + val labelTR = addOutsideTopLeftNodeLabel(threadSegmentIDText, 10, KlighdConstants::DEFAULT_FONT_NAME) => [ + it.KRendering.setForeground(THREAD_LABEL.color) ] labelTR.KRendering.setProperty(SCGraphDiagramSynthesis.THREAD_PRIO_PROPERTY, true) } @@ -156,7 +155,7 @@ class SCGraphHierarchySynthesis { if (SHOW_POTENTIALPROBLEMS.booleanValue) { // Workaround for fixing the massive whitespace: using centered labels addInsideTopCenteredNodeLabel(text, 10, KlighdConstants::DEFAULT_FONT_NAME) => [ - it.KRendering.setForeground(REGION_LABEL.color); + it.KRendering.setForeground(THREAD_LABEL.color); ] } @@ -230,7 +229,7 @@ class SCGraphHierarchySynthesis { bbName = bbName.replaceAll("_g", "g") bbName.createLabel(bbContainer).configureOutsideTopLeftNodeLabel(bbName, 9, - KlighdConstants::DEFAULT_FONT_NAME).KRendering.foreground = BASICBLOCKBORDER.color + KlighdConstants::DEFAULT_FONT_NAME).KRendering.foreground = BASICBLOCK_BORDER.color } if (SHOW_SCHEDULINGBLOCKS.booleanValue) { for (schedulingBlock : basicBlock.schedulingBlocks) { @@ -260,7 +259,7 @@ class SCGraphHierarchySynthesis { sbName = sbName.replaceAll("_g", "g") sbName.createLabel(sbContainer).associateWith(schedulingBlock). configureOutsideTopLeftNodeLabel(sbName, 9, KlighdConstants::DEFAULT_FONT_NAME). - KRendering.foreground = SCHEDULINGBLOCKBORDER.color + KRendering.foreground = SCHEDULINGBLOCK_BORDER.color } if (basicBlock.deadBlock) { @@ -391,10 +390,10 @@ class SCGraphHierarchySynthesis { if (nodeGrouping == NODEGROUPING_HIERARCHY) { kContainer.addRoundedRectangle(5, 5, 0) - kContainer.KRendering.foreground = SCCHARTSBLUE.color; + kContainer.KRendering.foreground = THREAD_BACKGROUND.color; kContainer.KRendering.foreground.alpha = Math.round( HIERARCHY_TRANSPARENCY.objectValue as Float) - kContainer.KRendering.background = SCCHARTSBLUE.color; + kContainer.KRendering.background = THREAD_BACKGROUND.color; kContainer.KRendering.background.alpha = Math.round( HIERARCHY_TRANSPARENCY.objectValue as Float) } @@ -403,9 +402,9 @@ class SCGraphHierarchySynthesis { lineStyle = LineStyle::SOLID associateWith(contextObject) ] - kContainer.KRendering.foreground = BASICBLOCKBORDER.color; + kContainer.KRendering.foreground = BASICBLOCK_BORDER.color; kContainer.KRendering.foreground.alpha = Math.round(255f) - kContainer.KRendering.background = SCCHARTSBLUE.color; + kContainer.KRendering.background = THREAD_BACKGROUND.color; kContainer.KRendering.background.alpha = Math.round(0f) } if (nodeGrouping == NODEGROUPING_SCHEDULINGBLOCK) { @@ -413,9 +412,9 @@ class SCGraphHierarchySynthesis { lineStyle = LineStyle::SOLID associateWith(contextObject) ] - kContainer.KRendering.foreground = SCHEDULINGBLOCKBORDER.color; + kContainer.KRendering.foreground = SCHEDULINGBLOCK_BORDER.color; kContainer.KRendering.foreground.alpha = Math.round(255f) - kContainer.KRendering.background = SCCHARTSBLUE.color; + kContainer.KRendering.background = THREAD_BACKGROUND.color; kContainer.KRendering.background.alpha = Math.round(0f) } if (nodeGrouping == NODEGROUPING_GUARDBLOCK) { @@ -433,9 +432,9 @@ class SCGraphHierarchySynthesis { lineStyle = LineStyle::SOLID associateWith(contextObject) ] - kContainer.KRendering.foreground = SCHEDULEBORDER.color; + kContainer.KRendering.foreground = SCHEDULE_BORDER.color; kContainer.KRendering.foreground.alpha = Math.round(196f) - kContainer.KRendering.background = SCCHARTSBLUE.color; + kContainer.KRendering.background = THREAD_BACKGROUND.color; kContainer.KRendering.background.alpha = Math.round(0f) } if (nodeGrouping == NODEGROUPING_SCC) { @@ -443,9 +442,9 @@ class SCGraphHierarchySynthesis { lineStyle = LineStyle::SOLID associateWith(contextObject) ] - kContainer.KRendering.foreground = SCHEDULINGBLOCKBORDER.color; + kContainer.KRendering.foreground = SCHEDULINGBLOCK_BORDER.color; kContainer.KRendering.foreground.alpha = Math.round(196f) - kContainer.KRendering.background = SCCHARTSBLUE.color; + kContainer.KRendering.background = THREAD_BACKGROUND.color; kContainer.KRendering.background.alpha = Math.round(0f) } diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphShapes.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphShapes.xtend index 6b208f5ed2..2b928f1910 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphShapes.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphShapes.xtend @@ -24,6 +24,8 @@ import com.google.inject.Inject import de.cau.cs.kieler.klighd.kgraph.util.KGraphUtil import de.cau.cs.kieler.klighd.krendering.extensions.KContainerRenderingExtensions +import static de.cau.cs.kieler.scg.klighd.ColorStore.Color.* + /** * KRendering Utility class for KLighD visualization. * @@ -38,52 +40,7 @@ class SCGraphShapes { @Inject extension KColorExtensions @Inject extension KNodeExtensions @Inject extension KContainerRenderingExtensions - - - def KNode createRoundedRectangulareNode(Object o) { - val node = o.node; - val rect = KRenderingFactory::eINSTANCE.createKRoundedRectangle; - rect.setCornerHeight(10); - rect.setCornerWidth(10); - node.data.add(rect); - node.KRendering.background = "white".color - return node; - } - - def KNode createRoundedRectangulareNode(Object o, int height, int width) { - val node = o.createRoundedRectangulareNode; - node.height = height; - node.width = width; - return node; - } - - def KNode createRectangulareNode(Object o) { - val node = o.node; - val rect = KRenderingFactory::eINSTANCE.createKRectangle; - node.data.add(rect); - return node; - } - - def KNode createRectangulareNode(Object o, int height, int width) { - val node = o.createRectangulareNode; - node.height = height; - node.width = width; - return node; - } - - def KNode createEllipseNode(Object o) { - val node = o.node; - val rect = KRenderingFactory::eINSTANCE.createKEllipse; - node.data.add(rect); - return node; - } - - def KNode createEllipseNode(Object o, int height, int width) { - val node = o.createEllipseNode; - node.height = height; - node.width = width; - return node; - } + @Inject extension ColorStore def KPolygon createTriangleShape(KPolygon poly) { poly => [ @@ -91,8 +48,12 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 1.0f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0.5f, TOP, 0, 0); - it.background = "white".color - addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 4, 0).to(RIGHT, 0, 0, BOTTOM, 0, 0) + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 4, 0).to(RIGHT, 0, 0, BOTTOM, 0, 0) => [ + it.foreground = NODE_TEXT.color + ] ]; } @@ -102,8 +63,12 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 1.0f, TOP, 0, 0.0f); it.points += createKPosition(LEFT, 0, 1.0f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 0.5f); - it.background = "white".color - addText("").setAreaPlacementData.from(LEFT, 2, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 2, 0) + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + addText("").setAreaPlacementData.from(LEFT, 2, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 2, 0) => [ + it.foreground = NODE_TEXT.color + ] ]; } @@ -113,8 +78,12 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 1.0f, TOP, 0, 0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 0f); it.points += createKPosition(LEFT, 0, 0.5f, TOP, 0, 1.0f); - it.background = "white".color - addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 10, 0) + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 10, 0) => [ + it.foreground = NODE_TEXT.color + ] ]; } @@ -124,8 +93,12 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 1.0f, TOP, 0, 0.5f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 0.0f); - it.background = "white".color - addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 4, 0) + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + it.addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 4, 0) => [ + it.foreground = NODE_TEXT.color + ] ]; } @@ -136,10 +109,11 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 0.5f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0f, TOP, 0, 0.5f); it.points += createKPosition(LEFT, 0, 0.5f, TOP, 0, 0f); - it.background = "white".color - it.addText("").setAreaPlacementData. - from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 1, 0, BOTTOM, 1, 0) => [ - it.background = "white".color + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + it.addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 1, 0, BOTTOM, 1, 0) => [ + it.foreground = NODE_TEXT.color it.background.alpha = 196 ] ]; @@ -153,8 +127,12 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 0.33f); it.points += createKPosition(LEFT, 0, 0.5f, TOP, 0, 0); - it.background = "white".color - addText("") + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + addText("") => [ + it.foreground = NODE_TEXT.color + ] ]; } @@ -166,8 +144,12 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 0.25f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 0.5f); it.points += createKPosition(LEFT, 0, 0.25f, TOP, 0, 0); - it.background = "white".color - addText("").setAreaPlacementData.from(LEFT, 10, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 3, 0) + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + addText("").setAreaPlacementData.from(LEFT, 10, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 3, 0) => [ + it.foreground = NODE_TEXT.color + ] ]; } @@ -179,8 +161,12 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 0.0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 0.66f); it.points += createKPosition(LEFT, 0, 0.5f, TOP, 0, 1.0f); - it.background = "white".color - addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 4, 0) + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 0, 0, BOTTOM, 4, 0) => [ + it.foreground = NODE_TEXT.color + ] ]; } @@ -192,8 +178,12 @@ class SCGraphShapes { it.points += createKPosition(LEFT, 0, 0.75f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 1.0f); it.points += createKPosition(LEFT, 0, 0.0f, TOP, 0, 0.0f); - it.background = "white".color - addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 10, 0, BOTTOM, 2, 0) + + it.foreground = NODE_FOREGROUND.color + it.background = NODE_BACKGROUND.color + addText("").setAreaPlacementData.from(LEFT, 0, 0, TOP, 0, 0).to(RIGHT, 10, 0, BOTTOM, 2, 0) => [ + it.foreground = NODE_TEXT.color + ] ]; } diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphSynthesisHelper.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphSynthesisHelper.xtend index fe58981514..19e1ecb718 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphSynthesisHelper.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphSynthesisHelper.xtend @@ -155,7 +155,9 @@ class SCGraphSynthesisHelper { def initialiseFigure(KNode node, Object object) { node.setMinimalNodeSize(MINIMALWIDTH, MINIMALHEIGHT) val figure = node.data.filter(KContainerRendering).last - if(SHOW_SHADOW.booleanValue) figure.shadow = "black".color + figure.foreground = NODE_FOREGROUND.color + figure.background = NODE_BACKGROUND.color + if(SHOW_SHADOW.booleanValue) figure.shadow = NODE_SHADOW.color var label = "" if (object instanceof Annotatable) { if (object.hasAnnotation(ANNOTATION_LABEL)) { @@ -168,7 +170,8 @@ class SCGraphSynthesisHelper { } else if (object instanceof String) { label = object } - figure.children.filter(KText).head.text = label + val ktext = figure.children.filter(KText).head + ktext.text = label } /** @@ -211,6 +214,7 @@ class SCGraphSynthesisHelper { edge.setProperty(CoreOptions::EDGE_ROUTING, EdgeRouting::ORTHOGONAL); edge.addRoundedBendsPolyline(8, CONTROLFLOW_THICKNESS.floatValue) => [ it.lineStyle = LineStyle::DOT; + it.foreground = CONTROLFLOW_EDGE.color ] if (USE_ADAPTIVEZOOM.booleanValue) edge.setProperty(KlighdProperties.VISIBILITY_SCALE_LOWER_BOUND, 0.70); diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphsDiagramSynthesisOld.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphsDiagramSynthesisOld.xtend index f4f22e470f..26bb77fbc6 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphsDiagramSynthesisOld.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/SCGraphsDiagramSynthesisOld.xtend @@ -1594,8 +1594,8 @@ class SCGraphsDiagramSynthesisOld extends AbstractDiagramSynthesis { aNode.setMinimalNodeSize(16, 16) aNode.addRoundedRectangle(1, 1, 1) => [ - setBackgroundGradient(COMMENT_BACKGROUND_GRADIENT_1.color2, COMMENT_BACKGROUND_GRADIENT_2.color2, 90); - foreground = COMMENT_FOREGROND.color2; + setBackgroundGradient(COMMENT_BACKGROUND_GRADIENT_1.color, COMMENT_BACKGROUND_GRADIENT_2.color, 90); + foreground = COMMENT_FOREGROND.color; ] aNode.getKContainerRendering.addText(commentText) => [ fontSize = 8; diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/NodePriorityActions.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/NodePriorityActions.xtend index 30787368cf..939c238c75 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/NodePriorityActions.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/NodePriorityActions.xtend @@ -14,9 +14,9 @@ package de.cau.cs.kieler.scg.klighd.actions import com.google.inject.Guice import com.google.inject.Inject -import de.cau.cs.kieler.klighd.IAction import de.cau.cs.kieler.klighd.SynthesisOption import de.cau.cs.kieler.klighd.ViewContext +import de.cau.cs.kieler.klighd.actions.SynthesizingAction import de.cau.cs.kieler.klighd.kgraph.KNode import de.cau.cs.kieler.klighd.krendering.extensions.KRenderingExtensions import de.cau.cs.kieler.scg.klighd.SCGraphSynthesisHelper @@ -30,7 +30,7 @@ import static extension de.cau.cs.kieler.klighd.util.ModelingUtil.* * @author lpe * */ -class NodePriorityActions implements IAction { +class NodePriorityActions extends SynthesizingAction { private static final String NODE_ID = "de.cau.cs.kieler.scg.klighd.actions.priorityActions" @@ -78,8 +78,4 @@ class NodePriorityActions implements IAction { } } - new() { - Guice.createInjector.injectMembers(this) - } - } diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/OptNodePrioActions.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/OptNodePrioActions.xtend index 32a7ff1c1c..3ef7d9f803 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/OptNodePrioActions.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/OptNodePrioActions.xtend @@ -23,13 +23,14 @@ import de.cau.cs.kieler.scg.klighd.SCGraphSynthesisHelper import static de.cau.cs.kieler.scg.klighd.SCGraphSynthesisOptions.* import static extension de.cau.cs.kieler.klighd.util.ModelingUtil.* +import de.cau.cs.kieler.klighd.actions.SynthesizingAction /** * Action class to display the optimized node priorities in the scg. * @author lpe * */ -class OptNodePrioActions implements IAction { +class OptNodePrioActions extends SynthesizingAction { @Inject extension KRenderingExtensions @@ -78,8 +79,4 @@ class OptNodePrioActions implements IAction { } } - new(){ - Guice.createInjector.injectMembers(this) - } - } diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/PrioStatementsActions.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/PrioStatementsActions.xtend index afd8e860e6..689ad0dc26 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/PrioStatementsActions.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/PrioStatementsActions.xtend @@ -24,13 +24,14 @@ import de.cau.cs.kieler.scg.klighd.SCGraphDiagramSynthesis import static de.cau.cs.kieler.scg.klighd.SCGraphSynthesisOptions.* import static extension de.cau.cs.kieler.klighd.util.ModelingUtil.* +import de.cau.cs.kieler.klighd.actions.SynthesizingAction /** * Action class to display the prio statements in the SCG. * @author lpe * */ -class PrioStatementsActions implements IAction { +class PrioStatementsActions extends SynthesizingAction { private static final String PRIO_STATEMENTS_ID = "de.cau.cs.kieler.scg.klighd.actions.priorityStatements" @@ -94,9 +95,4 @@ class PrioStatementsActions implements IAction { } } - new(){ - Guice.createInjector.injectMembers(this) - } - - } \ No newline at end of file diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/SCCActions.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/SCCActions.xtend index ff1a163bdd..71a43992e0 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/SCCActions.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/SCCActions.xtend @@ -12,9 +12,7 @@ */ package de.cau.cs.kieler.scg.klighd.actions -import com.google.inject.Guice import com.google.inject.Inject -import de.cau.cs.kieler.klighd.IAction import de.cau.cs.kieler.klighd.SynthesisOption import de.cau.cs.kieler.klighd.ViewContext import de.cau.cs.kieler.klighd.kgraph.KNode @@ -29,13 +27,14 @@ import org.eclipse.elk.graph.properties.Property import static de.cau.cs.kieler.scg.klighd.SCGraphSynthesisOptions.* import static extension de.cau.cs.kieler.klighd.util.ModelingUtil.* +import de.cau.cs.kieler.klighd.actions.SynthesizingAction /** * Action class to display Strongly Connected Components in the SCG. * @author lpe * */ -class SCCActions implements IAction { +class SCCActions extends SynthesizingAction { private final static String SCC_ID = "de.cau.cs.kieler.scg.klighd.actions.sccActions" @@ -76,11 +75,6 @@ class SCCActions implements IAction { return ActionResult.createResult(true) } - - new(){ - Guice.createInjector.injectMembers(this) - } - /** * Convenience getter. * diff --git a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/ThreadPriorityActions.xtend b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/ThreadPriorityActions.xtend index 1904af7f43..0d22d4a413 100644 --- a/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/ThreadPriorityActions.xtend +++ b/plugins/de.cau.cs.kieler.scg.klighd/src/de/cau/cs/kieler/scg/klighd/actions/ThreadPriorityActions.xtend @@ -12,9 +12,7 @@ */ package de.cau.cs.kieler.scg.klighd.actions -import com.google.inject.Guice import com.google.inject.Inject -import de.cau.cs.kieler.klighd.IAction import de.cau.cs.kieler.klighd.SynthesisOption import de.cau.cs.kieler.klighd.ViewContext import de.cau.cs.kieler.klighd.kgraph.KNode @@ -24,13 +22,14 @@ import de.cau.cs.kieler.scg.klighd.SCGraphDiagramSynthesis import static de.cau.cs.kieler.scg.klighd.SCGraphSynthesisOptions.* import static extension de.cau.cs.kieler.klighd.util.ModelingUtil.* +import de.cau.cs.kieler.klighd.actions.SynthesizingAction /** * Action class to display the thread priorities in the SCG * @author lpe * */ -class ThreadPriorityActions implements IAction { +class ThreadPriorityActions extends SynthesizingAction { @Inject extension KRenderingExtensions @@ -77,8 +76,4 @@ class ThreadPriorityActions implements IAction { + option.getName() + " expecting a Boolean value."); } } - - new(){ - Guice.createInjector.injectMembers(this) - } } \ No newline at end of file diff --git a/plugins/de.cau.cs.kieler.simulation.ide/src/de/cau/cs/kieler/simulation/ide/synthesis/SimulationContextSynthesis.xtend b/plugins/de.cau.cs.kieler.simulation.ide/src/de/cau/cs/kieler/simulation/ide/synthesis/SimulationContextSynthesis.xtend index 65c7c2e2ab..65b962c2ed 100644 --- a/plugins/de.cau.cs.kieler.simulation.ide/src/de/cau/cs/kieler/simulation/ide/synthesis/SimulationContextSynthesis.xtend +++ b/plugins/de.cau.cs.kieler.simulation.ide/src/de/cau/cs/kieler/simulation/ide/synthesis/SimulationContextSynthesis.xtend @@ -13,8 +13,8 @@ package de.cau.cs.kieler.simulation.ide.synthesis import com.google.inject.Inject +import de.cau.cs.kieler.klighd.LightDiagramServices import de.cau.cs.kieler.klighd.ide.model.MessageModel -import de.cau.cs.kieler.klighd.ide.syntheses.MessageModelSynthesis import de.cau.cs.kieler.klighd.kgraph.KNode import de.cau.cs.kieler.klighd.krendering.Colors import de.cau.cs.kieler.klighd.krendering.KImage @@ -39,9 +39,6 @@ class SimulationContextSynthesis extends AbstractDiagramSynthesis