@Override
  public void expand() {
    if (myExpandedPopup != null || !getComponent().isEnabled()) return;

    if (myExpandHandler != null) {
      myExpandHandler.run();
      return;
    }

    XDebuggerExpressionEditor expressionEditor =
      new XDebuggerExpressionEditor(myProject, myDebuggerEditorsProvider, myHistoryId, mySourcePosition,
                                    getExpression(), true, true, false, myContext) {
        @Override
        protected JComponent decorate(JComponent component, boolean multiline, boolean showEditor) {
          return component;
        }
      };

    EditorTextField editorTextField = (EditorTextField)expressionEditor.getEditorComponent();
    editorTextField.addSettingsProvider(this::prepareEditor);
    editorTextField.addSettingsProvider(this::setExpandable);
    editorTextField.setFont(editorTextField.getFont().deriveFont((float)getEditor().getColorsScheme().getEditorFontSize()));

    JComponent component = expressionEditor.getComponent();
    // Don't set custom width here to support expand popup in RD/CWM
    // Component will be stretched with `setStretchToOwnerWidth`
    component.setPreferredSize(new Dimension(0, 100));

    myExpandedPopup = JBPopupFactory.getInstance()
      .createComponentPopupBuilder(component, expressionEditor.getPreferredFocusedComponent())
      .setMayBeParent(true)
      .setFocusable(true)
      .setResizable(true)
      .setRequestFocus(true)
      .setLocateByContent(true)
      .setStretchToOwnerWidth(true)
      .setCancelOnWindowDeactivation(false)
      .setAdText(getAdText())
      .setKeyboardActions(Collections.singletonList(Pair.create(event -> {
        collapse();
        Window window = ComponentUtil.getWindow(getComponent());
        if (window != null) {
          window.dispatchEvent(
            new KeyEvent(getComponent(), KeyEvent.KEY_PRESSED, System.currentTimeMillis(), InputEvent.CTRL_MASK, KeyEvent.VK_ENTER, '\r'));
        }
      }, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_MASK))))
      .setCancelCallback(() -> {
        setExpression(expressionEditor.getExpression());
        requestFocusInEditor();
        Editor baseEditor = getEditor();
        if (baseEditor != null) {
          foldNewLines((EditorEx)baseEditor);
          Editor newEditor = expressionEditor.getEditor();
          if (newEditor != null) {
            copyCaretPosition(newEditor, baseEditor);
            PropertiesComponent.getInstance().setValue(SOFT_WRAPS_KEY, newEditor.getSoftWrapModel().isSoftWrappingEnabled());
          }
        }
        myExpandedPopup = null;
        return true;
      }).createPopup();

    myExpandedPopup.show(new RelativePoint(getComponent(), new Point(0, 0)));

    EditorEx editor = (EditorEx)expressionEditor.getEditor();
    copyCaretPosition(getEditor(), editor);
    editor.getSettings().setUseSoftWraps(isUseSoftWraps());

    addCollapseButton(editor, this::collapse);

    expressionEditor.requestFocusInEditor();
  }
@Override
  public void expand()