package jetbrains.mps.execution.commands.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.ParameterizedMenuPart;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SModelOperations;
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.runtime.IconResource;
import jetbrains.mps.smodel.runtime.IconResourceUtil;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
public class commandBuilderExpression 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 commandBuilderExpression.SMP_Param_rk0f2c_a(), MetaAdapterFactory.getConcept(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2bf4L, "jetbrains.mps.execution.commands.structure.CommandBuilderExpression")));
return result;
}
private class SMP_Param_rk0f2c_a extends ParameterizedMenuPart<SNode, SubstituteMenuItem, SubstituteMenuContext> {
@NotNull
@Override
protected List<SubstituteMenuItem> createItems(SNode parameter, SubstituteMenuContext context) {
return new commandBuilderExpression.SMP_Param_rk0f2c_a.SMP_Action_rk0f2c_a0(parameter).createItems(context);
}
@Nullable
@Override
protected Iterable<? extends SNode> getParameters(SubstituteMenuContext _context) {
return SModelOperations.nodesIncludingImported(_context.getModel(), MetaAdapterFactory.getConcept(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0x550ea9458ea107acL, "jetbrains.mps.execution.commands.structure.ExecuteCommandPart"));
}
private class SMP_Action_rk0f2c_a0 extends SingleItemSubstituteMenuPart {
private final SNode myParameterObject;
public SMP_Action_rk0f2c_a0(SNode parameterObject) {
myParameterObject = parameterObject;
}
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new commandBuilderExpression.SMP_Param_rk0f2c_a.SMP_Action_rk0f2c_a0.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2bf4L, "jetbrains.mps.execution.commands.structure.CommandBuilderExpression"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode builder = SNodeFactoryOperations.createNewNode(SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2bf4L, "jetbrains.mps.execution.commands.structure.CommandBuilderExpression")), null);
SLinkOperations.setTarget(builder, MetaAdapterFactory.getReferenceLink(0xf3347d8a0e794f35L, 0x8ac91574f25c986fL, 0xbe3a0d5ba1a2bf4L, 0x550ea9458ea1ac11L, "commandPart"), myParameterObject);
return builder;
}
@Nullable
@Override
public IconResource getIcon(@NotNull String pattern) {
if (myParameterObject instanceof SNode) {
return IconResourceUtil.getIconResourceForNode(((SNode) myParameterObject));
}
return null;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
return SPropertyOperations.getString(myParameterObject, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"));
}
@Nullable
@Override
public String getDescriptionText(@NotNull String pattern) {
return "command builder expression";
}
}
}
}
}