Skip to content

Commit

Permalink
Merge pull request #182 from kieler/nre/sprotty-111
Browse files Browse the repository at this point in the history
Update Sprotty to 1.1.1, remove plugin-nature from LSP
  • Loading branch information
NiklasRentzCAU authored Mar 13, 2024
2 parents 15affb9 + 0a2319b commit ccf948c
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 56 deletions.
3 changes: 0 additions & 3 deletions build/de.cau.cs.kieler.klighd.repository/category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@
</feature>

<bundle id="de.cau.cs.kieler.klighd.standalone" version="2.3.1.qualifier"/>
<bundle id="de.cau.cs.kieler.klighd.lsp" version="2.3.1.qualifier"/>
<bundle id="de.cau.cs.kieler.klighd.lsp.source" version="2.3.1.qualifier"/>

<repository-reference location="https://download.eclipse.org/releases/2023-12/" enabled="true" />
<repository-reference location="https://download.eclipse.org/modeling/mdt/uml2/updates/5.4/" enabled="true" />
<repository-reference location="https://download.eclipse.org/elk/updates/releases/0.9.0/" enabled="true" />
<repository-reference location="https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.33.0/" enabled="true" />
<repository-reference location="https://xtext.github.io/download/updates/releases/2.1.1/" enabled="true" />
<repository-reference location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.30.0" enabled="true" />
<repository-reference location="https://rtsys.informatik.uni-kiel.de/~kieler/updatesite/sprotty/0.9.0/" enabled="true" />
</site>
2 changes: 0 additions & 2 deletions build/de.cau.cs.kieler.klighd.repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
<associateSite>https://xtext.github.io/download/updates/releases/2.1.1/</associateSite>>
<!-- Eclipse Orbit for Google Guave, Apache Batik, ... -->
<associateSite>https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.30.0</associateSite>
<!-- Sprotty ... -->
<associateSite>https://rtsys.informatik.uni-kiel.de/~kieler/updatesite/sprotty/0.9.0/</associateSite>
</associateSites>
<siteTemplateFolder>siteTemplate</siteTemplateFolder>
<symbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,5 @@
<unit id="org.hamcrest.core" version="1.3.0.v20230809-1000"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.30.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.sprotty" version="0.0.0"/>
<repository location="https://rtsys.informatik.uni-kiel.de/~kieler/updatesite/sprotty/0.9.0/"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,5 @@
<unit id="org.hamcrest.core" version="1.3.0.v20230809-1000"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.30.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.sprotty" version="0.0.0"/>
<repository location="https://rtsys.informatik.uni-kiel.de/~kieler/updatesite/sprotty/0.9.0/"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,5 @@
<unit id="org.hamcrest.core" version="1.3.0.v20230809-1000"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.30.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.sprotty" version="0.0.0"/>
<repository location="https://rtsys.informatik.uni-kiel.de/~kieler/updatesite/sprotty/0.9.0/"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,5 @@
<unit id="org.hamcrest.core" version="1.3.0.v20230809-1000"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.30.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.sprotty" version="0.0.0"/>
<repository location="https://rtsys.informatik.uni-kiel.de/~kieler/updatesite/sprotty/0.9.0/"/>
</location>
</locations>
</target>
26 changes: 23 additions & 3 deletions plugins/de.cau.cs.kieler.klighd.lsp/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,28 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="src" path="xtend-gen/"/>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="xtend-gen">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src-gen">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
11 changes: 0 additions & 11 deletions plugins/de.cau.cs.kieler.klighd.lsp/.project
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
Expand All @@ -35,6 +25,5 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/src=UTF-8
encoding/xtend-gen=UTF-8
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ BuilderConfiguration.is_project_specific=true
eclipse.preferences.version=1
outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen
outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen
outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen
outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
1 change: 0 additions & 1 deletion plugins/de.cau.cs.kieler.klighd.lsp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
</parent>

<artifactId>de.cau.cs.kieler.klighd.lsp</artifactId>
<packaging>eclipse-plugin</packaging>

