package jetbrains.mps.baseLanguage.intentions;
/*Generated by MPS */
import jetbrains.mps.intentions.AbstractIntentionDescriptor;
import jetbrains.mps.openapi.intentions.IntentionFactory;
import java.util.Collection;
import jetbrains.mps.openapi.intentions.IntentionExecutable;
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 jetbrains.mps.baseLanguage.behavior.IfStatement__BehaviorDescriptor;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import java.util.Collections;
import jetbrains.mps.intentions.AbstractIntentionExecutable;
import jetbrains.mps.openapi.intentions.IntentionDescriptor;
public final class MakeOneLiner_Intention extends AbstractIntentionDescriptor implements IntentionFactory {
private Collection<IntentionExecutable> myCachedExecutable;
public MakeOneLiner_Intention() {
super(Kind.NORMAL, false, new SNodePointer("r:00000000-0000-4000-0000-011c895902c6(jetbrains.mps.baseLanguage.intentions)", "4467513934994688403"));
}
@Override
public String getPresentation() {
return "MakeOneLiner";
}
@Override
public boolean isApplicable(final SNode node, final EditorContext editorContext) {
if (!(isApplicableToNode(node, editorContext))) {
return false;
}
return true;
}
private boolean isApplicableToNode(final SNode node, final EditorContext editorContext) {
return !((boolean) IfStatement__BehaviorDescriptor.isGuardIf_idi0z$SHa.invoke(node)) && !(SPropertyOperations.getBoolean(node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b217L, 0x3dffcc410476e370L, "forceOneLine")));
}
@Override
public boolean isSurroundWith() {
return false;
}
public Collection<IntentionExecutable> instances(final SNode node, final EditorContext context) {
if (myCachedExecutable == null) {
myCachedExecutable = Collections.<IntentionExecutable>singletonList(new MakeOneLiner_Intention.IntentionImplementation());
}
return myCachedExecutable;
}
/*package*/ final class IntentionImplementation extends AbstractIntentionExecutable {
public IntentionImplementation() {
}
@Override
public String getDescription(final SNode node, final EditorContext editorContext) {
return "Make One Liner";
}
@Override
public void execute(final SNode node, final EditorContext editorContext) {
SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b217L, 0x3dffcc410476e371L, "forceMultiLine"), "" + (false));
SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b217L, 0x3dffcc410476e370L, "forceOneLine"), "" + (true));
}
@Override
public IntentionDescriptor getDescriptor() {
return MakeOneLiner_Intention.this;
}
}
}