mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
[ui] fix selection when editor is not fully initialized
related to IDEA-335018 and needed for WI-27593 GitOrigin-RevId: b531e27b144c547b7e97d8f5168c137e2f1c3221
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b1c0963942
commit
89626af21e
@@ -120,11 +120,10 @@ public class NameSuggestionsField extends JPanel {
|
|||||||
|
|
||||||
public void select(final int start, final int end) {
|
public void select(final int start, final int end) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
Editor editor = getEditor();
|
EditorTextField textField = getEditorTextField();
|
||||||
if (editor == null) return;
|
if (textField == null) return;
|
||||||
editor.getSelectionModel().setSelection(start, end);
|
textField.select(TextRange.create(start, end));
|
||||||
editor.getCaretModel().moveToOffset(end);
|
textField.setCaretPosition(end);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user