Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into als/master
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sr committed Dec 12, 2024
2 parents 9006cd3 + b3353ad commit f2a2d95
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
distribution: 'temurin'

# Configure maven artifact caching
- name: Cache local Maven repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<unit id="org.eclipse.emf.mwe2.launcher.feature.group" version="0.0.0"/>
<unit id="org.eclipse.epp.mpc.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2024-03"/>
<repository location="https://download.eclipse.org/releases/2024-09"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="false" type="InstallableUnit">
<!-- Required for JUnit4 Tests to be able to run -->
Expand All @@ -21,12 +21,12 @@
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="false" type="InstallableUnit">
<unit id="com.google.gson" version="0.0.0"/>
<unit id="org.freemarker.freemarker" version="0.0.0"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.31.0"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.32.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="false" type="InstallableUnit">
<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.xtext.ui.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.34.0/"/>
<repository location="https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.36.0/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="false" type="InstallableUnit">
<unit id="de.cau.cs.kieler.klighd.feature.feature.group" version="0.0.0"/>
Expand Down
6 changes: 3 additions & 3 deletions build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<!-- Language server dependency versions -->
<elk-version>0.9.1</elk-version>
<klighd-version>3.0.2.v20240507</klighd-version>
<lsp4j-version>0.22.0</lsp4j-version>
<lsp4j-version>0.23.0</lsp4j-version>
<pragmatics-version>0.51.0.v20240410</pragmatics-version>

<!-- Xtext compile dependency versions -->
<xtend-version>2.34.0</xtend-version>
<xtext-version>2.34.0</xtext-version>
<xtend-version>2.36.0</xtend-version>
<xtext-version>2.36.0</xtext-version>

<!-- Tycho -->
<tycho-version>2.7.5</tycho-version>
Expand Down
1 change: 1 addition & 0 deletions build/scripts/uberjar.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
'META-INF/NOTICE',
'META-INF/p2.inf',
'META-INF/versions/*/module-info.class',
'META-INF/versions/*/OSGI-INF/MANIFEST.MF',
'OSGI-INF/l10n/bundle.properties',
'OSGI-INF/repositoryManager.xml',
'docs/*',
Expand Down
65 changes: 64 additions & 1 deletion language-server/de.cau.cs.kieler.language.server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,56 @@

<!-- Other depencencies -->

