Skip to content
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be empty. I guess this is in here because you want to use a service interface?

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.eclipse.xtext.Constants
import org.eclipse.xtext.IGrammarAccess
import org.eclipse.xtext.ide.server.ILanguageServerExtension
import org.eclipse.xtext.util.Modules2
import de.cau.cs.kieler.klighd.lsp.structuredProgramming.sccharts.StructuredProgScchartLanguageServerExtension
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactoring this to be in the semantic would allow to collect the LS extension via a service interface as done in line 63.


/**
* Provides methods to create a LS.
Expand All @@ -37,6 +38,8 @@ class LSCreator extends AbstractLsCreator {

RectpackingInteractiveLanguageServerExtension rectPack

StructuredProgScchartLanguageServerExtension structProgScchart

List<ILSDiagramHighlighter> diagramHighlighters

List<ILanguageServerExtension> iLanguageServerExtensions
Expand All @@ -54,7 +57,9 @@ class LSCreator extends AbstractLsCreator {
override getLanguageServerExtensions() {
constraints = injector.getInstance(LayeredInteractiveLanguageServerExtension)
rectPack = injector.getInstance(RectpackingInteractiveLanguageServerExtension)
iLanguageServerExtensions = newArrayList(constraints, rectPack)
structProgScchart = injector.getInstance(StructuredProgScchartLanguageServerExtension)

iLanguageServerExtensions = newArrayList(constraints, rectPack, structProgScchart)
for (lse : KielerServiceLoader.load(ILanguageServerContribution)) {
iLanguageServerExtensions.add(lse.getLanguageServerExtension(injector))
}
Expand All @@ -75,6 +80,8 @@ class LSCreator extends AbstractLsCreator {
}
constraints.client = languageClient as KGraphLanguageClient
rectPack.client = languageClient as KGraphLanguageClient
structProgScchart.client = languageClient as KGraphLanguageClient

diagramHighlighters = newArrayList
for (iLSdhc : KielerServiceLoader.load(ILSDiagramHighlighterContribution)) {
var highlighter = iLSdhc.getHighlighter(injector)
Expand Down
3 changes: 2 additions & 1 deletion plugins/de.cau.cs.kieler.sccharts.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Require-Bundle: de.cau.cs.kieler.klighd,
org.eclipse.jdt.core;bundle-version="3.19.0",
de.cau.cs.kieler.kicool.ide,
de.cau.cs.kieler.annotations.ide,
org.eclipse.elk.core.service
org.eclipse.elk.core.service,
de.cau.cs.kieler.klighd.lsp;bundle-version="2.2.1"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this dependency should not be necessary.
Maybe all the SCCharts structured editing should be in a new package in scharts.ide?

Are the changes in sccharts.ui from your work or from the work on the proxies?

Bundle-Vendor: Kiel University
Bundle-ActivationPolicy: lazy
Export-Package: de.cau.cs.kieler.sccharts.ui,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ de.cau.cs.kieler.sccharts.ui.synthesis.hooks.InducedDataflowHook
de.cau.cs.kieler.sccharts.ui.synthesis.hooks.ShowStateDependencyHook
de.cau.cs.kieler.sccharts.ui.synthesis.hooks.ActionsAsDataflowHook
de.cau.cs.kieler.sccharts.ui.debug.hooks.SetBreakpointActionHook
de.cau.cs.kieler.sccharts.ui.synthesis.hooks.ModelOrderHook
de.cau.cs.kieler.sccharts.ui.synthesis.hooks.ModelOrderHook
de.cau.cs.kieler.sccharts.ui.synthesis.hooks.StructuralEditingHook
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ import static de.cau.cs.kieler.sccharts.ui.synthesis.GeneralSynthesisOptions.*
import static extension de.cau.cs.kieler.annotations.ide.klighd.CommonSynthesisUtil.*
import static extension de.cau.cs.kieler.klighd.syntheses.DiagramSyntheses.*
import static extension de.cau.cs.kieler.klighd.util.ModelingUtil.*
import de.cau.cs.kieler.klighd.microlayout.PlacementUtil
import de.cau.cs.kieler.klighd.KlighdOptions
import de.cau.cs.kieler.sccharts.ui.synthesis.filtering.SCChartsSemanticFilterTags

/**
* Transforms {@link ControlflowRegion} into {@link KNode} diagram elements.
Expand All @@ -76,6 +79,13 @@ class ControlflowRegionSynthesis extends SubSynthesis<ControlflowRegion, KNode>

override performTranformation(ControlflowRegion region) {
val node = region.createNode().associateWith(region);
val semanticTags = newArrayList(
SCChartsSemanticFilterTags.REGION,
SCChartsSemanticFilterTags.CONTROLFLOW_REGION
)
node.setLayoutOption(KlighdOptions.SEMANTIC_FILTER_TAGS, semanticTags)
val proxy = createNode().associateWith(region)
val maxProxyLabelLength = 5

node.configureNodeLOD(region)

Expand Down Expand Up @@ -200,14 +210,46 @@ class ControlflowRegionSynthesis extends SubSynthesis<ControlflowRegion, KNode>
if (region.final) addFinalRegionStyle
]
}

proxy.addRegionFigure => [
if (region.override) addOverrideRegionStyle
if (region.abort) addAbortRegionStyle
if (region.final) addFinalRegionStyle
val label = region.serializeHighlighted(true)
if (label.length > 0) {
val name = label.get(0)
if (name.key.length > maxProxyLabelLength) {
label.set(0, new Pair(name.key.subSequence(0, maxProxyLabelLength) + "...", name.value))
}
}
]

val returnNodes = <KNode> newArrayList(node)

if (SHOW_COMMENTS.booleanValue) {
region.getCommentAnnotations.forEach[
node.children += it.transform
val comments = it.transform
node.children += comments
// Comments shouldn't be rendered as proxies
comments.forEach[
setProperty(KlighdProperties.PROXY_VIEW_RENDER_NODE_AS_PROXY, false)
]
]
}
}

// Set size to be square and at least 34 (same as minimal node size)
val proxyBounds = PlacementUtil.estimateSize(proxy)
val minSize = 34
val bigEnough = proxyBounds.width > 10 && proxyBounds.height > 10
proxy.width = bigEnough ? proxyBounds.width : minSize
proxy.height = bigEnough ? proxyBounds.height : minSize
// Use this size to make proxies square
// val size = Math.max(minSize, Math.max(proxyBounds.width, proxyBounds.height))
// Use this to make proxies always be at least minSize x minSize
// proxy.width = Math.max(minSize, proxyBounds.width)

node.setProperty(KlighdProperties.PROXY_VIEW_RENDER_NODE_AS_PROXY, true)
node.setProperty(KlighdProperties.PROXY_VIEW_PROXY_RENDERING, proxy.data)

return returnNodes
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ import org.eclipse.elk.core.options.EdgeRouting
import static de.cau.cs.kieler.sccharts.ui.synthesis.GeneralSynthesisOptions.*

import static extension de.cau.cs.kieler.klighd.syntheses.DiagramSyntheses.*
import de.cau.cs.kieler.klighd.microlayout.PlacementUtil
import de.cau.cs.kieler.klighd.KlighdOptions
import de.cau.cs.kieler.sccharts.ui.synthesis.filtering.SCChartsSemanticFilterTags

/**
* @author ssm
Expand Down Expand Up @@ -80,6 +83,13 @@ class DataflowRegionSynthesis extends SubSynthesis<DataflowRegion, KNode> {

override performTranformation(DataflowRegion region) {
val node = region.createNode().associateWith(region)
val semanticTags = newArrayList(
SCChartsSemanticFilterTags.REGION,
SCChartsSemanticFilterTags.DATAFLOW_REGION
)
node.setLayoutOption(KlighdOptions.SEMANTIC_FILTER_TAGS, semanticTags)
val proxy = createNode().associateWith(region)
val maxProxyLabelLength = 5

node.addLayoutParam(CoreOptions::ALGORITHM, LayeredOptions.ALGORITHM_ID)
//node.setLayoutOption(LayeredOptions.CONSIDER_MODEL_ORDER, OrderingStrategy.PREFER_EDGES)
Expand Down Expand Up @@ -173,11 +183,30 @@ class DataflowRegionSynthesis extends SubSynthesis<DataflowRegion, KNode> {
]
]

proxy.addRegionFigure => [
if (sLabel.length > 0) it.setUserScheduleStyle
if (region.override) addOverrideRegionStyle
if (!CIRCUIT.booleanValue) {
if (label.length > 0) {
val name = label.get(0)
if (name.key.length > maxProxyLabelLength) {
label.set(0, new Pair(name.key.subSequence(0, maxProxyLabelLength) + "...", name.value))
}
}
}
]

node.setSelectionStyle
proxy.setSelectionStyle

if (SHOW_COMMENTS.booleanValue) {
region.getCommentAnnotations.forEach[
node.children += it.transform
val comments = it.transform
node.children += comments
// Comments shouldn't be rendered as proxies
comments.forEach[
setProperty(KlighdProperties.PROXY_VIEW_RENDER_NODE_AS_PROXY, false)
]
]
}

Expand All @@ -187,6 +216,21 @@ class DataflowRegionSynthesis extends SubSynthesis<DataflowRegion, KNode> {
if (!CIRCUIT.booleanValue) {
node.setLayoutOption(CoreOptions::PADDING, new ElkPadding(18d, 7d, 7d, 7d));
}


// Set size to be square and at least 34 (same as minimal node size)
val proxyBounds = PlacementUtil.estimateSize(proxy)
val minSize = 34
val bigEnough = proxyBounds.width > 10 && proxyBounds.height > 10
proxy.width = bigEnough ? proxyBounds.width : minSize
proxy.height = bigEnough ? proxyBounds.height : minSize
// Use this size to make proxies square
// val size = Math.max(minSize, Math.max(proxyBounds.width, proxyBounds.height))
// Use this to make proxies always be at least minSize x minSize
// proxy.width = Math.max(minSize, proxyBounds.width)

node.setProperty(KlighdProperties.PROXY_VIEW_RENDER_NODE_AS_PROXY, true)
node.setProperty(KlighdProperties.PROXY_VIEW_PROXY_RENDERING, node.data)

return <KNode> newArrayList(node)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,49 +35,70 @@ final class GeneralSynthesisOptions {
/**
* The appearance category
*/
public static final SynthesisOption APPEARANCE = SynthesisOption.createCategory(GeneralSynthesisOptions, "Appearance")
public static final SynthesisOption APPEARANCE = SynthesisOption.createCategory(GeneralSynthesisOptions,
"Appearance")
/**
* The navigation category
*/
public static final SynthesisOption NAVIGATION = SynthesisOption.createCategory(GeneralSynthesisOptions, "Navigation", false)
public static final SynthesisOption NAVIGATION = SynthesisOption.createCategory(GeneralSynthesisOptions,
"Navigation", false)
/**
* The debugging category
*/
public static final SynthesisOption DEBUGGING = SynthesisOption.createCategory(GeneralSynthesisOptions, "Analysis / Debugging", false)
public static final SynthesisOption DEBUGGING = SynthesisOption.createCategory(GeneralSynthesisOptions,
"Analysis / Debugging", false)
/**
* The layout category
*/
public static final SynthesisOption LAYOUT = SynthesisOption.createCategory(GeneralSynthesisOptions, "Layout", false)
public static final SynthesisOption LAYOUT = SynthesisOption.createCategory(GeneralSynthesisOptions, "Layout",
false)
/**
* Dataflow category
*/
public static final SynthesisOption DATAFLOW = SynthesisOption.createCategory(GeneralSynthesisOptions, "Dataflow", false).setCategory(APPEARANCE)
public static final SynthesisOption DATAFLOW = SynthesisOption.createCategory(GeneralSynthesisOptions, "Dataflow",
false).setCategory(APPEARANCE)
/**
* References and OO / Inheritance
*/
public static final SynthesisOption OO = SynthesisOption.createCategory(GeneralSynthesisOptions, "Object Orientation / References", false).setCategory(APPEARANCE)

