package jetbrains.mps.execution.commands.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.lang.smodel.generator.smodelAdapter.SModelOperations; 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.runtime.IconResource; import jetbrains.mps.smodel.runtime.IconResourceUtil; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; public class commandReference 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 commandReference.SMP_Param_h8zl7k_a(), MetaAdapterFactory.getConcept(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2bd9L, "jetbrains.mps.execution.commands.structure.CommandReferenceExpression"))); return result; } private class SMP_Param_h8zl7k_a extends ParameterizedMenuPart<SNode, SubstituteMenuItem, SubstituteMenuContext> { @NotNull @Override protected List<SubstituteMenuItem> createItems(SNode parameter, SubstituteMenuContext context) { return new commandReference.SMP_Param_h8zl7k_a.SMP_Action_h8zl7k_a0(parameter).createItems(context); } @Nullable @Override protected Iterable<? extends SNode> getParameters(SubstituteMenuContext _context) { return SModelOperations.nodesIncludingImported(_context.getModel(), MetaAdapterFactory.getConcept(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2be8L, "jetbrains.mps.execution.commands.structure.CommandDeclaration")); } private class SMP_Action_h8zl7k_a0 extends SingleItemSubstituteMenuPart { private final SNode myParameterObject; public SMP_Action_h8zl7k_a0(SNode parameterObject) { myParameterObject = parameterObject; } @Nullable @Override protected SubstituteMenuItem createItem(SubstituteMenuContext _context) { return new commandReference.SMP_Param_h8zl7k_a.SMP_Action_h8zl7k_a0.Item(_context); } private class Item extends DefaultSubstituteMenuItem { private final SubstituteMenuContext _context; public Item(SubstituteMenuContext context) { super(MetaAdapterFactory.getConcept(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2bd9L, "jetbrains.mps.execution.commands.structure.CommandReferenceExpression"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext()); _context = context; } @Nullable @Override public SNode createNode(@NotNull String pattern) { SNode reference = SNodeFactoryOperations.createNewNode(SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2bd9L, "jetbrains.mps.execution.commands.structure.CommandReferenceExpression")), null); SLinkOperations.setTarget(reference, MetaAdapterFactory.getReferenceLink(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2bd9L, 0xbe3a0d5ba1a2bdbL, "command"), myParameterObject); return reference; } @Nullable @Override public IconResource getIcon(@NotNull String pattern) { if (myParameterObject instanceof SNode) { return IconResourceUtil.getIconResourceForNode(((SNode) myParameterObject)); } return null; } @Nullable @Override public String getMatchingText(@NotNull String pattern) { return SPropertyOperations.getString(myParameterObject, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")); } @Nullable @Override public String getDescriptionText(@NotNull String pattern) { return "reference to a " + SPropertyOperations.getString(myParameterObject, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")) + " command"; } } } } }