diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java index b7e36066108a..a055757c9814 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.xdebugger.impl.ui; import com.intellij.openapi.editor.Document; @@ -102,18 +100,12 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase { } private void fillComboBox() { + myModel.setSelectedItem(null); // must do this to preserve current editor myModel.replaceAll(getRecentExpressions()); - if (myComboBox.getItemCount() > 0) { - myComboBox.setSelectedIndex(0); - } } @Override protected void doSetText(XExpression text) { - if (myComboBox.getItemCount() > 0) { - myComboBox.setSelectedIndex(0); - } - //if (myComboBox.isEditable()) { myEditor.setItem(text); //} @@ -189,11 +181,10 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase { @Override public void setItem(Object anObject) { - if (anObject == null) { - anObject = XExpressionImpl.EMPTY_EXPRESSION; + if (anObject != null) { // do not reset the editor on null + XExpression expression = (XExpression)anObject; + myDelegate.getEditorComponent().setNewDocumentAndFileType(getFileType(expression), createDocument(expression)); } - XExpression expression = (XExpression)anObject; - myDelegate.getEditorComponent().setNewDocumentAndFileType(getFileType(expression), createDocument(expression)); } @Override