IDEA-173487 New "Find in Path" dialog loses "File mask" dropdown history

Now completion popup with history is being shown when the field gets focus
(after-review)
This commit is contained in:
Vassiliy.Kudryashov
2017-06-20 15:22:33 +03:00
parent e0e781f3d7
commit 3d8962a96d
4 changed files with 16 additions and 8 deletions
@@ -57,11 +57,17 @@ public class AutoPopupController implements Disposable {
*/
public static final Key<Boolean> 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<Boolean> ALWAYS_AUTO_POPUP_NO_ADS = Key.create("Always Show Completion Auto-Popup");
public static final Key<Boolean> 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<Boolean> 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;
}
@@ -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();
}
@@ -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;
}
};
@@ -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;
}