use of com.intellij.find.editorHeaderActions.VariantsCompletionAction in project intellij-community by JetBrains.
the class SearchReplaceComponent method updateReplaceComponent.
private void updateReplaceComponent(@NotNull String textToSet) {
if (!updateTextComponent(false)) {
String existingText = myReplaceTextComponent.getText();
if (!existingText.equals(textToSet)) {
myReplaceTextComponent.setText(textToSet);
if (existingText.length() == 0)
myReplaceTextComponent.selectAll();
}
return;
}
myReplaceTextComponent.setText(textToSet);
myReplaceTextComponent.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
ApplicationManager.getApplication().invokeLater(() -> replaceFieldDocumentChanged());
}
});
if (!isMultiline()) {
installReplaceOnEnterAction(myReplaceTextComponent);
}
new VariantsCompletionAction(myReplaceTextComponent);
myReplaceFieldWrapper.revalidate();
myReplaceFieldWrapper.repaint();
}
use of com.intellij.find.editorHeaderActions.VariantsCompletionAction in project intellij-community by JetBrains.
the class SearchReplaceComponent method updateSearchComponent.
private void updateSearchComponent(@NotNull String textToSet) {
if (!updateTextComponent(true)) {
String existingText = mySearchTextComponent.getText();
if (!existingText.equals(textToSet)) {
mySearchTextComponent.setText(textToSet);
// textToSet should be selected even if we have no selection before (if we have the selection then setText will remain it)
if (existingText.length() == 0)
mySearchTextComponent.selectAll();
}
return;
}
mySearchTextComponent.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
ApplicationManager.getApplication().invokeLater(() -> searchFieldDocumentChanged());
}
});
mySearchTextComponent.registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
if (StringUtil.isEmpty(mySearchTextComponent.getText())) {
close();
} else {
IdeFocusManager.getInstance(myProject).requestFocus(myTargetComponent, true);
addTextToRecent(mySearchTextComponent);
}
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, SystemInfo.isMac ? META_DOWN_MASK : CTRL_DOWN_MASK), JComponent.WHEN_FOCUSED);
// It registers a shortcut set automatically on construction
new VariantsCompletionAction(mySearchTextComponent);
}
Aggregations