package jetbrains.mps.ide.actions; /*Generated by MPS */ import jetbrains.mps.workbench.action.BaseAction; import javax.swing.Icon; import com.intellij.openapi.actionSystem.AnActionEvent; import java.util.Map; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.internal.collections.runtime.MapSequence; import org.jetbrains.mps.openapi.model.SModel; import org.jetbrains.mps.openapi.module.SModule; import org.jetbrains.annotations.NotNull; import jetbrains.mps.textgen.trace.TraceInfo; public class PrintNodePosition_Action extends BaseAction { private static final Icon ICON = null; public PrintNodePosition_Action() { super("Print Node Line", "", ICON); this.setIsAlwaysVisible(false); this.setExecuteOutsideCommand(false); } @Override public boolean isDumbAware() { return true; } @Override protected boolean collectActionData(AnActionEvent event, final Map<String, Object> _params) { if (!(super.collectActionData(event, _params))) { return false; } { SNode node = event.getData(MPSCommonDataKeys.NODE); MapSequence.fromMap(_params).put("node", node); if (node == null) { return false; } } { SModel p = event.getData(MPSCommonDataKeys.CONTEXT_MODEL); MapSequence.fromMap(_params).put("model", p); if (p == null) { return false; } } { SModule p = event.getData(MPSCommonDataKeys.CONTEXT_MODULE); MapSequence.fromMap(_params).put("module", p); if (p == null) { return false; } } return true; } @Override public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) { System.out.println(TraceInfo.getPositionForNode(((SNode) MapSequence.fromMap(_params).get("node")))); } }