void (SingeServiceModel viewModel, Content content) { ContentManager contentManager = content.getManager(); viewModel.addModelListener(() -> { ServiceViewItem item = viewModel.getService(); if (item != null && !viewModel.getChildren(item).isEmpty() && contentManager != null) { AppUIExecutor.onUiThread().expireWith(contentManager).submit(() -> { ServiceViewItem viewItem = viewModel.getService(); if (viewItem == null) return; int index = contentManager.getIndexOfContent(content); if (index < 0) return; contentManager.removeContent(content, true); ServiceListModel listModel = new ServiceListModel(myModel, myModelFilter, new SmartList<>(viewItem), viewModel.getFilter().getParent()); ServiceView listView = ServiceView.createView(myProject, listModel, prepareViewState(new ServiceViewState())); Content listContent = addServiceContent(contentManager, listView, viewItem.getViewDescriptor().getContentPresentation(), true, index); extractList(listModel, listContent); }); } else { updateContentTab(item, content); } }); updateContentTab(viewModel.getService(), content); }