package jetbrains.mps.build.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.util.Computable; 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.SingleItemSubstituteMenuPart; import org.jetbrains.annotations.Nullable; import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuItem; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.smodel.action.SNodeFactoryOperations; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.lang.editor.menus.ConceptMenusPart; import java.util.Collection; import jetbrains.mps.smodel.ConceptDescendantsCache; 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.persistence.PersistenceFacade; import jetbrains.mps.smodel.SModelUtil_new; public class BuildLayout_JarManifest_Part_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 BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a()); return result; } public class SMP_Group_aabwkk_a extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> { private boolean condition; private boolean condition_1; @Override protected void initialize(SubstituteMenuContext _context) { super.initialize(_context); condition = new Computable<Boolean>() { public Boolean compute() { return SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf20f2eL, "jetbrains.mps.build.structure.BuildLayout_JarManifest")); } }.compute(); condition_1 = new Computable<Boolean>() { public Boolean compute() { return SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf47d7bL, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Section")) || SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf20f2eL, "jetbrains.mps.build.structure.BuildLayout_JarManifest")); } }.compute(); } @Override protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() { return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a.SMP_Group_aabwkk_a0(), new BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a.SMP_Group_aabwkk_b0(), new BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a.SMP_Group_aabwkk_c0()); } public class SMP_Group_aabwkk_a0 extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> { @Override protected boolean isApplicable(SubstituteMenuContext _context) { return condition; } @Override protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() { return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a.SMP_Group_aabwkk_a0.SMP_Action_aabwkk_a0a(), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf47d7bL, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Section"))); } private class SMP_Action_aabwkk_a0a extends SingleItemSubstituteMenuPart { @Nullable @Override protected SubstituteMenuItem createItem(SubstituteMenuContext _context) { return new BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a.SMP_Group_aabwkk_a0.SMP_Action_aabwkk_a0a.Item(_context); } private class Item extends DefaultSubstituteMenuItem { private final SubstituteMenuContext _context; public Item(SubstituteMenuContext context) { super(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf47d7bL, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Section"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext()); _context = context; } @Nullable @Override public SNode createNode(@NotNull String pattern) { SNode section = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf47d7bL, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Section")), null); SNodeFactoryOperations.setNewChild(section, MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf47d7bL, 0x5ee439f214c0c758L, "name"), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0xbabdfbeee17fe57L, "jetbrains.mps.build.structure.BuildStringNotEmpty"))); return section; } @Nullable @Override public String getMatchingText(@NotNull String pattern) { return "section"; } @Nullable @Override public String getDescriptionText(@NotNull String pattern) { return "manifest section"; } } } } public class SMP_Group_aabwkk_b0 extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> { @Override protected boolean isApplicable(SubstituteMenuContext _context) { return condition_1; } @Override protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() { return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a.SMP_Group_aabwkk_b0.SMP_Action_aabwkk_a1a(), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf20f30L, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Attribute"))); } private class SMP_Action_aabwkk_a1a extends SingleItemSubstituteMenuPart { @Nullable @Override protected SubstituteMenuItem createItem(SubstituteMenuContext _context) { return new BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a.SMP_Group_aabwkk_b0.SMP_Action_aabwkk_a1a.Item(_context); } private class Item extends DefaultSubstituteMenuItem { private final SubstituteMenuContext _context; public Item(SubstituteMenuContext context) { super(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf20f30L, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Attribute"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext()); _context = context; } @Nullable @Override public SNode createNode(@NotNull String pattern) { SNode newInitializedNode = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf20f30L, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Attribute")), null); String name; String value = null; if (pattern.contains(":")) { name = pattern.substring(0, pattern.indexOf(":")); value = pattern.substring(pattern.indexOf(":") + 1); } else { name = pattern; } SLinkOperations.setTarget(newInitializedNode, MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf20f30L, 0x115d3b22faf20f31L, "name"), createBuildStringNotEmpty_aabwkk_a0a4a0a1a(name)); if ((value != null && value.length() > 0)) { SLinkOperations.setTarget(newInitializedNode, MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf20f30L, 0x115d3b22faf20f32L, "value"), createBuildStringNotEmpty_aabwkk_a0a0a5a0a1a(value)); } return newInitializedNode; } @Nullable @Override public String getMatchingText(@NotNull String pattern) { if ((pattern == null || pattern.length() == 0)) { return "name:value"; } return pattern + ":"; } @Override public boolean canExecute(@NotNull String pattern) { return canExecute_internal(pattern, false); } @Override public boolean canExecuteStrictly(@NotNull String pattern) { return canExecute_internal(pattern, true); } public boolean canExecute_internal(@NotNull String pattern, boolean strictly) { return SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x115d3b22faf47d7bL, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Section")) || !(pattern.equals("section")) && !(pattern.contains("$")); } } } } public class SMP_Group_aabwkk_c0 extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> { @Override protected boolean isApplicable(SubstituteMenuContext _context) { return !((condition || condition_1)); } @Override protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() { return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new BuildLayout_JarManifest_Part_SubstituteMenu.SMP_Group_aabwkk_a.SMP_Group_aabwkk_c0.SMP_Subconcepts_aabwkk_a2a()); } public class SMP_Subconcepts_aabwkk_a2a extends ConceptMenusPart<SubstituteMenuItem, SubstituteMenuContext> { protected Collection getConcepts(final SubstituteMenuContext _context) { return ConceptDescendantsCache.getInstance().getDirectDescendants(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x76d807f8dd95718eL, "jetbrains.mps.build.structure.BuildLayout_JarManifest_Part")); } @Override protected Collection<SubstituteMenuItem> createItemsForConcept(SubstituteMenuContext context, SAbstractConcept concept) { return context.createItems(new DefaultSubstituteMenuLookup(LanguageRegistry.getInstance(context.getEditorContext().getRepository()), concept)); } } } } private static SNode createBuildStringNotEmpty_aabwkk_a0a4a0a1a(Object p0) { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode n1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0xbabdfbeee17fe57L, "jetbrains.mps.build.structure.BuildStringNotEmpty"), null, null, false); { SNode n2 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x440d7ea3b68b7d03L, "jetbrains.mps.build.structure.BuildTextStringPart"), null, null, false); n2.setProperty(MetaAdapterFactory.getProperty(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x440d7ea3b68b7d03L, 0x440d7ea3b68c4d56L, "text"), p0 + ""); n1.addChild(MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x3cca41cd0fe51d4fL, 0x440d7ea3b68cba4bL, "parts"), n2); } return n1; } private static SNode createBuildStringNotEmpty_aabwkk_a0a0a5a0a1a(Object p0) { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode n1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0xbabdfbeee17fe57L, "jetbrains.mps.build.structure.BuildStringNotEmpty"), null, null, false); { SNode n2 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x440d7ea3b68b7d03L, "jetbrains.mps.build.structure.BuildTextStringPart"), null, null, false); n2.setProperty(MetaAdapterFactory.getProperty(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x440d7ea3b68b7d03L, 0x440d7ea3b68c4d56L, "text"), p0 + ""); n1.addChild(MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x3cca41cd0fe51d4fL, 0x440d7ea3b68cba4bL, "parts"), n2); } return n1; } }