package jetbrains.mps.debugger.java.runtime.ui.actions; /*Generated by MPS */ import jetbrains.mps.workbench.action.BaseAction; import javax.swing.Icon; import org.jetbrains.annotations.NotNull; import com.intellij.openapi.actionSystem.AnActionEvent; import java.util.Map; import jetbrains.mps.debugger.java.runtime.ui.evaluation.EvaluationUi; import com.intellij.openapi.project.Project; import com.intellij.openapi.actionSystem.CommonDataKeys; import jetbrains.mps.internal.collections.runtime.MapSequence; import jetbrains.mps.debugger.java.runtime.evaluation.container.IEvaluationContainer; import jetbrains.mps.debugger.java.runtime.state.DebugSession; public class EditWatchAction_Action extends BaseAction { private static final Icon ICON = null; public EditWatchAction_Action() { super("Edit Watch", "", ICON); this.setIsAlwaysVisible(true); this.setExecuteOutsideCommand(true); } @Override public boolean isDumbAware() { return true; } @Override public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) { event.getPresentation().setVisible(EvaluationUi.EVALUATION_CONTAINER.getData(event.getDataContext()) != null && EvaluationUi.DEBUG_SESSION.getData(event.getDataContext()) != null); } @Override protected boolean collectActionData(AnActionEvent event, final Map<String, Object> _params) { if (!(super.collectActionData(event, _params))) { return false; } { Project p = event.getData(CommonDataKeys.PROJECT); MapSequence.fromMap(_params).put("ideaProject", p); if (p == null) { return false; } } return true; } @Override public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) { IEvaluationContainer container = EvaluationUi.EVALUATION_CONTAINER.getData(event.getDataContext()); DebugSession session = EvaluationUi.DEBUG_SESSION.getData(event.getDataContext()); if (container == null || session == null) { return; } session.getEvaluationProvider().showEditWatchDialog(((Project) MapSequence.fromMap(_params).get("ideaProject")), container); } }