package jetbrains.mps.baseLanguage.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.substitute.WrapperSubstituteMenuPart; import jetbrains.mps.editor.runtime.menus.SubstituteItemFacade; import jetbrains.mps.lang.editor.menus.substitute.SubstituteMenuItemWrapper; import org.jetbrains.mps.openapi.model.SNode; import org.jetbrains.annotations.Nullable; import org.jetbrains.mps.openapi.language.SAbstractConcept; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.editor.runtime.selection.SelectionUtil; import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuLookup; import jetbrains.mps.openapi.editor.EditorContext; import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuLookup; import jetbrains.mps.smodel.language.LanguageRegistry; public class BinaryOperation_Alias_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 BinaryOperation_Alias_SubstituteMenu.SMP_Wrap_3xwgcg_a(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, "jetbrains.mps.baseLanguage.structure.BinaryOperation"))); result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new BinaryOperation_Alias_SubstituteMenu.SMP_Wrap_3xwgcg_b(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11b0d00332cL, "jetbrains.mps.baseLanguage.structure.BaseAssignmentExpression"))); return result; } private class SMP_Wrap_3xwgcg_a extends WrapperSubstituteMenuPart { @NotNull @Override protected SubstituteMenuItem wrapItem(final SubstituteMenuItem item, final SubstituteMenuContext _context) { final SubstituteItemFacade wrappedItem = new SubstituteItemFacade(item); return new SubstituteMenuItemWrapper(item) { private SNode myCreatedNode; @Nullable @Override public SAbstractConcept getOutputConcept() { return MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, "jetbrains.mps.baseLanguage.structure.BinaryOperation"); } @Nullable @Override public SNode createNode(@NotNull String pattern) { SNode nodeToWrap = super.createNode(pattern); SLinkOperations.setTarget(nodeToWrap, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"), SLinkOperations.getTarget(_context.getCurrentTargetNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"))); SLinkOperations.setTarget(nodeToWrap, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"), SLinkOperations.getTarget(_context.getCurrentTargetNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"))); return nodeToWrap; } @Override public void select(@NotNull SNode createdNode, @NotNull String pattern) { SelectionUtil.selectLabelCellAnSetCaret(_context.getEditorContext(), createdNode, "ALIAS_EDITOR_COMPONENT", -1); } }; } @Nullable @Override protected SubstituteMenuLookup getLookup(SubstituteMenuContext _context) { final EditorContext editorContext = _context.getEditorContext(); return new DefaultSubstituteMenuLookup(LanguageRegistry.getInstance(editorContext.getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, "jetbrains.mps.baseLanguage.structure.BinaryOperation")); } } private class SMP_Wrap_3xwgcg_b extends WrapperSubstituteMenuPart { @NotNull @Override protected SubstituteMenuItem wrapItem(final SubstituteMenuItem item, final SubstituteMenuContext _context) { final SubstituteItemFacade wrappedItem = new SubstituteItemFacade(item); return new SubstituteMenuItemWrapper(item) { private SNode myCreatedNode; @Nullable @Override public SAbstractConcept getOutputConcept() { return MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11b0d00332cL, "jetbrains.mps.baseLanguage.structure.BaseAssignmentExpression"); } @Nullable @Override public SNode createNode(@NotNull String pattern) { SNode nodeToWrap = super.createNode(pattern); SLinkOperations.setTarget(nodeToWrap, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11b0d00332cL, 0xf8c77f1e97L, "lValue"), SLinkOperations.getTarget(_context.getCurrentTargetNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11cL, "leftExpression"))); SLinkOperations.setTarget(nodeToWrap, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11b0d00332cL, 0xf8c77f1e99L, "rValue"), SLinkOperations.getTarget(_context.getCurrentTargetNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, 0xfbdeb7a11bL, "rightExpression"))); return nodeToWrap; } @Override public void select(@NotNull SNode createdNode, @NotNull String pattern) { SelectionUtil.selectLabelCellAnSetCaret(_context.getEditorContext(), createdNode, "ALIAS_EDITOR_COMPONENT", -1); } }; } @Nullable @Override protected SubstituteMenuLookup getLookup(SubstituteMenuContext _context) { final EditorContext editorContext = _context.getEditorContext(); return new DefaultSubstituteMenuLookup(LanguageRegistry.getInstance(editorContext.getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11b0d00332cL, "jetbrains.mps.baseLanguage.structure.BaseAssignmentExpression")); } } }