diff --git a/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java b/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java index 0d246fbb6e99..f4d7c7d3292e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java @@ -57,11 +57,17 @@ public class AutoPopupController implements Disposable { */ public static final Key ALWAYS_AUTO_POPUP = Key.create("Always Show Completion Auto-Popup"); /** - * If editor has Boolean.TRUE by this key completion popup would be shown every time when editor gets focus - * and the popup wouldn't have advertising text in bottom. - * For example this key can be used for TextFieldWithAutoCompletion. (It looks like usual JTextField and completion shortcut is not obvious to be active.) + * If editor has Boolean.TRUE by this key completion popup would be shown without advertising text at the bottom. */ - public static final Key ALWAYS_AUTO_POPUP_NO_ADS = Key.create("Always Show Completion Auto-Popup"); + public static final Key NO_ADS = Key.create("Show Completion Auto-Popup without Ads"); + + /** + * If editor has Boolean.TRUE by this key completion popup would be shown every time when editor gets focus. + * For example this key can be used for TextFieldWithAutoCompletion. + * (TextFieldWithAutoCompletion looks like standard JTextField and completion shortcut is not obvious to be active) + */ + public static final Key AUTO_POPUP_ON_FOCUS_GAINED = Key.create("Show Completion Auto-Popup On Focus Gained"); + private final Project myProject; private final Alarm myAlarm = new Alarm(); @@ -109,7 +115,7 @@ public class AutoPopupController implements Disposable { return; } - boolean alwaysAutoPopup = editor != null && (Boolean.TRUE.equals(editor.getUserData(ALWAYS_AUTO_POPUP)) || Boolean.TRUE.equals(editor.getUserData(ALWAYS_AUTO_POPUP_NO_ADS))); + boolean alwaysAutoPopup = editor != null && Boolean.TRUE.equals(editor.getUserData(ALWAYS_AUTO_POPUP)); if (!CodeInsightSettings.getInstance().AUTO_POPUP_COMPLETION_LOOKUP && !alwaysAutoPopup) { return; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index 7f93a57989eb..df89f6977669 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java @@ -683,7 +683,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable } myAdComponent.showRandomText(); - if (Boolean.TRUE.equals(myEditor.getUserData(AutoPopupController.ALWAYS_AUTO_POPUP_NO_ADS))) { + if (Boolean.TRUE.equals(myEditor.getUserData(AutoPopupController.NO_ADS))) { myAdComponent.clearAdvertisements(); } diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java index 03cfae9f468e..f9e14b38a283 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java @@ -320,7 +320,9 @@ public class FindPopupPanel extends JBPanel implements FindUI, DataProvider { @Override protected EditorEx createEditor() { EditorEx editor = super.createEditor(); - editor.putUserData(AutoPopupController.ALWAYS_AUTO_POPUP_NO_ADS, Boolean.TRUE); + editor.putUserData(AutoPopupController.ALWAYS_AUTO_POPUP, Boolean.TRUE); + editor.putUserData(AutoPopupController.NO_ADS, Boolean.TRUE); + editor.putUserData(AutoPopupController.AUTO_POPUP_ON_FOCUS_GAINED, Boolean.TRUE); return editor; } }; diff --git a/platform/lang-impl/src/com/intellij/util/textCompletion/TextCompletionUtil.java b/platform/lang-impl/src/com/intellij/util/textCompletion/TextCompletionUtil.java index b2f809cc0474..2b4159510163 100644 --- a/platform/lang-impl/src/com/intellij/util/textCompletion/TextCompletionUtil.java +++ b/platform/lang-impl/src/com/intellij/util/textCompletion/TextCompletionUtil.java @@ -70,7 +70,7 @@ public class TextCompletionUtil { editor.addFocusListener(new FocusChangeListener() { @Override public void focusGained(final Editor editor) { - if (Boolean.TRUE.equals(editor.getUserData(AutoPopupController.ALWAYS_AUTO_POPUP_NO_ADS))) { + if (Boolean.TRUE.equals(editor.getUserData(AutoPopupController.AUTO_POPUP_ON_FOCUS_GAINED))) { AutoPopupController.getInstance(editor.getProject()).scheduleAutoPopup(editor); return; }