public static final SynthesisOption OO = SynthesisOption.createCategory(GeneralSynthesisOptions,
"Object Orientation / References", false).setCategory(APPEARANCE)

// -- OPTIONS --
/**
* Option for setting the KLayLayered layout
*/
public static final SynthesisOption USE_KLAY = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "KLayLayered", true).setCategory(LAYOUT)
public static final SynthesisOption SHOW_ALL_SCCHARTS = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "All SCCharts", false).setCategory(APPEARANCE)
public static final SynthesisOption SHOW_COMMENTS = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "Comment Nodes", true).setCategory(APPEARANCE)
public static final SynthesisOption SHOW_USER_LABELS = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "User Labels", true).setCategory(APPEARANCE)
public static final SynthesisOption USE_KLAY = SynthesisOption.createCheckOption(GeneralSynthesisOptions,
"KLayLayered", true).setCategory(LAYOUT)
public static final SynthesisOption SHOW_ALL_SCCHARTS = SynthesisOption.createCheckOption(GeneralSynthesisOptions,
"All SCCharts", false).setCategory(APPEARANCE)
public static final SynthesisOption SHOW_COMMENTS = SynthesisOption.createCheckOption(GeneralSynthesisOptions,
"Comment Nodes", true).setCategory(APPEARANCE)
public static final SynthesisOption SHOW_USER_LABELS = SynthesisOption.createCheckOption(GeneralSynthesisOptions,
"User Labels", true).setCategory(APPEARANCE)
/**
* Scope call parameters synthesis option
*/
public static final SynthesisOption SHOW_BINDINGS = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "Binding Parameters", true).setCategory(OO)
public static final SynthesisOption SHOW_BINDINGS = SynthesisOption.createCheckOption(GeneralSynthesisOptions,
"Binding Parameters", true).setCategory(OO)
/**
* inherited declarations and regions synthesis option
*/
public static final SynthesisOption SHOW_INHERITANCE = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "Inheritance Preview", true).setCategory(OO)
public static final SynthesisOption SHOW_INHERITANCE_EDGES = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "Inheritance Hierarchy", false).setCategory(OO)
public static final SynthesisOption SHOW_AGGREGATION_EDGES = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "Aggregation", false).setCategory(OO)
public static final SynthesisOption SHOW_METHOD_BODY = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "Method Implementation", true).setCategory(OO)
public static final SynthesisOption SHOW_INHERITANCE = SynthesisOption.createCheckOption(GeneralSynthesisOptions,
"Inheritance Preview", true).setCategory(OO)
public static final SynthesisOption SHOW_INHERITANCE_EDGES = SynthesisOption.createCheckOption(
GeneralSynthesisOptions, "Inheritance Hierarchy", false).setCategory(OO)
public static final SynthesisOption SHOW_AGGREGATION_EDGES = SynthesisOption.createCheckOption(
GeneralSynthesisOptions, "Aggregation", false).setCategory(OO)
public static final SynthesisOption SHOW_METHOD_BODY = SynthesisOption.createCheckOption(GeneralSynthesisOptions,
"Method Implementation", true).setCategory(OO)
/**
* inherited declarations and regions synthesis option
*/
public static final SynthesisOption SHOW_CAUSAL_DATAFLOW = SynthesisOption.createCheckOption(GeneralSynthesisOptions, "Causal Dataflow",false).setCategory(DEBUGGING)
public static final SynthesisOption SHOW_CAUSAL_DATAFLOW = SynthesisOption.createCheckOption(
GeneralSynthesisOptions, "Causal Dataflow", false).setCategory(DEBUGGING)
/**
* Enables the structured programming mode on the client
*/
public static final SynthesisOption ENABLE_STRUCTURED_PROGRAMMING = SynthesisOption.createCheckOption(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is the only real change, the other ones are whitespace changes?

GeneralSynthesisOptions, "Structured Programming", true).setCategory(APPEARANCE)
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ 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
import de.cau.cs.kieler.klighd.filtering.SemanticFilterTag
import de.cau.cs.kieler.klighd.KlighdOptions
import de.cau.cs.kieler.sccharts.ui.synthesis.filtering.SCChartsSemanticFilterRules

