@Nullable @Override public Object getData(@NonNls String dataId) { if (ExternalSystemDataKeys.RECENT_TASKS_LIST.is(dataId)) { return myRecentTasksList; } else if (ExternalSystemDataKeys.ALL_TASKS_MODEL.is(dataId)) { return myAllTasksModel; } else if (ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID.is(dataId)) { return myExternalSystemId; } else if (ExternalSystemDataKeys.NOTIFICATION_GROUP.is(dataId)) { return myNotificationGroup; } else if (ExternalSystemDataKeys.SELECTED_TASK.is(dataId)) { return mySelectedTaskProvider == null ? null : mySelectedTaskProvider.produce(); } else if (ExternalSystemDataKeys.SELECTED_PROJECT.is(dataId)) { if (mySelectedTaskProvider != myAllTasksTree) { return null; } else { Object component = myAllTasksTree.getLastSelectedPathComponent(); if (component instanceof ExternalSystemNode) { Object element = ((ExternalSystemNode) component).getDescriptor().getElement(); return element instanceof ExternalProjectPojo ? element : null; } } } else if (Location.DATA_KEY.is(dataId)) { Location location = buildLocation(); return location == null ? super.getData(dataId) : location; } return null; }
private static List<ProjectSystemId> getSystemIds(AnActionEvent e) { final List<ProjectSystemId> systemIds = ContainerUtil.newArrayList(); final ProjectSystemId externalSystemId = ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID.getData(e.getDataContext()); if (externalSystemId != null) { systemIds.add(externalSystemId); } else { for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) { systemIds.add(manager.getSystemId()); } } return systemIds; }