package jetbrains.mps.baseLanguage.pluginSolution.plugin; /*Generated by MPS */ import jetbrains.mps.lang.core.plugin.UpdateReferencesParticipantBase; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.refactoring.participant.RefactoringParticipant; import jetbrains.mps.refactoring.participant.MoveNodeRefactoringParticipant; import org.jetbrains.annotations.Nullable; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.lang.typesystem.runtime.HUtil; import jetbrains.mps.lang.migration.util.NodeReferenceUtil; import jetbrains.mps.lang.migration.behavior.AbstractNodeReference__BehaviorDescriptor; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.lang.core.behavior.BaseConcept__BehaviorDescriptor; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import org.jetbrains.mps.openapi.persistence.PersistenceFacade; import jetbrains.mps.smodel.SModelUtil_new; public abstract class StaticMemberRefactoringParticipant extends UpdateReferencesParticipantBase<UpdateReferencesParticipantBase.NamedNodeReference> { public abstract boolean isApplicable(SNode nodeToMove); @Override public RefactoringParticipant.RefactoringDataCollector<UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference>, UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference>, SNode, SNode> getDataCollector() { final UpdateReferencesParticipantBase.MyMoveNodeRefactoringDataCollector fieldDataCollector = new UpdateReferencesParticipantBase.MyMoveNodeRefactoringDataCollector(); final UpdateReferencesParticipantBase.MyMoveNodeRefactoringDataCollector classifierDataCollector = new UpdateReferencesParticipantBase.MyMoveNodeRefactoringDataCollector(); return new MoveNodeRefactoringParticipant.MoveNodeRefactoringDataCollector<UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference>, UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference>>() { @Nullable public UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference> beforeMove(SNode nodeToMove) { SNode classifier = SNodeOperations.getNodeAncestor(nodeToMove, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101d9d3ca30L, "jetbrains.mps.baseLanguage.structure.Classifier"), false, false); if (!(isApplicable(nodeToMove)) || classifier == null) { return null; } return new NodeData<UpdateReferencesParticipantBase.NamedNodeReference>(fieldDataCollector.beforeMove(nodeToMove), classifierDataCollector.beforeMove(classifier)); } @Nullable public UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference> afterMove(SNode movedNode) { SNode classifier = SNodeOperations.getNodeAncestor(movedNode, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101d9d3ca30L, "jetbrains.mps.baseLanguage.structure.Classifier"), false, false); UpdateReferencesParticipantBase.NamedNodeReference classifierData = (classifier == null ? null : classifierDataCollector.afterMove(classifier)); return new NodeData<UpdateReferencesParticipantBase.NamedNodeReference>(fieldDataCollector.afterMove(movedNode), classifierData); } }; } public SNode serializeInitialState(UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference> initialState) { return createClassifierMemberData_io42ml_a0a5(SNodeOperations.cast(HUtil.copyIfNecessary(NodeReferenceUtil.makeReflection(initialState.baseData().reference(), initialState.baseData().name())), MetaAdapterFactory.getConcept(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x27bf3263be23f0dfL, "jetbrains.mps.lang.migration.structure.ReflectionNodeReference")), SNodeOperations.cast(HUtil.copyIfNecessary(NodeReferenceUtil.makeReflection(initialState.other().reference(), initialState.other().name())), MetaAdapterFactory.getConcept(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x27bf3263be23f0dfL, "jetbrains.mps.lang.migration.structure.ReflectionNodeReference"))); } public SNode serializeFinalState(UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference> finalState) { return createClassifierMemberData_io42ml_a0a6(SNodeOperations.cast(HUtil.copyIfNecessary(NodeReferenceUtil.makeReflection(finalState.baseData().reference(), finalState.baseData().name())), MetaAdapterFactory.getConcept(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x27bf3263be23f0dfL, "jetbrains.mps.lang.migration.structure.ReflectionNodeReference")), SNodeOperations.cast(HUtil.copyIfNecessary(NodeReferenceUtil.makeReflection(finalState.other().reference(), finalState.other().name())), MetaAdapterFactory.getConcept(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x27bf3263be23f0dfL, "jetbrains.mps.lang.migration.structure.ReflectionNodeReference"))); } public UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference> deserializeFinalState(SNode serialized) { UpdateReferencesParticipantBase.NamedNodeReference classifierData = new NamedNodeReference(AbstractNodeReference__BehaviorDescriptor.getNodeReference_id4uVwhQyQbdz.invoke(SLinkOperations.getTarget(serialized, MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1eaL, "classifierData"))), BaseConcept__BehaviorDescriptor.getPresentation_idhEwIMiw.invoke(SLinkOperations.getTarget(serialized, MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1eaL, "classifierData")))); return new NodeData<UpdateReferencesParticipantBase.NamedNodeReference>(new NamedNodeReference(AbstractNodeReference__BehaviorDescriptor.getNodeReference_id4uVwhQyQbdz.invoke(SLinkOperations.getTarget(serialized, MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1e8L, "nodeData"))), SPropertyOperations.getString(SLinkOperations.getTarget(serialized, MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1e8L, "nodeData")), MetaAdapterFactory.getProperty(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x27bf3263be23f0dfL, 0x27bf3263be23f299L, "nodeName"))), classifierData); } public UpdateReferencesParticipantBase.NodeData<UpdateReferencesParticipantBase.NamedNodeReference> deserializeInitialState(SNode serialized) { UpdateReferencesParticipantBase.NamedNodeReference classifierData = new NamedNodeReference(AbstractNodeReference__BehaviorDescriptor.getNodeReference_id4uVwhQyQbdz.invoke(SLinkOperations.getTarget(serialized, MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1eaL, "classifierData"))), BaseConcept__BehaviorDescriptor.getPresentation_idhEwIMiw.invoke(SLinkOperations.getTarget(serialized, MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1eaL, "classifierData")))); return new NodeData<UpdateReferencesParticipantBase.NamedNodeReference>(new NamedNodeReference(AbstractNodeReference__BehaviorDescriptor.getNodeReference_id4uVwhQyQbdz.invoke(SLinkOperations.getTarget(serialized, MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1e8L, "nodeData"))), SPropertyOperations.getString(SLinkOperations.getTarget(serialized, MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1e8L, "nodeData")), MetaAdapterFactory.getProperty(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x27bf3263be23f0dfL, 0x27bf3263be23f299L, "nodeName"))), classifierData); } private static SNode createClassifierMemberData_io42ml_a0a5(Object p0, Object p1) { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode n1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, "jetbrains.mps.lang.migration.structure.ClassifierMemberData"), null, null, false); if (p0 != null) { n1.addChild(MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1e8L, "nodeData"), (SNode) p0); } if (p1 != null) { n1.addChild(MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1eaL, "classifierData"), (SNode) p1); } return n1; } private static SNode createClassifierMemberData_io42ml_a0a6(Object p0, Object p1) { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode n1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, "jetbrains.mps.lang.migration.structure.ClassifierMemberData"), null, null, false); if (p0 != null) { n1.addChild(MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1e8L, "nodeData"), (SNode) p0); } if (p1 != null) { n1.addChild(MetaAdapterFactory.getContainmentLink(0x9074634404fd4286L, 0x97d5b46ae6a81709L, 0x7e209440ba59c1e7L, 0x7e209440ba59c1eaL, "classifierData"), (SNode) p1); } return n1; } }