package jetbrains.mps.lang.editor.editor;

/*Generated by MPS */

import jetbrains.mps.nodeEditor.menus.substitute.SubstituteMenuBase;
import jetbrains.mps.lang.editor.menus.EditorMenuDescriptorBase;
import jetbrains.mps.smodel.SNodePointer;
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 org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.lang.editor.behavior.CellMenuUtil;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import java.util.Arrays;
import jetbrains.mps.lang.editor.menus.substitute.ConstraintsFilteringSubstituteMenuPartDecorator;
import jetbrains.mps.lang.editor.menus.substitute.SimpleConceptSubstituteMenuPart;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SEnumOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.lang.editor.menus.ConceptMenusPart;
import java.util.Collection;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuLookup;
import jetbrains.mps.smodel.language.LanguageRegistry;
import org.jetbrains.mps.openapi.language.SConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SProperty;

public class CellMenuPart_Abstract_SubstituteMenu extends SubstituteMenuBase {
  public CellMenuPart_Abstract_SubstituteMenu() {
    super(false, new EditorMenuDescriptorBase("default substitute menu for " + "CellMenuPart_Abstract", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153472")));
  }
  @NotNull
  @Override
  protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts(final SubstituteMenuContext _context) {
    List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> result = new ArrayList<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>();
    result.add(new SMP_Group_uhoyad_a());
    result.add(new SMP_Group_uhoyad_b());
    result.add(new SMP_Group_uhoyad_c());
    result.add(new SMP_Subconcepts_uhoyad_d());
    return result;
  }

  public class SMP_Group_uhoyad_a extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> {
    public SMP_Group_uhoyad_a() {
      super(new EditorMenuDescriptorBase("substitute menu group", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153474")));
    }
    @Override
    protected boolean isApplicable(SubstituteMenuContext _context) {
      SNode editedFeature = CellMenuUtil.getEditedFeature(_context.getParentNode());
      return SNodeOperations.isInstanceOf(editedFeature, CONCEPTS.PropertyDeclaration$1S);
    }
    @Override
    protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() {
      return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(CONCEPTS.CellMenuPart_PropertyValues$kb, new EditorMenuDescriptorBase("simple substitute menu part for concept: " + "CellMenuPart_PropertyValues", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153514"))), CONCEPTS.CellMenuPart_PropertyValues$kb), new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(CONCEPTS.CellMenuPart_PropertyPostfixHints$cd, new EditorMenuDescriptorBase("simple substitute menu part for concept: " + "CellMenuPart_PropertyPostfixHints", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153516"))), CONCEPTS.CellMenuPart_PropertyPostfixHints$cd));
    }
  }
  public class SMP_Group_uhoyad_b extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> {
    public SMP_Group_uhoyad_b() {
      super(new EditorMenuDescriptorBase("substitute menu group", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153520")));
    }
    @Override
    protected boolean isApplicable(SubstituteMenuContext _context) {
      SNode editedFeature = CellMenuUtil.getEditedFeature(_context.getParentNode());
      return SNodeOperations.isInstanceOf(editedFeature, CONCEPTS.LinkDeclaration$1p) && SEnumOperations.isMember(SPropertyOperations.getEnum(SNodeOperations.cast(editedFeature, CONCEPTS.LinkDeclaration$1p), PROPS.metaClass$PeKc), 0xfc6f4e95b8L);
    }
    @Override
    protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() {
      return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(CONCEPTS.CellMenuPart_ReferentPrimary$uH, new EditorMenuDescriptorBase("simple substitute menu part for concept: " + "CellMenuPart_ReferentPrimary", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153568"))), CONCEPTS.CellMenuPart_ReferentPrimary$uH));
    }
  }
  public class SMP_Group_uhoyad_c extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> {
    public SMP_Group_uhoyad_c() {
      super(new EditorMenuDescriptorBase("substitute menu group", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153572")));
    }
    @Override
    protected boolean isApplicable(SubstituteMenuContext _context) {
      SNode editedFeature = CellMenuUtil.getEditedFeature(_context.getParentNode());
      return SNodeOperations.isInstanceOf(editedFeature, CONCEPTS.LinkDeclaration$1p) && SEnumOperations.isMember(SPropertyOperations.getEnum(SNodeOperations.cast(editedFeature, CONCEPTS.LinkDeclaration$1p), PROPS.metaClass$PeKc), 0xfc6f4e95b9L);
    }
    @Override
    protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() {
      return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(CONCEPTS.CellMenuPart_ReplaceChild_Group$7X, new EditorMenuDescriptorBase("simple substitute menu part for concept: " + "CellMenuPart_ReplaceChild_Group", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153620"))), CONCEPTS.CellMenuPart_ReplaceChild_Group$7X), new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(CONCEPTS.CellMenuPart_ReplaceChild_Item$lA, new EditorMenuDescriptorBase("simple substitute menu part for concept: " + "CellMenuPart_ReplaceChild_Item", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153622"))), CONCEPTS.CellMenuPart_ReplaceChild_Item$lA), new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(CONCEPTS.CellMenuPart_ReplaceChild_CustomChildConcept$Oy, new EditorMenuDescriptorBase("simple substitute menu part for concept: " + "CellMenuPart_ReplaceChild_CustomChildConcept", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153624"))), CONCEPTS.CellMenuPart_ReplaceChild_CustomChildConcept$Oy), new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(CONCEPTS.CellMenuPart_ReplaceChildPrimary$lI, new EditorMenuDescriptorBase("simple substitute menu part for concept: " + "CellMenuPart_ReplaceChildPrimary", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587153626"))), CONCEPTS.CellMenuPart_ReplaceChildPrimary$lI));
    }
  }
  public class SMP_Subconcepts_uhoyad_d extends ConceptMenusPart<SubstituteMenuItem, SubstituteMenuContext> {
    public SMP_Subconcepts_uhoyad_d() {
      super(new EditorMenuDescriptorBase("include menus for all the direct subconcepts of " + "CellMenuPart_Abstract", new SNodePointer("r:00000000-0000-4000-0000-011c89590299(jetbrains.mps.lang.editor.editor)", "1741258697587154148")));
    }

    @Override
    protected Collection<SAbstractConcept> getConcepts(final SubstituteMenuContext _context) {
      return getDirectDescendants(_context, CONCEPTS.CellMenuPart_Abstract$Fh);
    }

    @Override
    protected Collection<SubstituteMenuItem> createItemsForConcept(SubstituteMenuContext context, SAbstractConcept concept) {
      return context.createItems(new DefaultSubstituteMenuLookup(LanguageRegistry.getInstance(context.getEditorContext().getRepository()), concept));
    }
  }

  private static final class CONCEPTS {
    /*package*/ static final SConcept PropertyDeclaration$1S = MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979bd086bL, "jetbrains.mps.lang.structure.structure.PropertyDeclaration");
    /*package*/ static final SConcept CellMenuPart_PropertyValues$kb = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x10f357f9ab7L, "jetbrains.mps.lang.editor.structure.CellMenuPart_PropertyValues");
    /*package*/ static final SConcept CellMenuPart_PropertyPostfixHints$cd = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x112e2300bcaL, "jetbrains.mps.lang.editor.structure.CellMenuPart_PropertyPostfixHints");
    /*package*/ static final SConcept LinkDeclaration$1p = MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979bd086aL, "jetbrains.mps.lang.structure.structure.LinkDeclaration");
    /*package*/ static final SConcept CellMenuPart_ReferentPrimary$uH = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x10f3f33baebL, "jetbrains.mps.lang.editor.structure.CellMenuPart_ReferentPrimary");
    /*package*/ static final SConcept CellMenuPart_ReplaceChild_Group$7X = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x10f4f87862dL, "jetbrains.mps.lang.editor.structure.CellMenuPart_ReplaceChild_Group");
    /*package*/ static final SConcept CellMenuPart_ReplaceChild_Item$lA = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x10f53a0aafeL, "jetbrains.mps.lang.editor.structure.CellMenuPart_ReplaceChild_Item");
    /*package*/ static final SConcept CellMenuPart_ReplaceChild_CustomChildConcept$Oy = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x10f5021674eL, "jetbrains.mps.lang.editor.structure.CellMenuPart_ReplaceChild_CustomChildConcept");
    /*package*/ static final SConcept CellMenuPart_ReplaceChildPrimary$lI = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x1115d1a2839L, "jetbrains.mps.lang.editor.structure.CellMenuPart_ReplaceChildPrimary");
    /*package*/ static final SConcept CellMenuPart_Abstract$Fh = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x10f34f8c0deL, "jetbrains.mps.lang.editor.structure.CellMenuPart_Abstract");
  }

  private static final class PROPS {
    /*package*/ static final SProperty metaClass$PeKc = MetaAdapterFactory.getProperty(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979bd086aL, 0xf980556927L, "metaClass");
  }
}
