本文整理汇总了Java中com.intellij.openapi.vcs.VcsDataKeys.CHANGE_LEAD_SELECTION属性的典型用法代码示例。如果您正苦于以下问题:Java VcsDataKeys.CHANGE_LEAD_SELECTION属性的具体用法?Java VcsDataKeys.CHANGE_LEAD_SELECTION怎么用?Java VcsDataKeys.CHANGE_LEAD_SELECTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.vcs.VcsDataKeys
的用法示例。
在下文中一共展示了VcsDataKeys.CHANGE_LEAD_SELECTION属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calcData
public void calcData(DataKey key, DataSink sink) {
if (key == VcsDataKeys.CHANGES) {
final List<Change> list = myViewer.getSelectedChanges();
sink.put(VcsDataKeys.CHANGES, list.toArray(new Change [list.size()]));
}
else if (key == VcsDataKeys.CHANGE_LISTS) {
sink.put(VcsDataKeys.CHANGE_LISTS, getSelectedChangeLists());
}
else if (key == VcsDataKeys.CHANGE_LEAD_SELECTION) {
final Change highestSelection = myViewer.getHighestLeadSelection();
sink.put(VcsDataKeys.CHANGE_LEAD_SELECTION, (highestSelection == null) ? new Change[]{} : new Change[] {highestSelection});
} else if (key == PlatformDataKeys.VIRTUAL_FILE_ARRAY) {
sink.put(PlatformDataKeys.VIRTUAL_FILE_ARRAY, getSelectedFiles());
}
else if (key == PlatformDataKeys.NAVIGATABLE_ARRAY) {
sink.put(PlatformDataKeys.NAVIGATABLE_ARRAY, ChangesUtil.getNavigatableArray(myProject, getSelectedFiles()));
} else if (VcsDataKeys.IO_FILE_ARRAY.equals(key)) {
sink.put(VcsDataKeys.IO_FILE_ARRAY, getSelectedIoFiles());
}
else if (key == DATA_KEY) {
sink.put(DATA_KEY, this);
} else if (VcsDataKeys.SELECTED_CHANGES_IN_DETAILS.equals(key)) {
final List<Change> selectedChanges = getSelectedChanges();
sink.put(VcsDataKeys.SELECTED_CHANGES_IN_DETAILS, selectedChanges.toArray(new Change[selectedChanges.size()]));
}
}
示例2: getData
public Object getData(@Nonnull Key<?> dataId) {
if (CommittedChangesBrowserUseCase.DATA_KEY == dataId) {
return myUseCase;
}
else if (VcsDataKeys.SELECTED_CHANGES == dataId) {
final List<Change> list = myViewer.getSelectedChanges();
return list.toArray(new Change[list.size()]);
}
else if (VcsDataKeys.CHANGE_LEAD_SELECTION == dataId) {
final Change highestSelection = myViewer.getHighestLeadSelection();
return (highestSelection == null) ? new Change[]{} : new Change[]{highestSelection};
}
else {
final TypeSafeDataProviderAdapter adapter = new TypeSafeDataProviderAdapter(this);
return adapter.getData(dataId);
}
}
示例3: calcData
public void calcData(final Key key, final DataSink sink) {
if (PlatformDataKeys.COPY_PROVIDER == key) {
sink.put(PlatformDataKeys.COPY_PROVIDER, myCopyProvider);
}
else if (PlatformDataKeys.TREE_EXPANDER == key) {
sink.put(PlatformDataKeys.TREE_EXPANDER, myTreeExpander);
}
else {
if (VcsDataKeys.SELECTED_CHANGES == key || VcsDataKeys.CHANGE_LEAD_SELECTION == key || CommittedChangesBrowserUseCase.DATA_KEY == key) {
final Object data = myDetailsView.getData(key);
if (data != null) {
sink.put(key, data);
}
}
}
}
示例4: calcData
public void calcData(DataKey key, DataSink sink) {
if (key == VcsDataKeys.CHANGES) {
List<Change> list = myViewer.getSelectedChanges();
if (list.isEmpty()) list = myViewer.getChanges();
sink.put(VcsDataKeys.CHANGES, list.toArray(new Change[list.size()]));
}
else if (key == VcsDataKeys.CHANGES_SELECTION) {
sink.put(VcsDataKeys.CHANGES_SELECTION, getChangesSelection());
}
else if (key == VcsDataKeys.CHANGE_LISTS) {
sink.put(VcsDataKeys.CHANGE_LISTS, getSelectedChangeLists());
}
else if (key == VcsDataKeys.CHANGE_LEAD_SELECTION) {
final Change highestSelection = myViewer.getHighestLeadSelection();
sink.put(VcsDataKeys.CHANGE_LEAD_SELECTION, (highestSelection == null) ? new Change[]{} : new Change[] {highestSelection});
} else if (key == CommonDataKeys.VIRTUAL_FILE_ARRAY) {
sink.put(CommonDataKeys.VIRTUAL_FILE_ARRAY, getSelectedFiles());
}
else if (key == CommonDataKeys.NAVIGATABLE_ARRAY) {
sink.put(CommonDataKeys.NAVIGATABLE_ARRAY, ChangesUtil.getNavigatableArray(myProject, getSelectedFiles()));
} else if (VcsDataKeys.IO_FILE_ARRAY.equals(key)) {
sink.put(VcsDataKeys.IO_FILE_ARRAY, getSelectedIoFiles());
}
else if (key == DATA_KEY) {
sink.put(DATA_KEY, this);
} else if (VcsDataKeys.SELECTED_CHANGES_IN_DETAILS.equals(key)) {
final List<Change> selectedChanges = getSelectedChanges();
sink.put(VcsDataKeys.SELECTED_CHANGES_IN_DETAILS, selectedChanges.toArray(new Change[selectedChanges.size()]));
}
}
示例5: calcData
public void calcData(Key<?> key, DataSink sink) {
if (key == VcsDataKeys.CHANGES) {
List<Change> list = getSelectedChanges();
if (list.isEmpty()) list = getAllChanges();
sink.put(VcsDataKeys.CHANGES, list.toArray(new Change[list.size()]));
}
else if (key == VcsDataKeys.CHANGES_SELECTION) {
sink.put(VcsDataKeys.CHANGES_SELECTION, getChangesSelection());
}
else if (key == VcsDataKeys.CHANGE_LISTS) {
sink.put(VcsDataKeys.CHANGE_LISTS, getSelectedChangeLists());
}
else if (key == VcsDataKeys.CHANGE_LEAD_SELECTION) {
final Change highestSelection = ObjectUtils.tryCast(myViewer.getHighestLeadSelection(), Change.class);
sink.put(VcsDataKeys.CHANGE_LEAD_SELECTION, (highestSelection == null) ? new Change[]{} : new Change[]{highestSelection});
}
else if (key == CommonDataKeys.VIRTUAL_FILE_ARRAY) {
sink.put(CommonDataKeys.VIRTUAL_FILE_ARRAY, getSelectedFiles().toArray(VirtualFile[]::new));
}
else if (key == CommonDataKeys.NAVIGATABLE_ARRAY) {
sink.put(CommonDataKeys.NAVIGATABLE_ARRAY, getNavigatableArray(myProject, getSelectedFiles()));
}
else if (VcsDataKeys.IO_FILE_ARRAY.equals(key)) {
sink.put(VcsDataKeys.IO_FILE_ARRAY, getSelectedIoFiles());
}
else if (key == DATA_KEY) {
sink.put(DATA_KEY, this);
}
else if (VcsDataKeys.SELECTED_CHANGES_IN_DETAILS.equals(key)) {
final List<Change> selectedChanges = getSelectedChanges();
sink.put(VcsDataKeys.SELECTED_CHANGES_IN_DETAILS, selectedChanges.toArray(new Change[selectedChanges.size()]));
}
else if (UNVERSIONED_FILES_DATA_KEY.equals(key)) {
sink.put(UNVERSIONED_FILES_DATA_KEY, getVirtualFiles(myViewer.getSelectionPaths(), UNVERSIONED_FILES_TAG));
}
else if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.equals(key)) {
sink.put(PlatformDataKeys.DELETE_ELEMENT_PROVIDER, myDeleteProvider);
}
}
示例6: getChangesKey
protected DataKey<Change[]> getChangesKey() {
return VcsDataKeys.CHANGE_LEAD_SELECTION;
}
示例7: calcData
@Override
public void calcData(Key<?> key, DataSink sink) {
if (key == VcsDataKeys.CHANGES) {
sink.put(VcsDataKeys.CHANGES, getSelectedChanges().toArray(Change[]::new));
}
else if (key == VcsDataKeys.CHANGE_LEAD_SELECTION) {
sink.put(VcsDataKeys.CHANGE_LEAD_SELECTION, getLeadSelection().toArray(Change[]::new));
}
else if (key == VcsDataKeys.CHANGE_LISTS) {
sink.put(VcsDataKeys.CHANGE_LISTS, getSelectedChangeLists().toArray(ChangeList[]::new));
}
else if (key == CommonDataKeys.VIRTUAL_FILE_ARRAY) {
sink.put(CommonDataKeys.VIRTUAL_FILE_ARRAY, getSelectedFiles().toArray(VirtualFile[]::new));
}
else if (key == VcsDataKeys.VIRTUAL_FILE_STREAM) {
sink.put(VcsDataKeys.VIRTUAL_FILE_STREAM, getSelectedFiles());
}
else if (key == CommonDataKeys.NAVIGATABLE) {
VirtualFile file = getIfSingle(getSelectedFiles());
if (file != null && !file.isDirectory()) {
sink.put(CommonDataKeys.NAVIGATABLE, new OpenFileDescriptor(myProject, file, 0));
}
}
else if (key == CommonDataKeys.NAVIGATABLE_ARRAY) {
sink.put(CommonDataKeys.NAVIGATABLE_ARRAY, ChangesUtil.getNavigatableArray(myProject, getSelectedFiles()));
}
else if (key == PlatformDataKeys.DELETE_ELEMENT_PROVIDER) {
if (getSelectionObjectsStream().anyMatch(userObject -> !(userObject instanceof ChangeList))) {
sink.put(PlatformDataKeys.DELETE_ELEMENT_PROVIDER, new VirtualFileDeleteProvider());
}
}
else if (key == PlatformDataKeys.COPY_PROVIDER) {
sink.put(PlatformDataKeys.COPY_PROVIDER, myCopyProvider);
}
else if (key == UNVERSIONED_FILES_DATA_KEY) {
sink.put(UNVERSIONED_FILES_DATA_KEY, getSelectedUnversionedFiles());
}
else if (key == IGNORED_FILES_DATA_KEY) {
sink.put(IGNORED_FILES_DATA_KEY, getSelectedIgnoredFiles());
}
else if (key == VcsDataKeys.MODIFIED_WITHOUT_EDITING_DATA_KEY) {
sink.put(VcsDataKeys.MODIFIED_WITHOUT_EDITING_DATA_KEY, getSelectedModifiedWithoutEditing().collect(toList()));
}
else if (key == LOCALLY_DELETED_CHANGES) {
sink.put(LOCALLY_DELETED_CHANGES, getSelectedLocallyDeletedChanges().collect(toList()));
}
else if (key == MISSING_FILES_DATA_KEY) {
sink.put(MISSING_FILES_DATA_KEY, getSelectedMissingFiles().collect(toList()));
}
else if (VcsDataKeys.HAVE_LOCALLY_DELETED == key) {
sink.put(VcsDataKeys.HAVE_LOCALLY_DELETED, getSelectedMissingFiles().findAny().isPresent());
}
else if (VcsDataKeys.HAVE_MODIFIED_WITHOUT_EDITING == key) {
sink.put(VcsDataKeys.HAVE_MODIFIED_WITHOUT_EDITING, getSelectedModifiedWithoutEditing().findAny().isPresent());
}
else if (VcsDataKeys.HAVE_SELECTED_CHANGES == key) {
sink.put(VcsDataKeys.HAVE_SELECTED_CHANGES, haveSelectedChanges());
}
else if (key == PlatformDataKeys.HELP_ID) {
sink.put(PlatformDataKeys.HELP_ID, HELP_ID);
}
else if (key == VcsDataKeys.CHANGES_IN_LIST_KEY) {
final TreePath selectionPath = getSelectionPath();
if (selectionPath != null && selectionPath.getPathCount() > 1) {
ChangesBrowserNode<?> firstNode = (ChangesBrowserNode)selectionPath.getPathComponent(1);
if (firstNode instanceof ChangesBrowserChangeListNode) {
sink.put(VcsDataKeys.CHANGES_IN_LIST_KEY, firstNode.getAllChangesUnder());
}
}
}
}