Object (@Nullable Project project, @NotNull JTree tree, @NotNull String dataId) { if (CommonDataKeys.PROJECT.is(dataId)) { return project; } else if (VcsDataKeys.CHANGES.is(dataId)) { Change[] changes = mapToChange(selected(tree)).toArray(Change.EMPTY_CHANGE_ARRAY); if (changes.length != 0) return changes; return mapToChange(all(tree)).toArray(Change.EMPTY_CHANGE_ARRAY); } else if (VcsDataKeys.SELECTED_CHANGES.is(dataId) || VcsDataKeys.SELECTED_CHANGES_IN_DETAILS.is(dataId)) { return mapToChange(selected(tree)).toArray(Change.EMPTY_CHANGE_ARRAY); } else if (VcsDataKeys.CHANGES_SELECTION.is(dataId)) { return getListSelectionOrAll(tree).map(entry -> ObjectUtils.tryCast(entry, Change.class)); } else if (VcsDataKeys.CHANGE_LEAD_SELECTION.is(dataId)) { return mapToChange(exactlySelected(tree)).toArray(Change.EMPTY_CHANGE_ARRAY); } else if (VcsDataKeys.FILE_PATHS.is(dataId)) { return mapToFilePath(selected(tree)); } return null; }