package jetbrains.mps.execution.settings.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.ParameterizedMenuPart;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SModelOperations;
import jetbrains.mps.internal.collections.runtime.IWhereFilter;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.AttributeOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.IAttributeDescriptor;
import jetbrains.mps.lang.editor.menus.substitute.SingleItemSubstituteMenuPart;
import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuItem;
import jetbrains.mps.smodel.action.SNodeFactoryOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
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;
public class PersistentConfigurationType_Contribution extends SubstituteMenuBase {
public PersistentConfigurationType_Contribution() {
super(true);
}
@NotNull
@Override
protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts(final SubstituteMenuContext _context) {
List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> result = new ArrayList<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>();
result.add(new PersistentConfigurationType_Contribution.SMP_Group_67nl4b_a());
result.add(new PersistentConfigurationType_Contribution.SMP_Group_67nl4b_b());
return result;
}
public class SMP_Group_67nl4b_a extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> {
@Override
protected boolean isApplicable(SubstituteMenuContext _context) {
return SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f910119L, "jetbrains.mps.execution.settings.structure.PersistentPropertyDeclaration"));
}
@Override
protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() {
return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new PersistentConfigurationType_Contribution.SMP_Group_67nl4b_a.SMP_Param_67nl4b_a0(), MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f9100fdL, "jetbrains.mps.execution.settings.structure.TemplatePersistentConfigurationType")));
}
private class SMP_Param_67nl4b_a0 extends ParameterizedMenuPart<SNode, SubstituteMenuItem, SubstituteMenuContext> {
@NotNull
@Override
protected List<SubstituteMenuItem> createItems(SNode parameter, SubstituteMenuContext context) {
return new PersistentConfigurationType_Contribution.SMP_Group_67nl4b_a.SMP_Param_67nl4b_a0.SMP_Action_67nl4b_a0a(parameter).createItems(context);
}
@Nullable
@Override
protected Iterable<? extends SNode> getParameters(SubstituteMenuContext _context) {
return ListSequence.fromList(SModelOperations.rootsIncludingImported(_context.getModel(), MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f910113L, "jetbrains.mps.execution.settings.structure.PersistentConfigurationTemplate"))).where(new IWhereFilter<SNode>() {
public boolean accept(SNode it) {
return (AttributeOperations.getAttribute(it, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0x7f8de21e263f5819L, "jetbrains.mps.execution.settings.structure.DeprecatedAnnotation"))) == null);
}
}).toListSequence();
}
private class SMP_Action_67nl4b_a0a extends SingleItemSubstituteMenuPart {
private final SNode myParameterObject;
public SMP_Action_67nl4b_a0a(SNode parameterObject) {
myParameterObject = parameterObject;
}
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new PersistentConfigurationType_Contribution.SMP_Group_67nl4b_a.SMP_Param_67nl4b_a0.SMP_Action_67nl4b_a0a.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f9100fdL, "jetbrains.mps.execution.settings.structure.TemplatePersistentConfigurationType"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode node = SNodeFactoryOperations.createNewNode(SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f9100fdL, "jetbrains.mps.execution.settings.structure.TemplatePersistentConfigurationType")), null);
SLinkOperations.setTarget(node, MetaAdapterFactory.getReferenceLink(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f91001cL, 0xd244b712f91001dL, "persistentConfiguration"), myParameterObject);
return node;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
if (myParameterObject instanceof SNode) {
return NodePresentationUtil.visibleMatchingText((SNode) myParameterObject, null);
}
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 getDescriptionText(@NotNull String pattern) {
return "template<" + SPropertyOperations.getString(myParameterObject, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")) + ">";
}
}
}
}
}
public class SMP_Group_67nl4b_b extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> {
@Override
protected boolean isApplicable(SubstituteMenuContext _context) {
return !(SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f910119L, "jetbrains.mps.execution.settings.structure.PersistentPropertyDeclaration")));
}
@Override
protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() {
return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new PersistentConfigurationType_Contribution.SMP_Group_67nl4b_b.SMP_Param_67nl4b_a1(), MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f91001cL, "jetbrains.mps.execution.settings.structure.PersistentConfigurationType")));
}
private class SMP_Param_67nl4b_a1 extends ParameterizedMenuPart<SNode, SubstituteMenuItem, SubstituteMenuContext> {
@NotNull
@Override
protected List<SubstituteMenuItem> createItems(SNode parameter, SubstituteMenuContext context) {
return new PersistentConfigurationType_Contribution.SMP_Group_67nl4b_b.SMP_Param_67nl4b_a1.SMP_Action_67nl4b_a0b(parameter).createItems(context);
}
@Nullable
@Override
protected Iterable<? extends SNode> getParameters(SubstituteMenuContext _context) {
return ListSequence.fromList(SModelOperations.rootsIncludingImported(_context.getModel(), MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f910020L, "jetbrains.mps.execution.settings.structure.PersistentConfiguration"))).where(new IWhereFilter<SNode>() {
public boolean accept(SNode it) {
return (AttributeOperations.getAttribute(it, new IAttributeDescriptor.NodeAttribute(MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0x7f8de21e263f5819L, "jetbrains.mps.execution.settings.structure.DeprecatedAnnotation"))) == null);
}
}).toListSequence();
}
private class SMP_Action_67nl4b_a0b extends SingleItemSubstituteMenuPart {
private final SNode myParameterObject;
public SMP_Action_67nl4b_a0b(SNode parameterObject) {
myParameterObject = parameterObject;
}
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new PersistentConfigurationType_Contribution.SMP_Group_67nl4b_b.SMP_Param_67nl4b_a1.SMP_Action_67nl4b_a0b.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f91001cL, "jetbrains.mps.execution.settings.structure.PersistentConfigurationType"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode node = SNodeFactoryOperations.createNewNode(SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f91001cL, "jetbrains.mps.execution.settings.structure.PersistentConfigurationType")), null);
SLinkOperations.setTarget(node, MetaAdapterFactory.getReferenceLink(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0xd244b712f91001cL, 0xd244b712f91001dL, "persistentConfiguration"), myParameterObject);
return node;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
if (myParameterObject instanceof SNode) {
return NodePresentationUtil.visibleMatchingText((SNode) myParameterObject, null);
}
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 getDescriptionText(@NotNull String pattern) {
return "configuration<" + SPropertyOperations.getString(myParameterObject, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")) + ">";
}
}
}
}
}
}