<name>KIELER Lightweight Diagrams as Language Server</name>
<description>KIELER Lightweight Diagrams as Language Server</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2018-2022 by
* Copyright 2018-2024 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
Expand Down Expand Up @@ -384,11 +384,9 @@ class KGraphDiagramServer extends LanguageAwareDiagramServer {
* FIXME Remove this if UpdateModelAction has a cause.
*/
override protected handle(RequestModelAction request) {
if (model.type == 'NONE' && diagramLanguageServer !== null) {
if (!request.requestId.nullOrEmpty)
LOG.warn("Model requests are not supported by the Xtext diagram server.")
if (diagramLanguageServer !== null) {
copyOptions(request)
diagramLanguageServer.diagramUpdater.updateDiagram(this)
diagramLanguageServer.diagramUpdater.updateDiagram(this, request)
} else {
super.handle(request)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2019, 2020, 2021 by
* Copyright 2019-2024 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
Expand Down Expand Up @@ -37,10 +37,12 @@ import java.util.Map
import java.util.concurrent.CompletableFuture
import org.eclipse.emf.common.util.URI
import org.eclipse.emf.ecore.EObject
import org.eclipse.sprotty.Action
import org.eclipse.sprotty.IDiagramServer
import org.eclipse.sprotty.SGraph
import org.eclipse.sprotty.SModelElement
import org.eclipse.sprotty.xtext.ILanguageAwareDiagramServer
import org.eclipse.sprotty.xtext.LanguageAwareDiagramServer
import org.eclipse.sprotty.xtext.ls.DiagramLanguageServer
import org.eclipse.sprotty.xtext.ls.DiagramUpdater
import org.eclipse.xtext.util.CancelIndicator
Expand Down Expand Up @@ -137,7 +139,19 @@ class KGraphDiagramUpdater extends DiagramUpdater {
}

override protected doUpdateDiagrams(String uri, List<? extends ILanguageAwareDiagramServer> diagramServers) {
if (diagramServers.empty) {
diagramServers.forEach[updateDiagram(it as LanguageAwareDiagramServer, null)]
return CompletableFuture.completedFuture(null)
}

override updateDiagram(LanguageAwareDiagramServer server_, Action cause) {
if (!(server_ instanceof KGraphDiagramServer)) return super.updateDiagram(server_, cause)

val server = server_ as KGraphDiagramServer
val uri = server.sourceUri
if (uri.isNullOrEmpty) {
val exc = new RuntimeException("Missing property 'sourceUri'.")
server.rejectRemoteRequest(cause, exc)
// LOG.error("Failed to update diagram.", exc)
return CompletableFuture.completedFuture(null)
}
return (languageServer as KGraphLanguageServerExtension).doRead(uri) [ resource, ci |
Expand Down Expand Up @@ -166,16 +180,13 @@ class KGraphDiagramUpdater extends DiagramUpdater {
new StringBuilder, [builder, error | builder.append("\n" + error)]).toString
model = new MessageModel("The model contains errors:\n" + errors)
}
val model_ = model;
(diagramServers as List<KGraphDiagramServer>).forEach [ KGraphDiagramServer server |
// Only update an erroneous model if there was no diagram shown before.
if (!hasErrors || server.currentRoot.type == "NONE") {
synchronized (diagramState) {
prepareModel(server, model_, uri)
updateLayout(server)
}
// Only update an erroneous model if there was no diagram shown before.
if (!hasErrors || server.currentRoot.type == "NONE") {
synchronized (diagramState) {
prepareModel(server, model, uri)
updateLayout(server)
}
]
}
return null as Void
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ class KGraphLanguageServerExtension extends SyncDiagramLanguageServer
override accept(ActionMessage message) {
if (message.action instanceof RequestModelAction) {
val action = message.action as RequestModelAction
val diagramType = action.diagramType
?: action.options.get(DiagramOptions.OPTION_DIAGRAM_TYPE)
val diagramType = action.options.get(DiagramOptions.OPTION_DIAGRAM_TYPE)
val server = diagramServerManager.getDiagramServer(diagramType, message.clientId)
// If a diagram server is requested for the same client, but a different source file, then close the old server.
// If the server does not have options yet, the server has not been used yet and does not need to be relaunched.
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<guava-version>32.1.3-jre</guava-version>
<guice-version>7.0.0</guice-version>
<jface-version>3.32.0</jface-version>
<lsp4j-version>0.21.1</lsp4j-version>
<sprotty-version>0.9.0</sprotty-version>
<lsp4j-version>0.22.0</lsp4j-version>
<sprotty-version>1.1.1</sprotty-version>
<swt-mock-version>0.1.0</swt-mock-version>
<swt-version>3.124.200</swt-version>
<tycho-version>2.7.3</tycho-version>
Expand Down

0 comments on commit ccf948c

Please sign in to comment.