package jetbrains.mps.make.script.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.GroupMenuPart; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import java.util.Arrays; import jetbrains.mps.lang.editor.menus.substitute.ConstraintsFilteringSubstituteMenuPartDecorator; import jetbrains.mps.lang.editor.menus.substitute.SimpleConceptSubstituteMenuPart; import jetbrains.mps.lang.editor.menus.substitute.SingleItemSubstituteMenuPart; import org.jetbrains.annotations.Nullable; import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuItem; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SConceptOperations; import jetbrains.mps.lang.editor.menus.ParameterizedMenuPart; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import org.jetbrains.mps.openapi.language.SAbstractConcept; 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.SPropertyOperations; import org.jetbrains.mps.openapi.persistence.PersistenceFacade; import jetbrains.mps.smodel.SModelUtil_new; import org.jetbrains.mps.openapi.model.SNodeAccessUtil; public class ProgressStatement_subs 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 ProgressStatement_subs.SMP_Group_kz2qu0_a()); return result; } public class SMP_Group_kz2qu0_a extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> { @Override protected boolean isApplicable(SubstituteMenuContext _context) { return (SNodeOperations.getNodeAncestor(_context.getParentNode(), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x20c069f80a972dabL, "jetbrains.mps.make.script.structure.JobDefinition"), false, false) != null); } @Override protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() { return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new ProgressStatement_subs.SMP_Group_kz2qu0_a.SMP_Action_kz2qu0_a0(), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, "jetbrains.mps.make.script.structure.BeginWorkStatement")), new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6984L, "jetbrains.mps.make.script.structure.AdvanceWorkStatement")), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6984L, "jetbrains.mps.make.script.structure.AdvanceWorkStatement")), new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6987L, "jetbrains.mps.make.script.structure.FinishWorkStatement")), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6987L, "jetbrains.mps.make.script.structure.FinishWorkStatement")), new ConstraintsFilteringSubstituteMenuPartDecorator(new ProgressStatement_subs.SMP_Group_kz2qu0_a.SMP_Param_kz2qu0_d0(), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6984L, "jetbrains.mps.make.script.structure.AdvanceWorkStatement")), new ConstraintsFilteringSubstituteMenuPartDecorator(new ProgressStatement_subs.SMP_Group_kz2qu0_a.SMP_Param_kz2qu0_e0(), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6987L, "jetbrains.mps.make.script.structure.FinishWorkStatement"))); } private class SMP_Action_kz2qu0_a0 extends SingleItemSubstituteMenuPart { @Nullable @Override protected SubstituteMenuItem createItem(SubstituteMenuContext _context) { return new ProgressStatement_subs.SMP_Group_kz2qu0_a.SMP_Action_kz2qu0_a0.Item(_context); } private class Item extends DefaultSubstituteMenuItem { private final SubstituteMenuContext _context; public Item(SubstituteMenuContext context) { super(MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, "jetbrains.mps.make.script.structure.BeginWorkStatement"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext()); _context = context; } @Nullable @Override public SNode createNode(@NotNull String pattern) { return _quotation_createNode_kz2qu0_a0a0a0(); } @Nullable @Override public String getMatchingText(@NotNull String pattern) { return SConceptOperations.conceptAlias(MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, "jetbrains.mps.make.script.structure.BeginWorkStatement")); } } } private class SMP_Param_kz2qu0_d0 extends ParameterizedMenuPart<SNode, SubstituteMenuItem, SubstituteMenuContext> { @NotNull @Override protected List<SubstituteMenuItem> createItems(SNode parameter, SubstituteMenuContext context) { return new ProgressStatement_subs.SMP_Group_kz2qu0_a.SMP_Param_kz2qu0_d0.SMP_Action_kz2qu0_a3a(parameter).createItems(context); } @Nullable @Override protected Iterable<? extends SNode> getParameters(SubstituteMenuContext _context) { return SNodeOperations.getNodeDescendants(SLinkOperations.getTarget(SNodeOperations.getNodeAncestor(_context.getParentNode(), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x20c069f80a972dabL, "jetbrains.mps.make.script.structure.JobDefinition"), false, false), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x108bbca0f48L, 0x108bbd29b4aL, "body")), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, "jetbrains.mps.make.script.structure.BeginWorkStatement"), false, new SAbstractConcept[]{}); } private class SMP_Action_kz2qu0_a3a extends SingleItemSubstituteMenuPart { private final SNode myParameterObject; public SMP_Action_kz2qu0_a3a(SNode parameterObject) { myParameterObject = parameterObject; } @Nullable @Override protected SubstituteMenuItem createItem(SubstituteMenuContext _context) { return new ProgressStatement_subs.SMP_Group_kz2qu0_a.SMP_Param_kz2qu0_d0.SMP_Action_kz2qu0_a3a.Item(_context); } private class Item extends DefaultSubstituteMenuItem { private final SubstituteMenuContext _context; public Item(SubstituteMenuContext context) { super(MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6984L, "jetbrains.mps.make.script.structure.AdvanceWorkStatement"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext()); _context = context; } @Nullable @Override public SNode createNode(@NotNull String pattern) { return _quotation_createNode_kz2qu0_a0a0a3a(myParameterObject); } @Nullable @Override public String getDescriptionText(@NotNull String pattern) { if (myParameterObject instanceof SNode) { return NodePresentationUtil.descriptionText((SNode) myParameterObject); } 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 getMatchingText(@NotNull String pattern) { return SConceptOperations.conceptAlias(MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6984L, "jetbrains.mps.make.script.structure.AdvanceWorkStatement")) + " <amount> of " + SPropertyOperations.getString(myParameterObject, MetaAdapterFactory.getProperty(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, 0x97a1ce11865e911L, "workName")); } } } } private class SMP_Param_kz2qu0_e0 extends ParameterizedMenuPart<SNode, SubstituteMenuItem, SubstituteMenuContext> { @NotNull @Override protected List<SubstituteMenuItem> createItems(SNode parameter, SubstituteMenuContext context) { return new ProgressStatement_subs.SMP_Group_kz2qu0_a.SMP_Param_kz2qu0_e0.SMP_Action_kz2qu0_a4a(parameter).createItems(context); } @Nullable @Override protected Iterable<? extends SNode> getParameters(SubstituteMenuContext _context) { return SNodeOperations.getNodeDescendants(SLinkOperations.getTarget(SNodeOperations.getNodeAncestor(_context.getParentNode(), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x20c069f80a972dabL, "jetbrains.mps.make.script.structure.JobDefinition"), false, false), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x108bbca0f48L, 0x108bbd29b4aL, "body")), MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, "jetbrains.mps.make.script.structure.BeginWorkStatement"), false, new SAbstractConcept[]{}); } private class SMP_Action_kz2qu0_a4a extends SingleItemSubstituteMenuPart { private final SNode myParameterObject; public SMP_Action_kz2qu0_a4a(SNode parameterObject) { myParameterObject = parameterObject; } @Nullable @Override protected SubstituteMenuItem createItem(SubstituteMenuContext _context) { return new ProgressStatement_subs.SMP_Group_kz2qu0_a.SMP_Param_kz2qu0_e0.SMP_Action_kz2qu0_a4a.Item(_context); } private class Item extends DefaultSubstituteMenuItem { private final SubstituteMenuContext _context; public Item(SubstituteMenuContext context) { super(MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6987L, "jetbrains.mps.make.script.structure.FinishWorkStatement"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext()); _context = context; } @Nullable @Override public SNode createNode(@NotNull String pattern) { return _quotation_createNode_kz2qu0_a0a0a4a(myParameterObject); } @Nullable @Override public String getDescriptionText(@NotNull String pattern) { if (myParameterObject instanceof SNode) { return NodePresentationUtil.descriptionText((SNode) myParameterObject); } 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 getMatchingText(@NotNull String pattern) { return SConceptOperations.conceptAlias(MetaAdapterFactory.getConcept(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6987L, "jetbrains.mps.make.script.structure.FinishWorkStatement")) + " " + SPropertyOperations.getString(myParameterObject, MetaAdapterFactory.getProperty(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, 0x97a1ce11865e911L, "workName")); } } } } } private static SNode _quotation_createNode_kz2qu0_a0a0a0() { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode quotedNode_1 = null; SNode quotedNode_2 = null; SNode quotedNode_3 = null; quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, "jetbrains.mps.make.script"), 0x29929a95c9e6982L, "BeginWorkStatement"), null, null, false); quotedNode_2 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c37f506fL, "Expression"), null, null, false); quotedNode_1.addChild(MetaAdapterFactory.getContainmentLink(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, 0x29929a95c9f45e6L, "expected"), quotedNode_2); quotedNode_3 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, "jetbrains.mps.make.script"), 0x2dc2243445538ecaL, "AllWorkLeftExpression"), null, null, false); quotedNode_1.addChild(MetaAdapterFactory.getContainmentLink(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6982L, 0x29929a95c9f45e7L, "ofTotal"), quotedNode_3); return quotedNode_1; } private static SNode _quotation_createNode_kz2qu0_a0a0a3a(Object parameter_1) { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode quotedNode_2 = null; SNode quotedNode_3 = null; quotedNode_2 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, "jetbrains.mps.make.script"), 0x29929a95c9e6984L, "AdvanceWorkStatement"), null, null, false); SNodeAccessUtil.setReferenceTarget(quotedNode_2, MetaAdapterFactory.getReferenceLink(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6984L, 0x97a1ce11862bf5aL, "workStatement"), (SNode) parameter_1); quotedNode_3 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c37f506fL, "Expression"), null, null, false); quotedNode_2.addChild(MetaAdapterFactory.getContainmentLink(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6984L, 0x29929a95c9f34d4L, "amount"), quotedNode_3); return quotedNode_2; } private static SNode _quotation_createNode_kz2qu0_a0a0a4a(Object parameter_1) { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode quotedNode_2 = null; quotedNode_2 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, "jetbrains.mps.make.script"), 0x29929a95c9e6987L, "FinishWorkStatement"), null, null, false); SNodeAccessUtil.setReferenceTarget(quotedNode_2, MetaAdapterFactory.getReferenceLink(0x95f8a3e6f9944ca0L, 0xa65e763c9bae2d3bL, 0x29929a95c9e6987L, 0x97a1ce11862c6ddL, "workStatement"), (SNode) parameter_1); return quotedNode_2; } }