void (@NotNull AbstractTreeStructure treeStructure, @NotNull Runnable finish) { final SliceRootNode root = (SliceRootNode)treeStructure.getRootElement(); final Ref<NullAnalysisResult> leafExpressions = Ref.create(null); final Map<SliceNode, NullAnalysisResult> map = createMap(); ProgressManager.getInstance().run(new Task.Backgroundable( root.getProject(), KotlinIdeaCompletionBundle.message("slice.nullness.progress.title.expanding.all.nodes"), true) { @Override public void run(@NotNull final ProgressIndicator indicator) { NullAnalysisResult l = calcNullableLeaves(root, treeStructure, map); leafExpressions.set(l); } @Override public void onCancel() { finish.run(); } @Override public void onSuccess() { try { NullAnalysisResult leaves = leafExpressions.get(); if (leaves == null) return; //cancelled groupByNullness(leaves, root, map); } finally { finish.run(); } } }); }