Skip to content

Commit

Permalink
[code-completion] LookupImpl: warnings fixed
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 987f5c6b343f4ea9db66692552c8f9c292ef276b
  • Loading branch information
amaembo authored and intellij-monorepo-bot committed Apr 4, 2022
1 parent f8afa22 commit 1112f14
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorModificationUtil;
import com.intellij.openapi.editor.EditorModificationUtilEx;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.colors.FontPreferences;
Expand Down Expand Up @@ -81,7 +80,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable,
private final Project myProject;
private final Editor myEditor;
private final Object myUiLock = new Object();
private final JBList myList = new JBList<LookupElement>(new CollectionListModel<>()) {
private final JBList<LookupElement> myList = new JBList<LookupElement>(new CollectionListModel<>()) {
// 'myList' is focused when "Screen Reader" mode is enabled
@Override
protected void processKeyEvent(@NotNull final KeyEvent e) {
Expand Down Expand Up @@ -175,7 +174,6 @@ public LookupImpl(Project project, Editor editor, @NotNull LookupArranger arrang
}

private CollectionListModel<LookupElement> getListModel() {
//noinspection unchecked
return (CollectionListModel<LookupElement>)myList.getModel();
}

Expand Down Expand Up @@ -523,7 +521,7 @@ public PrefixMatcher itemMatcher(@NotNull LookupElement item) {
}

public void finishLookup(final char completionChar) {
finishLookup(completionChar, (LookupElement)myList.getSelectedValue());
finishLookup(completionChar, myList.getSelectedValue());
}

public void finishLookup(char completionChar, @Nullable final LookupElement item) {
Expand Down Expand Up @@ -876,14 +874,14 @@ protected boolean suppressHidingOnChange() {
@Nullable
public LookupElement getCurrentItem(){
synchronized (myUiLock) {
LookupElement item = (LookupElement)myList.getSelectedValue();
LookupElement item = myList.getSelectedValue();
return item instanceof EmptyLookupItem ? null : item;
}
}

@Override
public LookupElement getCurrentItemOrEmpty() {
return (LookupElement)myList.getSelectedValue();
return myList.getSelectedValue();
}

@Override
Expand Down Expand Up @@ -983,7 +981,7 @@ private void fireUiRefreshed() {

public void replacePrefix(final String presentPrefix, final String newPrefix) {
if (!performGuardedChange(() -> {
EditorModificationUtil.deleteSelectedText(myEditor);
EditorModificationUtilEx.deleteSelectedText(myEditor);
int offset = myEditor.getCaretModel().getOffset();
final int start = offset - presentPrefix.length();
myEditor.getDocument().replaceString(start, offset, newPrefix);
Expand Down

0 comments on commit 1112f14

Please sign in to comment.