本文整理汇总了Java中com.intellij.openapi.vcs.VcsDataKeys类的典型用法代码示例。如果您正苦于以下问题:Java VcsDataKeys类的具体用法?Java VcsDataKeys怎么用?Java VcsDataKeys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VcsDataKeys类属于com.intellij.openapi.vcs包,在下文中一共展示了VcsDataKeys类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getData
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public Object getData(@NonNls final String dataId) {
if (CommittedChangesBrowserUseCase.DATA_KEY.is(dataId)) {
return myUseCase;
}
else if (VcsDataKeys.SELECTED_CHANGES.is(dataId)) {
final List<Change> list = myViewer.getSelectedChanges();
return list.toArray(new Change [list.size()]);
} else if (VcsDataKeys.CHANGE_LEAD_SELECTION.is(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);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RepositoryChangesBrowser.java
示例2: calcData
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void calcData(final DataKey key, final DataSink sink) {
if (key.equals(PlatformDataKeys.COPY_PROVIDER)) {
sink.put(PlatformDataKeys.COPY_PROVIDER, myCopyProvider);
}
else if (key.equals(PlatformDataKeys.TREE_EXPANDER)) {
sink.put(PlatformDataKeys.TREE_EXPANDER, myTreeExpander);
} else {
final String name = key.getName();
if (VcsDataKeys.SELECTED_CHANGES.is(name) || VcsDataKeys.CHANGE_LEAD_SELECTION.is(name) ||
CommittedChangesBrowserUseCase.DATA_KEY.is(name)) {
final Object data = myDetailsView.getData(name);
if (data != null) {
sink.put(key, data);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CommittedChangesTreeBrowser.java
示例3: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
if (ChangeListManager.getInstance(project).isFreezedWithNotification(null)) return;
ChangesSelection selection = e.getRequiredData(VcsDataKeys.CHANGES_SELECTION);
int index = 0;
List<Change> changesToLocal = new ArrayList<Change>();
for (int i = 0; i < selection.getChanges().size(); i++) {
if (i == selection.getIndex()) index = changesToLocal.size();
ContentRevision afterRevision = selection.getChanges().get(i).getAfterRevision();
if (afterRevision != null && isValidAfterRevision(afterRevision)) {
changesToLocal.add(new Change(afterRevision, CurrentContentRevision.create(afterRevision.getFile())));
}
}
if (!changesToLocal.isEmpty()) {
showDiffForChange(project, changesToLocal, index);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ShowDiffWithLocalAction.java
示例4: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
final Change[] changes = e.getData(VcsDataKeys.CHANGES);
if ((changes == null) || (changes.length == 0)) return;
String commitMessage = null;
ShelvedChangeList[] shelvedChangeLists = e.getData(ShelvedChangesViewManager.SHELVED_CHANGELIST_KEY);
if (shelvedChangeLists != null && shelvedChangeLists.length > 0) {
commitMessage = shelvedChangeLists [0].DESCRIPTION;
}
else {
ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS);
if (changeLists != null && changeLists.length > 0) {
commitMessage = changeLists [0].getComment();
}
}
if (commitMessage == null) {
commitMessage = e.getData(VcsDataKeys.PRESET_COMMIT_MESSAGE);
}
if (commitMessage == null) {
commitMessage = "";
}
List<Change> changeCollection = new ArrayList<Change>();
Collections.addAll(changeCollection, changes);
createPatch(project, commitMessage, changeCollection);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CreatePatchFromChangesAction.java
示例5: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
FileDocumentManager.getInstance().saveAllDocuments();
Change[] changes = e.getData(VcsDataKeys.CHANGES);
Project project = e.getData(CommonDataKeys.PROJECT);
final ChangesBrowser browser = e.getData(ChangesBrowser.DATA_KEY);
if (browser != null) {
browser.setDataIsDirty(true);
}
RollbackChangesDialog.rollbackChanges(project, Arrays.asList(changes), true, new Runnable() {
public void run() {
if (browser != null) {
browser.rebuildList();
browser.setDataIsDirty(false);
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RollbackDialogAction.java
示例6: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final ChangeRequestChain chain = e.getData(VcsDataKeys.DIFF_REQUEST_CHAIN);
if (project == null || chain == null || !isEnabled(chain)) {
return;
}
DiffViewer diffViewer = e.getData(PlatformDataKeys.COMPOSITE_DIFF_VIEWER);
if (diffViewer == null) {
diffViewer = e.getData(PlatformDataKeys.DIFF_VIEWER);
}
if (diffViewer == null) {
return;
}
actionPerformed(e, project, chain, diffViewer);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ShowChangeAbstractAction.java
示例7: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
if (ChangeListManager.getInstance(project).isFreezedWithNotification(null)) return;
VcsRevisionNumber currentRevisionNumber = e.getRequiredData(VcsDataKeys.HISTORY_SESSION).getCurrentRevisionNumber();
VcsFileRevision selectedRevision = e.getRequiredData(VcsDataKeys.VCS_FILE_REVISIONS)[0];
FilePath filePath = e.getRequiredData(VcsDataKeys.FILE_PATH);
if (currentRevisionNumber != null && selectedRevision != null) {
DiffFromHistoryHandler diffHandler = ObjectUtils.notNull(e.getRequiredData(VcsDataKeys.HISTORY_PROVIDER).getHistoryDiffHandler(),
new StandardDiffFromHistoryHandler());
diffHandler.showDiffForTwo(project, filePath,
selectedRevision, new CurrentRevision(filePath.getVirtualFile(), currentRevisionNumber));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ShowDiffWithLocalAction.java
示例8: getRevisionNumbers
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
@Nullable
public List<VcsRevisionNumber> getRevisionNumbers(@NotNull DataProvider dataProvider) {
VcsRevisionNumber revisionNumber = VcsDataKeys.VCS_REVISION_NUMBER.getData(dataProvider);
if (revisionNumber != null) {
return Collections.singletonList(revisionNumber);
}
ChangeList[] changeLists = VcsDataKeys.CHANGE_LISTS.getData(dataProvider);
if (changeLists != null && changeLists.length > 0) {
List<CommittedChangeList> committedChangeLists = ContainerUtil.findAll(changeLists, CommittedChangeList.class);
if (!committedChangeLists.isEmpty()) {
ContainerUtil.sort(committedChangeLists, CommittedChangeListByDateComparator.DESCENDING);
return ContainerUtil.mapNotNull(committedChangeLists, CommittedChangeListToRevisionNumberFunction.INSTANCE);
}
}
VcsFileRevision[] fileRevisions = VcsDataKeys.VCS_FILE_REVISIONS.getData(dataProvider);
if (fileRevisions != null && fileRevisions.length > 0) {
return ContainerUtil.mapNotNull(fileRevisions, FileRevisionToRevisionNumberFunction.INSTANCE);
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:VcsRevisionNumberArrayRule.java
示例9: getData
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
@Override
public Object getData(String dataId) {
if (CommonDataKeys.PROJECT.is(dataId)) {
return myProject;
}
TreePath selectionPath = myTree.getSelectionPath();
DefaultMutableTreeNode node = selectionPath == null ? null : (DefaultMutableTreeNode)selectionPath.getLastPathComponent();
Object o = node == null ? null : node.getUserObject();
if (o instanceof Commit) {
Commit c = (Commit)o;
if (VcsDataKeys.VCS_VIRTUAL_FILE.is(dataId)) {
return c.root;
}
if (VcsDataKeys.VCS_FILE_REVISION.is(dataId)) {
return new GitFileRevision(myProject, VcsUtil.getFilePath(c.root.getPath()), c.commitInfo.revision);
}
}
return super.getData(dataId);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GitSkippedCommits.java
示例10: MyChecker
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public MyChecker(final AnActionEvent e) {
final DataContext dc = e.getDataContext();
myProject = CommonDataKeys.PROJECT.getData(dc);
final Change[] changes = VcsDataKeys.CHANGE_LEAD_SELECTION.getData(dc);
if (myProject == null || changes == null || changes.length != 1) {
myEnabled = false;
myChange = null;
return;
}
final Change change = changes[0];
myEnabled = change instanceof ConflictedSvnChange && ((ConflictedSvnChange) change).getConflictState().isTree();
if (myEnabled) {
myChange = (ConflictedSvnChange) change;
}
else {
myChange = null;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MarkTreeConflictResolvedAction.java
示例11: update
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void update(final AnActionEvent e) {
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
final Presentation presentation = e.getPresentation();
if (project == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
presentation.setText(SvnBundle.message("configure.branches.item"));
presentation.setDescription(SvnBundle.message("configure.branches.item"));
presentation.setIcon(SvnIcons.ConfigureBranches);
presentation.setVisible(true);
final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
presentation.setEnabled((cls != null) && (cls.length > 0) &&
(SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) &&
(((SvnChangeList) cls[0]).getRoot() != null));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ConfigureBranchesAction.java
示例12: doActionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
@Override
public void doActionPerformed(AnActionEvent anActionEvent) {
final DataContext dc = anActionEvent.getDataContext();
final Project project = CommonDataKeys.PROJECT.getData(dc);
final Refreshable panel = CheckinProjectPanel.PANEL_KEY.getData(dc);
final CommitMessageI commitMessageI = (panel instanceof CommitMessageI) ? (CommitMessageI) panel : VcsDataKeys.COMMIT_MESSAGE_CONTROL.getData(dc);
if (commitMessageI != null && project != null) {
String commitMessage = "";
// Attempt to append the message instead of overwriting it
if (commitMessageI instanceof CommitChangeListDialog) {
commitMessage = ((CommitChangeListDialog) commitMessageI).getCommitMessage();
}
SelectWorkItemsDialog dialog = new SelectWorkItemsDialog(project);
if (dialog.showAndGet()) {
if (StringUtils.isNotEmpty(commitMessage)) {
commitMessage += "\n" + dialog.getComment();
} else {
commitMessage = dialog.getComment();
}
commitMessageI.setCommitMessage(commitMessage);
}
}
}
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:27,代码来源:SelectWorkItemsAction.java
示例13: generateDiff
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
@Override
public String generateDiff(Project project, AnActionEvent action) throws VcsException {
String diffContent;
VcsRevisionNumber[] data = action.getData(VcsDataKeys.VCS_REVISION_NUMBERS);
if (data != null) {
diffContent = fromRevisions(project, project.getBaseDir(), data[data.length - 1], data[0]);
} else {
final Change[] changes = action.getData(VcsDataKeys.CHANGES);
// if (changes == null) {
// return null;
// }
List<VirtualFile> virtualFiles = new ArrayList<>();
// for (Change change : changes) {
// if (change.getVirtualFile() != null) {
// virtualFiles.add(change.getVirtualFile());
// }
// }
diffContent = fromHead(project, project.getBaseDir(), virtualFiles);
}
return diffContent;
}
开发者ID:ritesh-kapoor,项目名称:review-board-idea-plugin,代码行数:22,代码来源:GitDiffProvider.java
示例14: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(PlatformDataKeys.PROJECT);
final Change[] changes = e.getData(VcsDataKeys.CHANGES);
if ((changes == null) || (changes.length == 0)) return;
String commitMessage = null;
ShelvedChangeList[] shelvedChangeLists = e.getData(ShelvedChangesViewManager.SHELVED_CHANGELIST_KEY);
if (shelvedChangeLists != null && shelvedChangeLists.length > 0) {
commitMessage = shelvedChangeLists [0].DESCRIPTION;
}
else {
ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS);
if (changeLists != null && changeLists.length > 0) {
commitMessage = changeLists [0].getComment();
}
}
if (commitMessage == null) {
commitMessage = e.getData(VcsDataKeys.PRESET_COMMIT_MESSAGE);
}
if (commitMessage == null) {
commitMessage = "";
}
List<Change> changeCollection = new ArrayList<Change>();
Collections.addAll(changeCollection, changes);
createPatch(project, commitMessage, changeCollection);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:CreatePatchFromChangesAction.java
示例15: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
FileDocumentManager.getInstance().saveAllDocuments();
Change[] changes = e.getData(VcsDataKeys.CHANGES);
Project project = e.getData(PlatformDataKeys.PROJECT);
final ChangesBrowser browser = e.getData(ChangesBrowser.DATA_KEY);
if (browser != null) {
browser.setDataIsDirty(true);
}
RollbackChangesDialog.rollbackChanges(project, Arrays.asList(changes), true, new Runnable() {
public void run() {
if (browser != null) {
browser.rebuildList();
browser.setDataIsDirty(false);
}
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:RollbackDialogAction.java
示例16: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(PlatformDataKeys.PROJECT);
final ChangeRequestChain chain = e.getData(VcsDataKeys.DIFF_REQUEST_CHAIN);
if (project == null || chain == null || !isEnabled(chain)) {
return;
}
DiffViewer diffViewer = e.getData(PlatformDataKeys.COMPOSITE_DIFF_VIEWER);
if (diffViewer == null) {
diffViewer = e.getData(PlatformDataKeys.DIFF_VIEWER);
}
if (diffViewer == null) {
return;
}
actionPerformed(e, project, chain, diffViewer);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ShowChangeAbstractAction.java
示例17: calcData
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
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()]));
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:ChangesBrowser.java
示例18: actionPerformed
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
VcsRevisionNumber revision = e.getData(VcsDataKeys.VCS_REVISION_NUMBER);
if (revision == null) {
VcsFileRevision fileRevision = e.getData(VcsDataKeys.VCS_FILE_REVISION);
if (fileRevision != null) {
revision = fileRevision.getRevisionNumber();
}
}
if (revision == null) {
return;
}
String rev = revision instanceof ShortVcsRevisionNumber ? ((ShortVcsRevisionNumber)revision).toShortString() : revision.asString();
CopyPasteManager.getInstance().setContents(new StringSelection(rev));
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:CopyRevisionNumberAction.java
示例19: getData
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
@Override
public Object getData(String dataId) {
if (PlatformDataKeys.PROJECT.is(dataId)) {
return myProject;
}
TreePath selectionPath = myTree.getSelectionPath();
DefaultMutableTreeNode node = selectionPath == null ? null : (DefaultMutableTreeNode)selectionPath.getLastPathComponent();
Object o = node == null ? null : node.getUserObject();
if (o instanceof Commit) {
Commit c = (Commit)o;
if (VcsDataKeys.VCS_VIRTUAL_FILE.is(dataId)) {
return c.root;
}
if (VcsDataKeys.VCS_FILE_REVISION.is(dataId)) {
return new GitFileRevision(myProject, VcsUtil.getFilePath(c.root.getPath()), c.commitInfo.revision);
}
}
return super.getData(dataId);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:GitSkippedCommits.java
示例20: MyChecker
import com.intellij.openapi.vcs.VcsDataKeys; //导入依赖的package包/类
public MyChecker(final AnActionEvent e) {
final DataContext dc = e.getDataContext();
myProject = PlatformDataKeys.PROJECT.getData(dc);
final Change[] changes = VcsDataKeys.CHANGE_LEAD_SELECTION.getData(dc);
if (myProject == null || changes == null || changes.length != 1) {
myEnabled = false;
myChange = null;
return;
}
final Change change = changes[0];
myEnabled = change instanceof ConflictedSvnChange && ((ConflictedSvnChange) change).getConflictState().isTree();
if (myEnabled) {
myChange = (ConflictedSvnChange) change;
}
else {
myChange = null;
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:MarkTreeConflictResolvedAction.java
注:本文中的com.intellij.openapi.vcs.VcsDataKeys类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论