package jetbrains.mps.baseLanguage.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.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.SPropertyOperations;
import jetbrains.mps.lang.editor.menus.ParameterizedMenuPart;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import jetbrains.mps.smodel.runtime.IconResource;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import jetbrains.mps.lang.editor.menus.GroupMenuPart;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import java.util.Arrays;
import jetbrains.mps.lang.editor.menus.substitute.SimpleConceptSubstituteMenuPart;
public class constants 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 constants.SMP_Action_w0ulk7_a(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, "jetbrains.mps.baseLanguage.structure.IntegerConstant")));
result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new constants.SMP_Action_w0ulk7_b(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x3b418722717710b4L, "jetbrains.mps.baseLanguage.structure.LongLiteral")));
result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new constants.SMP_Param_w0ulk7_c(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, "jetbrains.mps.baseLanguage.structure.BooleanConstant")));
result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new constants.SMP_Action_w0ulk7_d(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x102cb19a434L, "jetbrains.mps.baseLanguage.structure.FloatingPointConstant")));
result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new constants.SMP_Action_w0ulk7_e(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x494547eeedc219b9L, "jetbrains.mps.baseLanguage.structure.FloatingPointFloatConstant")));
result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new constants.SMP_Action_w0ulk7_f(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, "jetbrains.mps.baseLanguage.structure.StringLiteral")));
result.add(new constants.SMP_Group_w0ulk7_g());
return result;
}
private class SMP_Action_w0ulk7_a extends SingleItemSubstituteMenuPart {
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new constants.SMP_Action_w0ulk7_a.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, "jetbrains.mps.baseLanguage.structure.IntegerConstant"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode intConst = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, "jetbrains.mps.baseLanguage.structure.IntegerConstant")), null);
try {
SPropertyOperations.set(intConst, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "" + (Integer.parseInt(pattern)));
} catch (NumberFormatException e) {
SPropertyOperations.set(intConst, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc59b314L, 0xf8cc59b315L, "value"), "" + (0));
}
return intConst;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
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) {
if (strictly) {
return REGEXP_w0ulk7_a0a0a0a7c1.matcher(pattern).matches();
} else {
return REGEXP_w0ulk7_a0a0a0a0h2b.matcher(pattern).matches();
}
}
}
}
private class SMP_Action_w0ulk7_b extends SingleItemSubstituteMenuPart {
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new constants.SMP_Action_w0ulk7_b.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x3b418722717710b4L, "jetbrains.mps.baseLanguage.structure.LongLiteral"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode result = SNodeFactoryOperations.createNewNode(SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x3b418722717710b4L, "jetbrains.mps.baseLanguage.structure.LongLiteral")), null);
SPropertyOperations.set(result, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x3b418722717710b4L, 0x3b418722717710b5L, "value"), pattern);
return result;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
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 REGEXP_w0ulk7_a0a0a7c2.matcher(pattern).matches();
}
}
}
private class SMP_Param_w0ulk7_c extends ParameterizedMenuPart<Boolean, SubstituteMenuItem, SubstituteMenuContext> {
@NotNull
@Override
protected List<SubstituteMenuItem> createItems(Boolean parameter, SubstituteMenuContext context) {
return new constants.SMP_Param_w0ulk7_c.SMP_Action_w0ulk7_a2(parameter).createItems(context);
}
@Nullable
@Override
protected Iterable<? extends Boolean> getParameters(SubstituteMenuContext _context) {
return ListSequence.fromListAndArray(new ArrayList<Boolean>(), Boolean.TRUE, Boolean.FALSE);
}
private class SMP_Action_w0ulk7_a2 extends SingleItemSubstituteMenuPart {
private final Boolean myParameterObject;
public SMP_Action_w0ulk7_a2(Boolean parameterObject) {
myParameterObject = parameterObject;
}
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new constants.SMP_Param_w0ulk7_c.SMP_Action_w0ulk7_a2.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, "jetbrains.mps.baseLanguage.structure.BooleanConstant"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode integerConst = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, "jetbrains.mps.baseLanguage.structure.BooleanConstant")), null);
SPropertyOperations.set(integerConst, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b201L, 0xf8cc56b202L, "value"), "" + (myParameterObject.booleanValue()));
return integerConst;
}
@Nullable
@Override
public String getDescriptionText(@NotNull String pattern) {
return "";
}
@Nullable
@Override
public IconResource getIcon(@NotNull String pattern) {
return null;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
return myParameterObject.toString();
}
}
}
}
private class SMP_Action_w0ulk7_d extends SingleItemSubstituteMenuPart {
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new constants.SMP_Action_w0ulk7_d.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x102cb19a434L, "jetbrains.mps.baseLanguage.structure.FloatingPointConstant"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode doubleConstant = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x102cb19a434L, "jetbrains.mps.baseLanguage.structure.FloatingPointConstant")), null);
SPropertyOperations.set(doubleConstant, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x102cb19a434L, 0x103245d193fL, "value"), pattern);
return doubleConstant;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
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 REGEXP_w0ulk7_a0a0a7c4.matcher(pattern).matches();
}
}
}
private class SMP_Action_w0ulk7_e extends SingleItemSubstituteMenuPart {
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new constants.SMP_Action_w0ulk7_e.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x494547eeedc219b9L, "jetbrains.mps.baseLanguage.structure.FloatingPointFloatConstant"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode floatConst = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x494547eeedc219b9L, "jetbrains.mps.baseLanguage.structure.FloatingPointFloatConstant")), null);
SPropertyOperations.set(floatConst, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x494547eeedc219b9L, 0x494547eeedc219bbL, "value"), pattern);
return floatConst;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
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 REGEXP_w0ulk7_a0a0a7c5.matcher(pattern).matches();
}
}
}
private class SMP_Action_w0ulk7_f extends SingleItemSubstituteMenuPart {
@Nullable
@Override
protected SubstituteMenuItem createItem(SubstituteMenuContext _context) {
return new constants.SMP_Action_w0ulk7_f.Item(_context);
}
private class Item extends DefaultSubstituteMenuItem {
private final SubstituteMenuContext _context;
public Item(SubstituteMenuContext context) {
super(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, "jetbrains.mps.baseLanguage.structure.StringLiteral"), context.getParentNode(), context.getCurrentTargetNode(), context.getEditorContext());
_context = context;
}
@Nullable
@Override
public SNode createNode(@NotNull String pattern) {
SNode stringLiteral = SNodeFactoryOperations.createNewNode(_context.getModel(), SNodeFactoryOperations.asInstanceConcept(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, "jetbrains.mps.baseLanguage.structure.StringLiteral")), null);
{
Pattern _pattern_0 = REGEXP_w0ulk7_a0a0b0d2g;
Matcher _matcher_0 = _pattern_0.matcher(pattern);
if (_matcher_0.matches()) {
SPropertyOperations.set(stringLiteral, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), _matcher_0.group(1));
}
}
return stringLiteral;
}
@Nullable
@Override
public String getMatchingText(@NotNull String pattern) {
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 REGEXP_w0ulk7_a0a0a7c6.matcher(pattern).matches();
}
}
}
public class SMP_Group_w0ulk7_g extends GroupMenuPart<SubstituteMenuItem, SubstituteMenuContext> {
@Override
protected boolean isApplicable(SubstituteMenuContext _context) {
return SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, "jetbrains.mps.baseLanguage.structure.VariableDeclaration")) || SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a770dc0dL, "jetbrains.mps.baseLanguage.structure.ArrayLiteral")) || SNodeOperations.isInstanceOf(_context.getParentNode(), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a71b1af4L, "jetbrains.mps.baseLanguage.structure.AnnotationInstanceValue"));
}
@Override
protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts() {
return Arrays.<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>asList(new ConstraintsFilteringSubstituteMenuPartDecorator(new SimpleConceptSubstituteMenuPart(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a770dc0dL, "jetbrains.mps.baseLanguage.structure.ArrayLiteral")), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a770dc0dL, "jetbrains.mps.baseLanguage.structure.ArrayLiteral")));
}
}
private static Pattern REGEXP_w0ulk7_a0a0a0a7c1 = Pattern.compile("-?\\d+", 0);
private static Pattern REGEXP_w0ulk7_a0a0a0a0h2b = Pattern.compile("-?\\d*", 0);
private static Pattern REGEXP_w0ulk7_a0a0a7c2 = Pattern.compile("-?\\d+(?:l|L)", 0);
private static Pattern REGEXP_w0ulk7_a0a0a7c4 = Pattern.compile("-?[0-9]+\\.[0-9]*(?:[eE][\\-\\+]?[0-9]+)?[dD]?", 0);
private static Pattern REGEXP_w0ulk7_a0a0a7c5 = Pattern.compile("-?[0-9]+\\.[0-9]*(?:[eE][\\-\\+]?[0-9]+)?[fF]", 0);
private static Pattern REGEXP_w0ulk7_a0a0b0d2g = Pattern.compile("\"([^\\\\\"]*)\"?", 0);
private static Pattern REGEXP_w0ulk7_a0a0a7c6 = Pattern.compile("\"[^\\\\\"]*\"?", 0);
}