package jetbrains.mps.lang.plugin.editor; /*Generated by MPS */ import jetbrains.mps.nodeEditor.menus.substitute.SubstituteMenuBase; import org.jetbrains.annotations.NotNull; import java.util.List; import jetbrains.mps.lang.editor.menus.MenuPart; import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuItem; import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuContext; import java.util.ArrayList; import jetbrains.mps.lang.editor.menus.substitute.ConstraintsFilteringSubstituteMenuPartDecorator; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.lang.editor.menus.ParameterizedMenuPart; import org.jetbrains.mps.openapi.model.SNode; import org.jetbrains.annotations.Nullable; import jetbrains.mps.internal.collections.runtime.ListSequence; import jetbrains.mps.lang.editor.menus.substitute.SingleItemSubstituteMenuPart; import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuItem; import jetbrains.mps.smodel.action.SNodeFactoryOperations; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.smodel.presentation.NodePresentationUtil; import jetbrains.mps.smodel.runtime.IconResource; import jetbrains.mps.smodel.runtime.IconResourceUtil; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.lang.plugin.behavior.ActionDataParameterDeclaration__BehaviorDescriptor; import org.jetbrains.mps.openapi.persistence.PersistenceFacade; import jetbrains.mps.smodel.SModelUtil_new; public class ActionParameter_SubstituteMenu extends SubstituteMenuBase { @NotNull @Override protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts(final SubstituteMenuContext _context) { List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> result = new ArrayList<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>(); result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new ActionParameter_SubstituteMenu.SMP_Param_z80bk2_a(), MetaAdapterFactory.getInterfaceConcept(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11b737a6b7cL, "jetbrains.mps.lang.plugin.structure.ActionParameter"))); result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new ActionParameter_SubstituteMenu.SMP_Param_z80bk2_b(), MetaAdapterFactory.getConcept(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11b69e025e0L, "jetbrains.mps.lang.plugin.structure.ActionDataParameterDeclaration"))); return result; } private class SMP_Param_z80bk2_a extends ParameterizedMenuPart<SNode, SubstituteMenuItem, SubstituteMenuContext> { @NotNull @Override protected List<SubstituteMenuItem> createItems(SNode parameter, SubstituteMenuContext context) { return new ActionParameter_SubstituteMenu.SMP_Param_z80bk2_a.SMP_Action_z80bk2_a0(parameter).createItems(context); } @Nullable @Override protected Iterable<? extends SNode> getParameters(SubstituteMenuContext _context) { return ListSequence.fromListAndArray(new ArrayList<SNode>(), _quotation_createNode_z80bk2_a0a0a0a(), _quotation_createNode_z80bk2_b0a0a0a(), _quotation_createNode_z80bk2_c0a0a0a()); } private class SMP_Action_z80bk2_a0 extends SingleItemSubstituteMenuPart { private final SNode myParameterObject; public SMP_Action_z80bk2_a0(SNode parameterObject) { myParameterObject = parameterObject; } @Nullable @Override protected SubstituteMenuItem createItem(SubstituteMenuContext _context) { return new ActionParameter_SubstituteMenu.SMP_Param_z80bk2_a.SMP_Action_z80bk2_a0.Item(_context); } private class Item extends DefaultSubstituteMenuItem { private final SubstituteMenuContext _context; public Item(SubstituteMenuContext context) { super(MetaAdapterFactory.getInterfaceConcept(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11b737a6b7cL, "jetbrains.mps.lang.plugin.structure.ActionParameter"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext()); _context = context; } @Nullable @Override public SNode createNode(@NotNull String pattern) { SNode result = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x118b812427fL, "jetbrains.mps.lang.plugin.structure.ActionParameterDeclaration")), null); SLinkOperations.setTarget(result, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"), myParameterObject); return result; } @Nullable @Override public String getMatchingText(@NotNull String pattern) { if (myParameterObject instanceof SNode) { return NodePresentationUtil.visibleMatchingText((SNode) myParameterObject, null); } return "" + myParameterObject; } @Nullable @Override public IconResource getIcon(@NotNull String pattern) { if (myParameterObject instanceof SNode) { return IconResourceUtil.getIconResourceForNode(((SNode) myParameterObject)); } return null; } @Nullable @Override public String getDescriptionText(@NotNull String pattern) { if (SNodeOperations.isInstanceOf(myParameterObject, MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x108f968b3caL, "jetbrains.mps.lang.smodel.structure.SNodeType"))) { return "current node"; } else if (SNodeOperations.isInstanceOf(myParameterObject, MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x10aae26be32L, "jetbrains.mps.lang.smodel.structure.SNodeListType"))) { return "current nodes"; } else if (SNodeOperations.isInstanceOf(myParameterObject, MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x10a2d94c0cdL, "jetbrains.mps.lang.smodel.structure.SModelType"))) { return "current model"; } return ""; } } } } private class SMP_Param_z80bk2_b extends ParameterizedMenuPart<SNode, SubstituteMenuItem, SubstituteMenuContext> { @NotNull @Override protected List<SubstituteMenuItem> createItems(SNode parameter, SubstituteMenuContext context) { return new ActionParameter_SubstituteMenu.SMP_Param_z80bk2_b.SMP_Action_z80bk2_a1(parameter).createItems(context); } @Nullable @Override protected Iterable<? extends SNode> getParameters(SubstituteMenuContext _context) { return (Iterable<SNode>) ActionDataParameterDeclaration__BehaviorDescriptor.getDataKeys_id1BC2tkUXZ6F.invoke(SNodeOperations.asSConcept(MetaAdapterFactory.getConcept(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11b69e025e0L, "jetbrains.mps.lang.plugin.structure.ActionDataParameterDeclaration")), _context.getModel()); } private class SMP_Action_z80bk2_a1 extends SingleItemSubstituteMenuPart { private final SNode myParameterObject; public SMP_Action_z80bk2_a1(SNode parameterObject) { myParameterObject = parameterObject; } @Nullable @Override protected SubstituteMenuItem createItem(SubstituteMenuContext _context) { return new ActionParameter_SubstituteMenu.SMP_Param_z80bk2_b.SMP_Action_z80bk2_a1.Item(_context); } private class Item extends DefaultSubstituteMenuItem { private final SubstituteMenuContext _context; public Item(SubstituteMenuContext context) { super(MetaAdapterFactory.getConcept(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11b69e025e0L, "jetbrains.mps.lang.plugin.structure.ActionDataParameterDeclaration"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext()); _context = context; } @Nullable @Override public SNode createNode(@NotNull String pattern) { SNode result = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11b69e025e0L, "jetbrains.mps.lang.plugin.structure.ActionDataParameterDeclaration")), null); SLinkOperations.setTarget(result, MetaAdapterFactory.getReferenceLink(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11b69e025e0L, 0x11b69e95df5L, "key"), myParameterObject); return result; } @Nullable @Override public String getMatchingText(@NotNull String pattern) { if (myParameterObject instanceof SNode) { return NodePresentationUtil.visibleMatchingText((SNode) myParameterObject, null); } return "" + myParameterObject; } @Nullable @Override public IconResource getIcon(@NotNull String pattern) { if (myParameterObject instanceof SNode) { return IconResourceUtil.getIconResourceForNode(((SNode) myParameterObject)); } return null; } @Nullable @Override public String getDescriptionText(@NotNull String pattern) { return (String) ActionDataParameterDeclaration__BehaviorDescriptor.getDescription_id2DsqYJxu5P.invoke(SNodeOperations.asSConcept(MetaAdapterFactory.getConcept(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11b69e025e0L, "jetbrains.mps.lang.plugin.structure.ActionDataParameterDeclaration")), myParameterObject); } } } } private static SNode _quotation_createNode_z80bk2_a0a0a0a() { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode quotedNode_1 = null; quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, "jetbrains.mps.lang.smodel"), 0x108f968b3caL, "SNodeType"), null, null, false); return quotedNode_1; } private static SNode _quotation_createNode_z80bk2_b0a0a0a() { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode quotedNode_1 = null; quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, "jetbrains.mps.lang.smodel"), 0x10aae26be32L, "SNodeListType"), null, null, false); return quotedNode_1; } private static SNode _quotation_createNode_z80bk2_c0a0a0a() { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode quotedNode_1 = null; quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, "jetbrains.mps.lang.smodel"), 0x10a2d94c0cdL, "SModelType"), null, null, false); return quotedNode_1; } }