package jetbrains.mps.samples.multipleProjections.requestTracking.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 java.util.Collections; import jetbrains.mps.intentions.AbstractIntentionExecutable; import jetbrains.mps.openapi.intentions.IntentionDescriptor; public final class ViewAllAsTabular_Intention extends AbstractIntentionDescriptor implements IntentionFactory { private Collection<IntentionExecutable> myCachedExecutable; public ViewAllAsTabular_Intention() { super(Kind.NORMAL, true, new SNodePointer("r:609c99e8-3a24-425d-8723-60cb603f5c76(jetbrains.mps.samples.multipleProjections.requestTracking.intentions)", "1007054899182495150")); } @Override public String getPresentation() { return "ViewAllAsTabular"; } @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) { if (myCachedExecutable == null) { myCachedExecutable = Collections.<IntentionExecutable>singletonList(new ViewAllAsTabular_Intention.IntentionImplementation()); } return myCachedExecutable; } /*package*/ final class IntentionImplementation extends AbstractIntentionExecutable { public IntentionImplementation() { } @Override public String getDescription(final SNode node, final EditorContext editorContext) { String[] initialEditorHints = editorContext.getEditorComponent().getUpdater().getInitialEditorHints(); if (initialEditorHints == null || initialEditorHints.length == 0) { return "View All As Tabular"; } else { return "View All As Structural"; } } @Override public void execute(final SNode node, final EditorContext editorContext) { String[] initialEditorHints = editorContext.getEditorComponent().getUpdater().getInitialEditorHints(); if (initialEditorHints == null || initialEditorHints.length == 0) { editorContext.getEditorComponent().getUpdater().setInitialEditorHints(new String[]{"jetbrains.mps.samples.multipleProjections.requestTracking.editor.WorkflowPresentations.tabular"}); } else { editorContext.getEditorComponent().getUpdater().setInitialEditorHints(new String[]{}); } editorContext.getEditorComponent().getUpdater().update(); } @Override public IntentionDescriptor getDescriptor() { return ViewAllAsTabular_Intention.this; } } }