package jetbrains.mps.lang.actions.testLanguage.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 jetbrains.mps.util.Computable;
import java.util.Objects;
import java.util.Arrays;
import jetbrains.mps.lang.editor.menus.substitute.IncludeSubstituteMenuSubstituteMenuPart;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuLookup;
import jetbrains.mps.openapi.editor.EditorContext;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import jetbrains.mps.lang.editor.menus.substitute.NamedSubstituteMenuLookup;
import jetbrains.mps.smodel.language.LanguageRegistry;
import jetbrains.mps.lang.editor.menus.ConceptMenusPart;
import java.util.Collection;
import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuLookup;
import org.jetbrains.mps.openapi.language.SContainmentLink;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SConcept;

public class ActionTestDefaultAbstractChild_SubstituteMenu extends SubstituteMenuBase {
  public ActionTestDefaultAbstractChild_SubstituteMenu() {
    super(false, new EditorMenuDescriptorBase("default substitute menu for " + "ActionTestDefaultAbstractChild", new SNodePointer("r:6f930e62-d183-4ca9-a17e-cab70bc506c7(jetbrains.mps.lang.actions.testLanguage.editor)", "1741258697587038942")));
  }
  @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_c1nwm3_a());
    return result;
  }

  public class SMP_Group_c1nwm3_a extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> {
    private boolean condition;
    private boolean condition1;
    private boolean condition2;
    public SMP_Group_c1nwm3_a() {
      super(new EditorMenuDescriptorBase("substitute menu group", new SNodePointer("r:6f930e62-d183-4ca9-a17e-cab70bc506c7(jetbrains.mps.lang.actions.testLanguage.editor)", "1741258697587039095")));
    }
    @Override
    protected void initialize(SubstituteMenuContext _context) {
      super.initialize(_context);
      condition = new Computable<Boolean>() {
        public Boolean compute() {
          return Objects.equals(_context.getLink(), LINKS.removeDefaultsPart$WYji);
        }
      }.compute();
      condition1 = new Computable<Boolean>() {
        public Boolean compute() {
          return Objects.equals(_context.getLink(), LINKS.removeByConditionPart$OuDF);
        }
      }.compute();
      condition2 = new Computable<Boolean>() {
        public Boolean compute() {
          return Objects.equals(_context.getLink(), LINKS.removePart$VAt$);
        }
      }.compute();
    }
    @Override
    protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() {
      return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new SMP_Include_c1nwm3_a0(), new SMP_Include_c1nwm3_b0(), new SMP_Include_c1nwm3_c0(), new SMP_Group_c1nwm3_d0());
    }
    public class SMP_Include_c1nwm3_a0 extends IncludeSubstituteMenuSubstituteMenuPart {

      public SMP_Include_c1nwm3_a0() {
        super(new EditorMenuDescriptorBase("include " + "named substitute menu " + "RemoveDefaultsPart", new SNodePointer("r:6f930e62-d183-4ca9-a17e-cab70bc506c7(jetbrains.mps.lang.actions.testLanguage.editor)", "1741258697587039171")));
      }

      @Nullable
      @Override
      protected SubstituteMenuLookup getMenuLookup(SubstituteMenuContext _context) {
        final EditorContext editorContext = _context.getEditorContext();
        SAbstractConcept conceptToFindMenuFor = getConceptToFindMenuFor(_context);
        return new NamedSubstituteMenuLookup(LanguageRegistry.getInstance(editorContext.getRepository()), conceptToFindMenuFor, "jetbrains.mps.lang.actions.testLanguage.editor.RemoveDefaultsPart");
      }
      private SAbstractConcept getConceptToFindMenuFor(SubstituteMenuContext _context) {
        return CONCEPTS.ActionTestDefaultAbstractChild$$e;
      }
    }
    public class SMP_Include_c1nwm3_b0 extends IncludeSubstituteMenuSubstituteMenuPart {

      public SMP_Include_c1nwm3_b0() {
        super(new EditorMenuDescriptorBase("include " + "named substitute menu " + "RemoveByConditionPart", new SNodePointer("r:6f930e62-d183-4ca9-a17e-cab70bc506c7(jetbrains.mps.lang.actions.testLanguage.editor)", "1741258697587038983")));
      }

      @Nullable
      @Override
      protected SubstituteMenuLookup getMenuLookup(SubstituteMenuContext _context) {
        final EditorContext editorContext = _context.getEditorContext();
        SAbstractConcept conceptToFindMenuFor = getConceptToFindMenuFor(_context);
        return new NamedSubstituteMenuLookup(LanguageRegistry.getInstance(editorContext.getRepository()), conceptToFindMenuFor, "jetbrains.mps.lang.actions.testLanguage.editor.RemoveByConditionPart");
      }
      private SAbstractConcept getConceptToFindMenuFor(SubstituteMenuContext _context) {
        return CONCEPTS.ActionTestDefaultAbstractChild$$e;
      }
    }
    public class SMP_Include_c1nwm3_c0 extends IncludeSubstituteMenuSubstituteMenuPart {

      public SMP_Include_c1nwm3_c0() {
        super(new EditorMenuDescriptorBase("include " + "named substitute menu " + "RemovePart", new SNodePointer("r:6f930e62-d183-4ca9-a17e-cab70bc506c7(jetbrains.mps.lang.actions.testLanguage.editor)", "1741258697587039696")));
      }

      @Nullable
      @Override
      protected SubstituteMenuLookup getMenuLookup(SubstituteMenuContext _context) {
        final EditorContext editorContext = _context.getEditorContext();
        SAbstractConcept conceptToFindMenuFor = getConceptToFindMenuFor(_context);
        return new NamedSubstituteMenuLookup(LanguageRegistry.getInstance(editorContext.getRepository()), conceptToFindMenuFor, "jetbrains.mps.lang.actions.testLanguage.editor.RemovePart");
      }
      private SAbstractConcept getConceptToFindMenuFor(SubstituteMenuContext _context) {
        return CONCEPTS.ActionTestDefaultAbstractChild$$e;
      }
    }
    public class SMP_Group_c1nwm3_d0 extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> {
      public SMP_Group_c1nwm3_d0() {
        super(new EditorMenuDescriptorBase("substitute menu group", new SNodePointer("r:6f930e62-d183-4ca9-a17e-cab70bc506c7(jetbrains.mps.lang.actions.testLanguage.editor)", "1741258697587039703")));
      }
      @Override
      protected boolean isApplicable(SubstituteMenuContext _context) {
        return !(condition || condition1 || condition2);
      }
      @Override
      protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() {
        return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new SMP_Subconcepts_c1nwm3_a3a());
      }
      public class SMP_Subconcepts_c1nwm3_a3a extends ConceptMenusPart<SubstituteMenuItem, SubstituteMenuContext> {
        public SMP_Subconcepts_c1nwm3_a3a() {
          super(new EditorMenuDescriptorBase("include menus for all the direct subconcepts of " + "ActionTestDefaultAbstractChild", new SNodePointer("r:6f930e62-d183-4ca9-a17e-cab70bc506c7(jetbrains.mps.lang.actions.testLanguage.editor)", "1741258697587039707")));
        }

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

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

  private static final class LINKS {
    /*package*/ static final SContainmentLink removeDefaultsPart$WYji = MetaAdapterFactory.getContainmentLink(0x737ed1fffa634ebcL, 0xa834435499b23c64L, 0x2365c14e1671696fL, 0x73dfe0fc257b7aaaL, "removeDefaultsPart");
    /*package*/ static final SContainmentLink removeByConditionPart$OuDF = MetaAdapterFactory.getContainmentLink(0x737ed1fffa634ebcL, 0xa834435499b23c64L, 0x2365c14e1671696fL, 0x73dfe0fc2552e60aL, "removeByConditionPart");
    /*package*/ static final SContainmentLink removePart$VAt$ = MetaAdapterFactory.getContainmentLink(0x737ed1fffa634ebcL, 0xa834435499b23c64L, 0x2365c14e1671696fL, 0x73dfe0fc25762f5fL, "removePart");
  }

  private static final class CONCEPTS {
    /*package*/ static final SConcept ActionTestDefaultAbstractChild$$e = MetaAdapterFactory.getConcept(0x737ed1fffa634ebcL, 0xa834435499b23c64L, 0x73dfe0fc25514b8dL, "jetbrains.mps.lang.actions.testLanguage.structure.ActionTestDefaultAbstractChild");
  }
}
