-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from kieler/sdo/interactiveMrTree
Adds language server interaction possibilities for interactive layout for ELK's MrTree. Cleans up and restructures features related to interactive.
- Loading branch information
Showing
34 changed files
with
1,669 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
....cs.kieler.klighd.lsp/META-INF/services/de.cau.cs.kieler.klighd.lsp.ISprottyActionHandler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
de.cau.cs.kieler.klighd.lsp.interactive.layered.LayeredInteractiveActionHandler | ||
de.cau.cs.kieler.klighd.lsp.interactive.rectpacking.RectpackingInteractiveActionHandler | ||
de.cau.cs.kieler.klighd.lsp.interactive.mrtree.MrTreeActionHandler |
1 change: 1 addition & 0 deletions
1
...lighd.lsp/META-INF/services/de.cau.cs.kieler.klighd.lsp.interactive.IConstraintSerializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
de.cau.cs.kieler.klighd.lsp.interactive.ElkGraphConstraintSerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/interactive/ElkGraphConstraintSerializer.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient | ||
* | ||
* http://rtsys.informatik.uni-kiel.de/kieler | ||
* | ||
* Copyright 2022 by | ||
* + Kiel University | ||
* + Department of Computer Science | ||
* + Real-Time and Embedded Systems Group | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package de.cau.cs.kieler.klighd.lsp.interactive | ||
|
||
import de.cau.cs.kieler.klighd.internal.util.KlighdInternalProperties | ||
import java.util.List | ||
import org.eclipse.elk.graph.ElkNode | ||
import org.eclipse.emf.ecore.resource.Resource | ||
|
||
/** | ||
* Serializes constraint for an ELK graph by just adding the corresponding properties. | ||
* | ||
* @author sdo | ||
* | ||
*/ | ||
class ElkGraphConstraintSerializer implements IConstraintSerializer { | ||
|
||
override canHandle(Object graph) { | ||
return graph instanceof ElkNode | ||
} | ||
|
||
override serializeConstraints( | ||
List<ConstraintProperty<Object>> changedNodes, | ||
Object graph, | ||
Resource resource | ||
) { | ||
val codeBefore = InteractiveUtil.serializeResource(resource) | ||
changedNodes.forEach [ c | | ||
val ElkNode elkNode = c.KNode.getProperty(KlighdInternalProperties.MODEL_ELEMENT) as ElkNode | ||
elkNode.setProperty(c.property, c.value) | ||
] | ||
|
||
val codeAfter = InteractiveUtil.serializeResource(resource) | ||
|
||
return InteractiveUtil.calculateTextEdit(codeBefore, codeAfter) | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/interactive/IConstraintSerializer.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient | ||
* | ||
* http://rtsys.informatik.uni-kiel.de/kieler | ||
* | ||
* Copyright 2022 by | ||
* + Kiel University | ||
* + Department of Computer Science | ||
* + Real-Time and Embedded Systems Group | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package de.cau.cs.kieler.klighd.lsp.interactive | ||
|
||
import java.util.List | ||
import org.eclipse.emf.ecore.resource.Resource | ||
import org.eclipse.lsp4j.TextEdit | ||
|
||
/** | ||
* Service interface for implementations that serialize a set constraint in the model. | ||
* E.g. for ElkGraphs a property is added and the graph serialized, | ||
* for SCCharts an Annotation with a layout constraint is added and the graph serialized. | ||
* | ||
* @author sdo | ||
* | ||
*/ | ||
interface IConstraintSerializer { | ||
/** | ||
* Checks whether this serializer can handle a graph type | ||
* | ||
* @param graph The graph to serialize | ||
* @return true if the graph can be serialized | ||
*/ | ||
def boolean canHandle(Object graph); | ||
|
||
/** | ||
* @param changedNodes The added constraints. | ||
* @param graph The model, e.g. SCChart or ElkGraph. | ||
* @param resource The resource to change | ||
* @return The TextEdit to send to the client consisting of the new text and a range. | ||
*/ | ||
def TextEdit serializeConstraints(List<ConstraintProperty<Object>> changedNodes, Object graph, Resource resource); | ||
} |
Oops, something went wrong.