Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
M68kBrowserPaneBase: update usages of deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
YannCebron committed Mar 30, 2024
1 parent 47153a4 commit 6d120e8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import com.intellij.ui.navigation.Place;
import com.intellij.ui.scale.JBUIScale;
import com.intellij.ui.speedSearch.SpeedSearchUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.Convertor;
import com.intellij.util.ui.HTMLEditorKitBuilder;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
Expand Down Expand Up @@ -153,7 +153,7 @@ public boolean isAvailable(@SuppressWarnings("unused") Project project) {
*/
protected abstract void initList();

protected abstract Function<? super T, String> getListItemNamer();
protected abstract Convertor<? super T, String> getListItemNamer();

protected String getListItemNameForLink(String link) {
return StringUtil.toUpperCase(StringUtil.substringBefore(link, ".md"));
Expand All @@ -166,7 +166,7 @@ protected ColoredListCellRenderer<T> getListCellRenderer() {
return new ColoredListCellRenderer<>() {
@Override
protected void customizeCellRenderer(@NotNull JList<? extends T> list, T value, int index, boolean selected, boolean hasFocus) {
append(getListItemNamer().fun(value));
append(getListItemNamer().convert(value));

SpeedSearchUtil.applySpeedSearchHighlighting(list, this, true, selected);
}
Expand Down Expand Up @@ -219,7 +219,7 @@ protected void hyperlinkActivated(@NotNull HyperlinkEvent e) {
String elementName = getListItemNameForLink(e.getDescription());
for (int i = 0; i < list.getItemsCount(); i++) {
T element = list.getModel().getElementAt(i);
if (StringUtil.equals(elementName, getListItemNamer().fun(element))) {
if (StringUtil.equals(elementName, getListItemNamer().convert(element))) {
list.setSelectedIndex(i);
list.ensureIndexIsVisible(i);
return;
Expand Down Expand Up @@ -263,7 +263,7 @@ private JComponent createList() {
updateDoc();
});
ScrollingUtil.installActions(list);
new ListSpeedSearch<>(list, getListItemNamer());
TreeUIHelper.getInstance().installListSpeedSearch(list, getListItemNamer());

JBScrollPane scrollPane = new JBScrollPane(list);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.speedSearch.SpeedSearchUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.Convertor;
import com.yanncebron.m68kplugin.amiga.M68kAmigaBundle;
import com.yanncebron.m68kplugin.browser.M68kBrowserPaneBase;
import com.yanncebron.m68kplugin.documentation.M68kDocumentationUtil;
Expand Down Expand Up @@ -108,7 +108,7 @@ protected void initList() {
}

@Override
protected Function<? super M68kAmigaHardwareRegister, String> getListItemNamer() {
protected Convertor<? super M68kAmigaHardwareRegister, String> getListItemNamer() {
return M68kAmigaHardwareRegister::getName;
}

Expand Down Expand Up @@ -162,7 +162,7 @@ protected ColoredListCellRenderer<M68kAmigaHardwareRegister> getListCellRenderer
return new ColoredListCellRenderer<>() {
@Override
protected void customizeCellRenderer(@NotNull JList<? extends M68kAmigaHardwareRegister> list, M68kAmigaHardwareRegister value, int index, boolean selected, boolean hasFocus) {
append(getListItemNamer().fun(value));
append(getListItemNamer().convert(value));

if (isAnnotateChipset.get()) {
M68kAmigaHardwareRegister.Chipset chipset = value.getChipset();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 The Authors
* Copyright 2024 The Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.Function;
import com.intellij.util.containers.Convertor;
import com.yanncebron.m68kplugin.documentation.M68kDirectiveDocumentationProvider;
import com.yanncebron.m68kplugin.lang.psi.M68kTokenGroups;
import com.yanncebron.m68kplugin.lang.psi.M68kTokenTypes;
Expand Down Expand Up @@ -51,8 +51,8 @@ protected ActionGroup getToolbarActionGroup() {
}

@Override
protected Function<? super IElementType, String> getListItemNamer() {
return (Function<IElementType, String>) elementType -> StringUtil.toUpperCase(elementType.toString());
protected Convertor<? super IElementType, String> getListItemNamer() {
return (Convertor<IElementType, String>) elementType -> StringUtil.toUpperCase(elementType.toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 The Authors
* Copyright 2024 The Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,9 +22,9 @@
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.Function;
import com.intellij.util.IconUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Convertor;
import com.yanncebron.m68kplugin.M68kBundle;
import com.yanncebron.m68kplugin.documentation.M68kDocumentationUtil;
import com.yanncebron.m68kplugin.documentation.M68kInstructionDocumentationProvider;
Expand Down Expand Up @@ -96,8 +96,8 @@ protected void initList() {
}

@Override
protected Function<? super M68kMnemonic, String> getListItemNamer() {
return (Function<M68kMnemonic, String>) mnemonic -> StringUtil.toUpperCase(mnemonic.getElementType().toString());
protected Convertor<? super M68kMnemonic, String> getListItemNamer() {
return (Convertor<M68kMnemonic, String>) mnemonic -> StringUtil.toUpperCase(mnemonic.getElementType().toString());
}

protected @NotNull String getDocFor(@NotNull M68kMnemonic mnemonic) {
Expand Down

0 comments on commit 6d120e8

Please sign in to comment.