Skip to content

Commit

Permalink
Deprecated the miss-spelled MODEL_ELEMEMT internal property for a new
Browse files Browse the repository at this point in the history
MODEL_ELEMENT property.
  • Loading branch information
NiklasRentzCAU committed Feb 28, 2024
1 parent 4b6db2d commit b8a076a
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class LayeredInteractiveLanguageServerExtension implements ILanguageServerExtens
for (entry : changedNodes.keySet) {
// set Property of corresponding elkNode
val kNode = entry.KNode
val elkNode = kNode.getProperty(KlighdInternalProperties.MODEL_ELEMEMT)
val elkNode = kNode.getProperty(KlighdInternalProperties.MODEL_ELEMENT)

if (elkNode instanceof ElkNode) {
val value = changedNodes.get(entry)
Expand All @@ -251,7 +251,7 @@ class LayeredInteractiveLanguageServerExtension implements ILanguageServerExtens
}
}

val elkNode = changedNodes.keySet().head.KNode.getProperty(KlighdInternalProperties.MODEL_ELEMEMT)
val elkNode = changedNodes.keySet().head.KNode.getProperty(KlighdInternalProperties.MODEL_ELEMENT)
if (elkNode instanceof ElkNode && changed) {
val Map<String, List<TextEdit>> changes = newHashMap

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class RectpackingInteractiveLanguageServerExtension implements ILanguageServerEx
resource.save(outputStream, emptyMap)
val codeBefore = outputStream.toString

val elkNode = kNode.getProperty(KlighdInternalProperties.MODEL_ELEMEMT)
val elkNode = kNode.getProperty(KlighdInternalProperties.MODEL_ELEMENT)
if (elkNode instanceof ElkNode) {
val Map<String, List<TextEdit>> changes = newHashMap
elkNode.setProperty(RectPackingOptions.ASPECT_RATIO, constraint.aspectRatio)
Expand Down Expand Up @@ -199,12 +199,12 @@ class RectpackingInteractiveLanguageServerExtension implements ILanguageServerEx
val codeBefore = outputStream.toString

for (node : changedNodes) {
val elkNode = node.getProperty(KlighdInternalProperties.MODEL_ELEMEMT)
val elkNode = node.getProperty(KlighdInternalProperties.MODEL_ELEMENT)
if (elkNode instanceof ElkNode) {
InteractiveUtil.copyAllConstraints(elkNode, node)
}
}
val elkNode = changedNodes.get(0).getProperty(KlighdInternalProperties.MODEL_ELEMEMT)
val elkNode = changedNodes.get(0).getProperty(KlighdInternalProperties.MODEL_ELEMENT)
if (elkNode instanceof ElkNode) {
val Map<String, List<TextEdit>> changes = newHashMap

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class LazyTraceProvider extends XtextTraceProvider {
/**
* Generates a trace for the {@code kElement}'s source EObject on the {@code sElement}.
* The kElement must be synthesized by a KLighD synthesis before and must have its source EObject stored in the
* {@link KlighdInternalProperties#MODEL_ELEMEMT} property.
* {@link KlighdInternalProperties#MODEL_ELEMENT} property.
*
* @param sElement The SModelElement that needs a trace to its model element.
* @param kElement The KGraphElement that was generated from some model element.
Expand All @@ -86,7 +86,7 @@ class LazyTraceProvider extends XtextTraceProvider {
// The real model element that can be traced is the EObject that got synthesized in the
// {@link KGraphDiagramGenerator#translateModel} function. That model element has to be stored in the properties
// during the synthesis. Otherwise the tracing will not work.
val modelElement = kElement.properties.get(KlighdInternalProperties.MODEL_ELEMEMT)
val modelElement = kElement.properties.get(KlighdInternalProperties.MODEL_ELEMENT)
if (modelElement instanceof EObject) {
if (modelElement.eResource instanceof XtextResource) {
trace(sElement, modelElement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class KlighdSetup implements IKlighdStartupHook {
@Override
public void execute() {
KlighdDataManager.getInstance()
.registerBlacklistedProperty(KlighdInternalProperties.MODEL_ELEMEMT)
.registerBlacklistedProperty(KlighdInternalProperties.MODEL_ELEMENT)
.registerBlacklistedProperty(LabelManagementOptions.LABEL_MANAGER)
.registerBlacklistedProperty(GridPlacementUtil.ESTIMATED_GRID_DATA)
.registerBlacklistedProperty(GridPlacementUtil.CHILD_AREA_POSITION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,10 @@ public void setZoomStyle(final ZoomStyle zoomStyle) {
*/
public void associateSourceTargetPair(final Object source, final EObject target) {
if (KGraphPackage.eINSTANCE.getKGraphData().isInstance(target)) {
((KGraphData) target).setProperty(KlighdInternalProperties.MODEL_ELEMEMT, source);
((KGraphData) target).setProperty(KlighdInternalProperties.MODEL_ELEMENT, source);

} else if (KGraphPackage.eINSTANCE.getKGraphElement().isInstance(target)) {
((KGraphElement) target).setProperty(KlighdInternalProperties.MODEL_ELEMEMT, source);
((KGraphElement) target).setProperty(KlighdInternalProperties.MODEL_ELEMENT, source);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public Collection<String> getAffectedOptions() {
final String msg = "Concurrent modification in KGraphPropertyLayoutConfig:"
+ Klighd.LINE_SEPARATOR + " element == " + graphElement
+ Klighd.LINE_SEPARATOR + " sourceElement == "
+ graphElement.getProperty(KlighdInternalProperties.MODEL_ELEMEMT);
+ graphElement.getProperty(KlighdInternalProperties.MODEL_ELEMENT);

Klighd.log(new Status(IStatus.ERROR, Klighd.PLUGIN_ID, msg));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ private KlighdInternalProperties() {
* KGraphData}, for {@link de.cau.cs.kieler.klighd.kgraph.KGraphElement KGraphElements} it is to
* be attached to their layout data.
*/
public static final IProperty<Object> MODEL_ELEMEMT = new Property<Object>("klighd.modelElement");
public static final IProperty<Object> MODEL_ELEMENT = new Property<Object>("klighd.modelElement");;

/**
* Deprecated property with a typo, see {@link #MODEL_ELEMENT} as the replacement.
*
* @deprecated
*/
public static final IProperty<Object> MODEL_ELEMEMT = MODEL_ELEMENT;

/**
* Property indicating that the node has been populated. A node is populated, if and only if the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class SourceModelTrackingAdapter extends EContentAdapter {
private static final Predicate<Object> CANDIDATES = KlighdPredicates.instanceOf(
KGraphElement.class, KRendering.class, IPropertyToObjectMapImpl.class);

private static final IProperty<Object> MODEL_ELEMENT = KlighdInternalProperties.MODEL_ELEMEMT;
private static final IProperty<Object> MODEL_ELEMENT = KlighdInternalProperties.MODEL_ELEMENT;

private Object mapsMonitor = this;
private Multimap<Object, EObject> sourceTargetsMap = ArrayListMultimap.create();
Expand Down
Loading

0 comments on commit b8a076a

Please sign in to comment.