<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.disco</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.force</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.graphviz.dot</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.graphviz.layouter</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.layered</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.mrtree</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.radial</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.rectpacking</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.spore</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
<artifactId>org.eclipse.elk.alg.topdownpacking</artifactId>
<version>${elk-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext</artifactId>
Expand Down Expand Up @@ -85,6 +135,19 @@
<version>${lsp4j-version}</version>
</dependency>


<!-- Somehow important -->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.core.runtime</artifactId>
<version>3.31.100</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
<version>3.19.100</version>
</dependency>

<!-- Additional dependencies that the downstream Eclipse bundles do not list as Maven dependencies. -->

<!-- https://mvnrepository.com/artifact/org.freemarker/freemarker -->
Expand All @@ -97,7 +160,7 @@
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.30.0</version>
<version>3.39.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
<!-- <dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import org.eclipse.xtext.ide.server.ILanguageServerExtension
import org.eclipse.xtext.ide.server.concurrent.RequestManager
import org.eclipse.xtext.resource.XtextResourceSet
import org.eclipse.xtext.util.CancelIndicator
import de.cau.cs.kieler.core.services.KielerLanguage

/**
* Implements methods to extend the LSP to allow compilation. Moreover, getting compilation systems and showing
Expand All @@ -63,6 +64,8 @@ import org.eclipse.xtext.util.CancelIndicator
class KiCoolLanguageServerExtension implements ILanguageServerExtension, KiCoolCommandExtension, ILanguageClientProvider {

protected static val LOG = Logger.getLogger(KiCoolLanguageServerExtension)

protected static val LANGUAGES = KielerLanguage.getAllRegisteredLanguages()

@Inject @Accessors(PUBLIC_GETTER) RequestManager requestManager

Expand Down Expand Up @@ -305,16 +308,29 @@ class KiCoolLanguageServerExtension implements ILanguageServerExtension, KiCoolC
* @return CS specified by the above parameters.
*/
def getCompilationSystems(String uri, int index, boolean filterForSimulation, boolean snapshotModel) {
var Object model
var Class<?> modelClass
if (snapshotModel && diagramState !== null && diagramState.getKGraphContext(uri) !== null) {
model = diagramState.getKGraphContext(uri).inputModel
modelClass = diagramState.getKGraphContext(uri).inputModel?.class
} else if (index != -1) {
model = this.objectMap.get(uri).get(index)
modelClass = this.objectMap.get(uri).get(index)?.class
} else {
// get model of model specified by uri
model = getModelFromUri(uri)
for(l : LANGUAGES) {
for(ext: l.supportedResourceExtensions) {
if (uri.endsWith(ext)) {
if (l.supportedModels.size == 1) {
modelClass = l.supportedModels.head
} else {
modelClass = l.supportedModels.get(l.supportedResourceExtensions.indexOf(ext))
}
}
}
}
if (modelClass === null) {
// get model of model specified by uri (reparsing)
modelClass = getModelFromUri(uri)?.class
}
}
return getCompilationSystems(model, filterForSimulation, snapshotModel)
return getCompilationSystems(modelClass, filterForSimulation, snapshotModel)
}

/**
Expand All @@ -324,10 +340,10 @@ class KiCoolLanguageServerExtension implements ILanguageServerExtension, KiCoolC
* @param filterForSimulation true if only simulation cs should be returned
* @return CS specified by the above parameters.
*/
def getCompilationSystems(Object model, boolean filterForSimulation, boolean snapshotModel) {
def getCompilationSystems(Class<?> modelClass, boolean filterForSimulation, boolean snapshotModel) {
this.getSystemsThread = new GetSystemsThread([
if (model !== null && model.class !== modelClassFilter) {
modelClassFilter = model.class
if (modelClass !== null && modelClass !== modelClassFilter) {
modelClassFilter = modelClass
}
var systems = getSystemModels(true, modelClassFilter)
var systemDescriptions = getSystemDescription(systems, snapshotModel)
Expand Down
10 changes: 5 additions & 5 deletions oomph/kieler-semantics-developers.setup
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@
versionRange="2.7.0"/>
<requirement
name="org.eclipse.xtext.sdk.feature.group"
versionRange="[2.34.0,2.35.0)"/>
versionRange="[2.36.0,2.37.0)"/>
<requirement
name="org.eclipse.emf.mwe2.launcher.feature.group"/>
<requirement
Expand Down Expand Up @@ -519,11 +519,11 @@
<repositoryList
name="FixedTarget">
<repository
url="https://download.eclipse.org/releases/2024-03"/>
url="https://download.eclipse.org/releases/2024-09"/>
<repository
url="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.31.0"/>
url="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.32.0"/>
<repository
url="https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.34.0/"/>
url="https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.36.0/"/>
<repository
url="https://download.eclipse.org/elk/updates/releases/0.9.1/"/>
<repository
Expand All @@ -539,7 +539,7 @@
xsi:type="setup.p2:P2Task">
<requirement
name="org.eclipse.xtext.sdk.feature.group"
versionRange="[2.34.0,2.35.0)"/>
versionRange="[2.36.0,2.37.0)"/>
<repository
url="http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/"/>
</setupTask>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ class SignalTransformation extends AbstractSCEstDynamicProcessor<Module> {
val parallel = createParallel
val thread2 = createThread
parallel.threads.add(thread2)
thread2.statements.addAll(module.statements)
thread2.statements.add(createAssignment(term, createTrue))
var scope = createScopeStatement
thread2.statements.add(scope)
scope.statements.addAll(module.statements)
scope.statements.add(createAssignment(term, createTrue))
module.statements.add(parallel)
module.declarations.add(decl)

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.FontSizeHook
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class StateSynthesis extends SubSynthesis<State, KNode> {
|| !state.declarations.filter(MethodImplementationDeclaration).empty
|| (SHOW_INSTANCES.booleanValue && !state.declarations.filter(ReferenceDeclaration).empty)
) {
node.addRegionsArea
node.addRegionsArea(state)
node.setLayoutOption(CoreOptions.NODE_SIZE_CONSTRAINTS, EnumSet.of(SizeConstraint.MINIMUM_SIZE))
}
}
Expand Down Expand Up @@ -540,7 +540,7 @@ class StateSynthesis extends SubSynthesis<State, KNode> {
node.setLayoutOption(RectPackingOptions.WHITE_SPACE_ELIMINATION_STRATEGY, WhiteSpaceEliminationStrategy.EQUAL_BETWEEN_STRUCTURES)
node.setLayoutOption(RectPackingOptions.OMIT_NODE_MICRO_LAYOUT, true)
node.setLayoutOption(CoreOptions::PADDING, new ElkPadding(0))
node.setLayoutOption(CoreOptions::SPACING_NODE_NODE, 1.0)
node.setLayoutOption(CoreOptions::SPACING_NODE_NODE, 5.0)
}

def static void configureLayoutRegionDependencies(KNode node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ActionsAsDataflowHook extends SynthesisHook {

if (SHOW_ACTIONS_AS_DATAFLOW.booleanValue) {
container.children.remove(actionContainer)
node.addRegionsArea
node.addRegionsArea(state)

val actions = <Action> newArrayList(state.actions)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright ${year} 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.hooks

import com.google.inject.Inject
import de.cau.cs.kieler.klighd.SynthesisOption
import de.cau.cs.kieler.klighd.kgraph.KNode
import de.cau.cs.kieler.klighd.krendering.KRendering
import de.cau.cs.kieler.klighd.krendering.KText
import de.cau.cs.kieler.klighd.krendering.ViewSynthesisShared
import de.cau.cs.kieler.klighd.krendering.extensions.KRenderingExtensions
import de.cau.cs.kieler.sccharts.State
import de.cau.cs.kieler.sccharts.extensions.SCChartsControlflowRegionExtensions
import de.cau.cs.kieler.sccharts.extensions.SCChartsDataflowRegionExtensions
import de.cau.cs.kieler.sccharts.extensions.SCChartsScopeExtensions
import de.cau.cs.kieler.sccharts.extensions.SCChartsStateExtensions
import de.cau.cs.kieler.sccharts.ui.synthesis.GeneralSynthesisOptions

/**
* @author mka
*
*/
@ViewSynthesisShared
class FontSizeHook extends SynthesisHook {

@Inject extension SCChartsControlflowRegionExtensions
@Inject extension SCChartsDataflowRegionExtensions
@Inject extension SCChartsScopeExtensions
@Inject extension SCChartsStateExtensions
@Inject extension KRenderingExtensions

/** Action ID */
public static final String ID = "de.cau.cs.kieler.sccharts.ui.synthesis.hooks.FontSizeHook";

public static final SynthesisOption ADAPTIVE_FONTS =
SynthesisOption.createCheckOption("Adaptive Fonts", false)
.setCategory(GeneralSynthesisOptions::NAVIGATION)

static final int SIMPLE_STATE_FONT_SIZE = 11

static final double SIMPLE_STATE_INCREASE_FACTOR = 0.5

static final int MACRO_STATE_FONT_SIZE = 11

static final double MACRO_STATE_INCREASE_FACTOR = 1.0

static final int MAX_FONT_INCREASE = 15


/** Checks if given state should be visualized as macro state */
def boolean isMacroState(State state) {
return state.controlflowRegionsContainStates || state.containsDataflowRegions || !state.actions.empty ||
!state.declarations.empty || state.isReferencing || state.hasBaseStates;
}

/** returns a new font size based on the base size and the number of siblings
* crowded (many siblings) layouts get a larger font.
*/
def int dynamicFont(int baseSize, int siblingCount, double factor) {
return Math.min((baseSize + factor*(siblingCount - 1)).intValue(), (baseSize + factor*(MAX_FONT_INCREASE)).intValue())
}

override getDisplayedSynthesisOptions() {
return #[ADAPTIVE_FONTS]
}

override processState(State state, KNode node) {

if (ADAPTIVE_FONTS.booleanValue && state.parentRegion !== null) {

val macroFont = dynamicFont(MACRO_STATE_FONT_SIZE, state.parentRegion.states.size, MACRO_STATE_INCREASE_FACTOR)
val simpleFont = dynamicFont(SIMPLE_STATE_FONT_SIZE, state.parentRegion.states.size, SIMPLE_STATE_INCREASE_FACTOR)

if (state.isMacroState) {

node.data.filter(KRendering).map[it.eAllContents.toList].toList.flatten.forEach[
if (it instanceof KText) it.fontSize = macroFont
]
} else if (state.isSimple) {

node.eAllContents.filter(KRendering).toList.forEach[
if (it instanceof KText) it.fontSize = simpleFont
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class ControlflowRegionStyles {
background = REGION_BACKGROUND.color;
foreground = REGION_FOREGROUND.color;
lineWidth = 1;
setSurroundingSpace(2, 0);
]
}

Expand Down
Loading

0 comments on commit f2a2d95

Please sign in to comment.