void (ServiceView serviceView) { ServiceViewOptions viewOptions = new ServiceViewOptions() { @Override public boolean isGroupByContributor() { return serviceView.isGroupByContributor(); } @Override public boolean isGroupByServiceGroups() { return serviceView.isGroupByServiceGroups(); } }; DataManager.registerDataProvider(serviceView, dataId -> { if (PlatformCoreDataKeys.HELP_ID.is(dataId)) { return ServiceViewManagerImpl.getToolWindowContextHelpId(); } if (PlatformCoreDataKeys.SELECTED_ITEMS.is(dataId)) { return ContainerUtil.map2Array(serviceView.getSelectedItems(), ServiceViewItem::getValue); } if (PlatformCoreDataKeys.SELECTED_ITEM.is(dataId)) { ServiceViewItem item = ContainerUtil.getOnlyItem(serviceView.getSelectedItems()); return item != null ? item.getValue() : null; } if (ServiceViewActionProvider.SERVICES_SELECTED_ITEMS.is(dataId)) { return serviceView.getSelectedItems(); } if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) { List<ServiceViewItem> selection = serviceView.getSelectedItems(); ServiceViewContributor<?> contributor = ServiceViewDragHelper.getTheOnlyRootContributor(selection); DataProvider delegate = contributor == null ? null : contributor.getViewDescriptor(serviceView.getProject()).getDataProvider(); DeleteProvider deleteProvider = delegate == null ? null : PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getData(delegate); if (deleteProvider == null) return new ServiceViewDeleteProvider(serviceView); if (deleteProvider instanceof ServiceViewContributorDeleteProvider) { ((ServiceViewContributorDeleteProvider)deleteProvider).setFallbackProvider(new ServiceViewDeleteProvider(serviceView)); } return deleteProvider; } if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) { return new ServiceViewCopyProvider(serviceView); } if (ServiceViewActionUtils.CONTRIBUTORS_KEY.is(dataId)) { return serviceView.getModel().getRoots().stream().map(item -> item.getRootContributor()).collect(Collectors.toSet()); } if (ServiceViewActionUtils.OPTIONS_KEY.is(dataId)) { return viewOptions; } List<ServiceViewItem> selectedItems = serviceView.getSelectedItems(); if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) { List<Navigatable> navigatables = ContainerUtil.mapNotNull(selectedItems, item -> item.getViewDescriptor().getNavigatable()); return navigatables.toArray(Navigatable.EMPTY_NAVIGATABLE_ARRAY); } ServiceViewItem selectedItem = ContainerUtil.getOnlyItem(selectedItems); ServiceViewDescriptor descriptor = selectedItem == null || selectedItem.isRemoved() ? null : selectedItem.getViewDescriptor(); DataProvider dataProvider = descriptor == null ? null : descriptor.getDataProvider(); if (dataProvider != null) { return RecursionManager.doPreventingRecursion(serviceView, false, () -> dataProvider.getData(dataId)); } return null; }); }