本文整理汇总了Java中com.intellij.openapi.vcs.VcsDataKeys.SELECTED_CHANGES属性的典型用法代码示例。如果您正苦于以下问题:Java VcsDataKeys.SELECTED_CHANGES属性的具体用法?Java VcsDataKeys.SELECTED_CHANGES怎么用?Java VcsDataKeys.SELECTED_CHANGES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.vcs.VcsDataKeys
的用法示例。
在下文中一共展示了VcsDataKeys.SELECTED_CHANGES属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
}
}
示例3: calcData
@Override
public void calcData(DataKey key, DataSink sink) {
if (VcsLogDataKeys.VCS_LOG == key) {
sink.put(key, myLog);
}
else if (VcsLogDataKeys.VCS_LOG_UI == key) {
sink.put(key, myUI);
}
else if (VcsLogDataKeys.VCS_LOG_DATA_PROVIDER == key) {
sink.put(key, myLogDataHolder);
}
else if (VcsDataKeys.CHANGES == key || VcsDataKeys.SELECTED_CHANGES == key) {
List<Change> selectedChanges = getSelectedChanges();
if (selectedChanges != null) {
sink.put(key, ArrayUtil.toObjectArray(selectedChanges, Change.class));
}
}
else if (VcsDataKeys.VCS_REVISION_NUMBERS == key) {
List<Hash> hashes = myUI.getVcsLog().getSelectedCommits();
sink.put(key, ArrayUtil.toObjectArray(ContainerUtil.map(hashes, new Function<Hash, VcsRevisionNumber>() {
@Override
public VcsRevisionNumber fun(Hash hash) {
return new TextRevisionNumber(hash.asString(), hash.toShortString());
}
}), VcsRevisionNumber.class));
}
}
示例4: calcData
@Override
public void calcData(DataKey key, DataSink sink) {
if (key == VcsDataKeys.SELECTED_CHANGES) {
final List<Change> list = myViewer.getSelectedChanges();
sink.put(VcsDataKeys.SELECTED_CHANGES, list.toArray(new Change[list.size()]));
}
super.calcData(key, sink);
}