package jetbrains.mps.ide.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 com.intellij.openapi.project.Project;
import jetbrains.mps.internal.collections.runtime.MapSequence;
import jetbrains.mps.ide.bookmark.BookmarkManager;
import com.intellij.openapi.actionSystem.CommonDataKeys;
public class GoToBookmark_Action extends BaseAction {
private static final Icon ICON = null;
private int num;
public GoToBookmark_Action(int num_par) {
super("Go to Bookmark", "", ICON);
this.num = num_par;
this.setIsAlwaysVisible(false);
this.setExecuteOutsideCommand(false);
}
@Override
public boolean isDumbAware() {
return true;
}
@Override
public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
event.getPresentation().setText("Go to Bookmark " + GoToBookmark_Action.this.num);
event.getPresentation().setEnabled(((Project) MapSequence.fromMap(_params).get("project")).getComponent(BookmarkManager.class).getBookmark(GoToBookmark_Action.this.num) != 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("project", p);
if (p == null) {
return false;
}
}
return true;
}
@Override
public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
((Project) MapSequence.fromMap(_params).get("project")).getComponent(BookmarkManager.class).navigateToBookmark(GoToBookmark_Action.this.num);
}
@NotNull
public String getActionId() {
StringBuilder res = new StringBuilder();
res.append(super.getActionId());
res.append("#");
res.append(((Object) this.num).toString());
res.append("!");
return res.toString();
}
}