/**
* Main diagram synthesis for SCCharts.
Expand Down Expand Up @@ -125,7 +129,8 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis<SCCharts> {
SHOW_METHOD_BODY,
SHOW_COMMENTS,
SHOW_USER_LABELS,
SHOW_CAUSAL_DATAFLOW
SHOW_CAUSAL_DATAFLOW,
ENABLE_STRUCTURED_PROGRAMMING
)

// Adaptive Zoom
Expand Down Expand Up @@ -167,6 +172,12 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis<SCCharts> {
} else sccharts

val rootNode = createNode

// Set semantic filter rules
val rules = SCChartsSemanticFilterRules.fields.map[
get(null) as SemanticFilterRule
]
rootNode.setLayoutOption(KlighdOptions.SEMANTIC_FILTER_RULES, rules)

// If dot is used draw edges first to prevent overlapping with states when layout is bad
usedContext.setProperty(KlighdProperties.EDGES_FIRST, !USE_KLAY.booleanValue)
Expand All @@ -187,7 +198,12 @@ class SCChartsSynthesis extends AbstractDiagramSynthesis<SCCharts> {
if (scc.hasPragma(PRAGMA_SKINPATH)) {
setSkinPath(scc.getStringPragmas(PRAGMA_SKINPATH).head.values.head, usedContext)
}


//Enables or disables the display of the contextmenu on the client.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after //

//We want this on the server since not all languages are suported and the contextmenu should only be generated if there is a server implementation for it
rootNode.setProperty(KlighdProperties.SHOW_STRUCTURED_EDITING_MENU, ENABLE_STRUCTURED_PROGRAMMING.booleanValue)


if (SHOW_ALL_SCCHARTS.booleanValue) {
val rootStateNodes = <State, KNode> newHashMap
val rootStates = newLinkedHashSet
Expand Down
Loading