package jetbrains.mps.lang.editor.menus.contextAssistant.testLanguage.intentions; /*Generated by MPS */ import jetbrains.mps.intentions.AbstractIntentionDescriptor; import jetbrains.mps.openapi.intentions.IntentionFactory; import jetbrains.mps.openapi.intentions.Kind; import jetbrains.mps.smodel.SNodePointer; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.openapi.editor.EditorContext; import java.util.Collection; import jetbrains.mps.openapi.intentions.IntentionExecutable; import java.util.List; import jetbrains.mps.internal.collections.runtime.ListSequence; import java.util.ArrayList; import jetbrains.mps.intentions.AbstractIntentionExecutable; import jetbrains.mps.openapi.intentions.ParameterizedIntentionExecutable; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.openapi.intentions.IntentionDescriptor; public final class AddLetterToName_Intention extends AbstractIntentionDescriptor implements IntentionFactory { public AddLetterToName_Intention() { super(Kind.NORMAL, false, new SNodePointer("r:e11988ca-dd7b-49ce-b283-28b999b925ea(jetbrains.mps.lang.editor.menus.contextAssistant.testLanguage.intentions)", "7291101478621544792")); } @Override public String getPresentation() { return "AddLetterToName"; } @Override public boolean isApplicable(final SNode node, final EditorContext editorContext) { return true; } @Override public boolean isSurroundWith() { return false; } public Collection<IntentionExecutable> instances(final SNode node, final EditorContext context) { List<IntentionExecutable> list = ListSequence.fromList(new ArrayList<IntentionExecutable>()); List<Character> paramList = parameter(node, context); if (paramList != null) { for (char param : paramList) { ListSequence.fromList(list).addElement(new AddLetterToName_Intention.IntentionImplementation(param)); } } return list; } private List<Character> parameter(final SNode node, final EditorContext editorContext) { return ListSequence.fromListAndArray(new ArrayList<Character>(), 'a', 'b', 'c', 'd'); } /*package*/ final class IntentionImplementation extends AbstractIntentionExecutable implements ParameterizedIntentionExecutable { private char myParameter; public IntentionImplementation(char parameter) { myParameter = parameter; } @Override public String getDescription(final SNode node, final EditorContext editorContext) { return "Append '" + myParameter + "' to name"; } @Override public void execute(final SNode node, final EditorContext editorContext) { SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), SPropertyOperations.getString_def(node, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "") + myParameter); } @Override public IntentionDescriptor getDescriptor() { return AddLetterToName_Intention.this; } public Object getParameter() { return myParameter; } } }