package jetbrains.mps.editor.runtime; /*Generated by MPS */ import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.util.annotation.ToRemove; import org.jetbrains.annotations.NotNull; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SConceptOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.lang.smodel.generator.smodelAdapter.AttributeOperations; import jetbrains.mps.lang.smodel.generator.smodelAdapter.IAttributeDescriptor; public class SideTransformInfoUtil { /** * * @deprecated after MPS 3.4 side transform actions will be migrated from actions aspect to editor aspect so the will be referenced directly from editor and anchor tag will not be used. Use {@link jetbrains.mps.editor.runtime.SideTransformInfoUtil#addRightTransformInfo(SNode, String) } */ @Deprecated @ToRemove(version = 3.5) public static void addRightTransformInfo(@NotNull SNode node, @NotNull String cellId, @NotNull String anchorTag) { addTransformInfo(node, cellId, anchorTag, true); } public static void addRightTransformInfo(@NotNull SNode node, @NotNull String cellId) { addTransformInfo(node, cellId, true); } /** * * @deprecated after MPS 3.4 side transform actions will be migrated from actions aspect to editor aspect so the will be referenced directly from editor and anchor tag will not be used. Use {@link jetbrains.mps.editor.runtime.SideTransformInfoUtil#addLeftTransformInfo(SNode, String) } */ @Deprecated @ToRemove(version = 3.5) public static void addLeftTransformInfo(@NotNull SNode node, @NotNull String cellId, @NotNull String anchorTag) { addTransformInfo(node, cellId, anchorTag, false); } public static void addLeftTransformInfo(@NotNull SNode node, @NotNull String cellId) { addTransformInfo(node, cellId, false); } /** * * @deprecated after MPS 3.4 side transform actions will be migrated from actions aspect to editor aspect so the will be referenced directly from editor and anchor tag will not be used. Use {@link jetbrains.mps.editor.runtime.SideTransformInfoUtil#addTransformInfo(SNode, String, boolean) } */ @Deprecated @ToRemove(version = 3.5) private static void addTransformInfo(@NotNull SNode node, @NotNull String cellId, @NotNull String anchorTag, boolean isRight) { SNode info = SConceptOperations.createNewNode(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo")); SPropertyOperations.set(info, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7af1b9bbL, "cellId"), cellId); SPropertyOperations.set(info, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7af1bf58L, "anchorTag"), anchorTag); SPropertyOperations.set(info, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7aee2321L, "side"), (isRight ? "right" : "left")); AttributeOperations.setAttribute(node, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo")), info); } private static void addTransformInfo(@NotNull SNode node, @NotNull String cellId, boolean isRight) { SNode info = SConceptOperations.createNewNode(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo")); SPropertyOperations.set(info, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7af1b9bbL, "cellId"), cellId); SPropertyOperations.set(info, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7aee2321L, "side"), (isRight ? "right" : "left")); AttributeOperations.setAttribute(node, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo")), info); } public static boolean hasRightTransformInfo(SNode node) { return SPropertyOperations.hasValue(AttributeOperations.getAttribute(node, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo"))), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7aee2321L, "side"), "right", "right"); } public static boolean hasLeftTransformInfo(SNode node) { return SPropertyOperations.hasValue(AttributeOperations.getAttribute(node, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo"))), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7aee2321L, "side"), "left", "right"); } public static void removeTransformInfo(SNode node) { AttributeOperations.setAttribute(node, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo")), null); } public static String getCellIdFromTransformInfo(SNode node) { return SPropertyOperations.getString(AttributeOperations.getAttribute(node, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo"))), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7af1b9bbL, "cellId")); } public static String getAnchorTagFromTransformInfo(SNode node) { return SPropertyOperations.getString(AttributeOperations.getAttribute(node, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, "jetbrains.mps.lang.core.structure.SideTransformInfo"))), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0xad0053c7ae9194dL, 0xad0053c7af1bf58L, "anchorTag")); } }