diff --git a/api/plugin-api/src/main/java/com/yanncebron/m68kplugin/browser/M68kBrowserPaneBase.java b/api/plugin-api/src/main/java/com/yanncebron/m68kplugin/browser/M68kBrowserPaneBase.java index 85508df3..97acf960 100644 --- a/api/plugin-api/src/main/java/com/yanncebron/m68kplugin/browser/M68kBrowserPaneBase.java +++ b/api/plugin-api/src/main/java/com/yanncebron/m68kplugin/browser/M68kBrowserPaneBase.java @@ -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; @@ -153,7 +153,7 @@ public boolean isAvailable(@SuppressWarnings("unused") Project project) { */ protected abstract void initList(); - protected abstract Function getListItemNamer(); + protected abstract Convertor getListItemNamer(); protected String getListItemNameForLink(String link) { return StringUtil.toUpperCase(StringUtil.substringBefore(link, ".md")); @@ -166,7 +166,7 @@ protected ColoredListCellRenderer getListCellRenderer() { return new ColoredListCellRenderer<>() { @Override protected void customizeCellRenderer(@NotNull JList list, T value, int index, boolean selected, boolean hasFocus) { - append(getListItemNamer().fun(value)); + append(getListItemNamer().convert(value)); SpeedSearchUtil.applySpeedSearchHighlighting(list, this, true, selected); } @@ -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; @@ -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); diff --git a/platforms/amiga/src/main/java/com/yanncebron/m68kplugin/amiga/hardware/M68kAmigaHardwareBrowserPane.java b/platforms/amiga/src/main/java/com/yanncebron/m68kplugin/amiga/hardware/M68kAmigaHardwareBrowserPane.java index 675cb7fb..f98faa16 100644 --- a/platforms/amiga/src/main/java/com/yanncebron/m68kplugin/amiga/hardware/M68kAmigaHardwareBrowserPane.java +++ b/platforms/amiga/src/main/java/com/yanncebron/m68kplugin/amiga/hardware/M68kAmigaHardwareBrowserPane.java @@ -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; @@ -108,7 +108,7 @@ protected void initList() { } @Override - protected Function getListItemNamer() { + protected Convertor getListItemNamer() { return M68kAmigaHardwareRegister::getName; } @@ -162,7 +162,7 @@ protected ColoredListCellRenderer getListCellRenderer return new ColoredListCellRenderer<>() { @Override protected void customizeCellRenderer(@NotNull JList 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(); diff --git a/src/com/yanncebron/m68kplugin/browser/M68kDirectivesBrowserPane.java b/src/com/yanncebron/m68kplugin/browser/M68kDirectivesBrowserPane.java index e2ec7b6c..4362f7d6 100644 --- a/src/com/yanncebron/m68kplugin/browser/M68kDirectivesBrowserPane.java +++ b/src/com/yanncebron/m68kplugin/browser/M68kDirectivesBrowserPane.java @@ -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. @@ -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; @@ -51,8 +51,8 @@ protected ActionGroup getToolbarActionGroup() { } @Override - protected Function getListItemNamer() { - return (Function) elementType -> StringUtil.toUpperCase(elementType.toString()); + protected Convertor getListItemNamer() { + return (Convertor) elementType -> StringUtil.toUpperCase(elementType.toString()); } @Override diff --git a/src/com/yanncebron/m68kplugin/browser/M68kMnemonicsBrowserPane.java b/src/com/yanncebron/m68kplugin/browser/M68kMnemonicsBrowserPane.java index 8ac822cb..04d6293a 100644 --- a/src/com/yanncebron/m68kplugin/browser/M68kMnemonicsBrowserPane.java +++ b/src/com/yanncebron/m68kplugin/browser/M68kMnemonicsBrowserPane.java @@ -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. @@ -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; @@ -96,8 +96,8 @@ protected void initList() { } @Override - protected Function getListItemNamer() { - return (Function) mnemonic -> StringUtil.toUpperCase(mnemonic.getElementType().toString()); + protected Convertor getListItemNamer() { + return (Convertor) mnemonic -> StringUtil.toUpperCase(mnemonic.getElementType().toString()); } protected @NotNull String getDocFor(@NotNull M68kMnemonic mnemonic) {