Promise<TreePath> (@NotNull Object service, @NotNull Class<?> contributorClass, boolean safe) { AsyncPromise<TreePath> result = new AsyncPromise<>(); getInvoker().invoke(() -> { List<? extends ServiceViewItem> roots = myModel.getVisibleRoots(); ServiceViewItem serviceNode = JBTreeTraverser.from((Function<ServiceViewItem, List<ServiceViewItem>>)node -> contributorClass.isInstance(node.getRootContributor()) ? new ArrayList<>(myModel.getChildren(node)) : null) .withRoots(roots) .traverse(safe ? ServiceModel.ONLY_LOADED_BFS : ServiceModel.NOT_LOADED_LAST_BFS) .filter(node -> node.getValue().equals(service)) .first(); if (serviceNode != null) { List<Object> path = new ArrayList<>(); do { path.add(serviceNode); serviceNode = roots.contains(serviceNode) ? null : serviceNode.getParent(); } while (serviceNode != null); path.add(myRoot); Collections.reverse(path); result.setResult(new TreePath(ArrayUtil.toObjectArray(path))); return; } result.setError("Service not found"); }); return result; }