private boolean navigateInRequestedEditor() {
    DataContext ctx = DataManager.getInstance().getDataContext();
    Editor e = NAVIGATE_IN_EDITOR.getData(ctx);
    if (e == null) return false;
    if (FileDocumentManager.getInstance().getFile(e.getDocument()) != myFile) return false;

    navigateIn(e);
    return true;
  }
 private boolean navigateInAnyFileEditor(Project project, boolean focusEditor) {
   List<FileEditor> editors = FileEditorManager.getInstance(project).openEditor(this, focusEditor);
   for (FileEditor editor : editors) {
     if (editor instanceof TextEditor) {
       Editor e = ((TextEditor) editor).getEditor();
       unfoldCurrentLine(e);
       if (focusEditor) {
         IdeFocusManager.getInstance(myProject).requestFocus(e.getContentComponent(), true);
       }
     }
   }
   return !editors.isEmpty();
 }
  public void navigateIn(@NotNull Editor e) {
    final int offset = getOffset();
    CaretModel caretModel = e.getCaretModel();
    boolean caretMoved = false;
    if (myLogicalLine >= 0) {
      LogicalPosition pos = new LogicalPosition(myLogicalLine, Math.max(myLogicalColumn, 0));
      if (offset < 0 || offset == e.logicalPositionToOffset(pos)) {
        caretModel.moveToLogicalPosition(pos);
        caretMoved = true;
      }
    }
    if (!caretMoved && offset >= 0) {
      caretModel.moveToOffset(Math.min(offset, e.getDocument().getTextLength()));
      caretMoved = true;
    }

    if (caretMoved) {
      e.getSelectionModel().removeSelection();
      scrollToCaret(e);
      unfoldCurrentLine(e);
    }
  }
 private void unfoldCurrentLine(@NotNull final Editor editor) {
   final FoldRegion[] allRegions = editor.getFoldingModel().getAllFoldRegions();
   final int offset = editor.getCaretModel().getOffset();
   int line = editor.getDocument().getLineNumber(offset);
   int start = editor.getDocument().getLineStartOffset(line);
   int end = editor.getDocument().getLineEndOffset(line);
   final TextRange range = new TextRange(start, end);
   editor
       .getFoldingModel()
       .runBatchFoldingOperation(
           new Runnable() {
             @Override
             public void run() {
               for (FoldRegion region : allRegions) {
                 if (!region.isExpanded()
                     && range.intersects(
                         TextRange.create(
                             region))) /*region.getStartOffset() <= offset && offset <= region.getEndOffset()*/ {
                   region.setExpanded(true);
                 }
               }
             }
           });
 }
 private static void scrollToCaret(@NotNull Editor e) {
   e.getScrollingModel().scrollToCaret(ScrollType.CENTER);
 }