package jetbrains.mps.baseLanguage.javadoc.intentions;
/*Generated by MPS */
import jetbrains.mps.openapi.editor.EditorContext;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.openapi.editor.cells.EditorCell;
import jetbrains.mps.nodeEditor.cells.EditorCell_Collection;
import jetbrains.mps.internal.collections.runtime.Sequence;
public class BlockDocTagHelper {
public static void setFocus(EditorContext editorContext, SNode node, String tagName) {
editorContext.flushEvents();
EditorCell tagEditorCell = editorContext.getEditorComponent().findNodeCell(node);
EditorCell cellToSelect = null;
if (tagEditorCell instanceof EditorCell_Collection) {
for (EditorCell childCell : Sequence.fromIterable((EditorCell_Collection) tagEditorCell)) {
String cellId = childCell.getCellId();
if (cellId != null && cellId.contains(tagName)) {
cellToSelect = childCell;
break;
}
}
}
editorContext.getEditorComponent().changeSelection((cellToSelect != null ? cellToSelect : tagEditorCell));
}
public static void setFocus(EditorContext editorContext, SNode node) {
setFocus(editorContext, node, "text");
}
}