@@ -228,23 +228,6 @@ public void addButton(final String label, final String tooltip,
228228 buttons .add (button );
229229 }
230230
231- // -- Utility methods --
232-
233- // TODO: Move this method to PluginService.
234- public <PT extends SciJavaPlugin > void sort (final List <PT > instances ,
235- final Class <PT > type )
236- {
237- // Create a mapping from plugin classes to priorities.
238- final List <PluginInfo <PT >> plugins = pluginService .getPluginsOfType (type );
239- final Map <Class <?>, PluginInfo <PT >> infos = plugins .stream ().collect (//
240- Collectors .toMap (PluginInfo ::getPluginClass , Function .identity ()));
241-
242- // Compare plugin instances by priority via the mapping.
243- final Comparator <PT > comparator = (o1 , o2 ) -> Priority .compare (//
244- infos .get (o1 .getClass ()), infos .get (o2 .getClass ()));
245- Collections .sort (instances , comparator );
246- }
247-
248231 // -- Internal methods --
249232
250233 /** Called on the EDT when the search panel wants to appear. */
@@ -653,7 +636,7 @@ private void rebuild() {
653636 // Gets list of Searchers, sorted by priority.
654637 final List <Searcher > searchers = allResults .values ().stream ().map (
655638 event -> event .searcher ()).collect (Collectors .toList ());
656- sort (searchers , Searcher .class );
639+ pluginService . sort (searchers , Searcher .class );
657640
658641 // Build the new list model.
659642 final DefaultListModel <SearchResult > listModel = new DefaultListModel <>();
0 commit comments