本文整理汇总了Java中com.intellij.openapi.vcs.changes.ChangeListManager.getDefaultChangeList方法的典型用法代码示例。如果您正苦于以下问题:Java ChangeListManager.getDefaultChangeList方法的具体用法?Java ChangeListManager.getDefaultChangeList怎么用?Java ChangeListManager.getDefaultChangeList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vcs.changes.ChangeListManager
的用法示例。
在下文中一共展示了ChangeListManager.getDefaultChangeList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInitiallySelectedChangeList
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入方法依赖的package包/类
@Override
protected LocalChangeList getInitiallySelectedChangeList(final VcsContext context, final Project project) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
LocalChangeList defaultChangeList = changeListManager.getDefaultChangeList();
final FilePath[] roots = getRoots(context);
LocalChangeList changeList = null;
for (final FilePath root : roots) {
final VirtualFile file = root.getVirtualFile();
if (file == null) continue;
Collection<LocalChangeList> lists = getChangeListsForRoot(changeListManager, root);
if (lists.contains(defaultChangeList)) {
return defaultChangeList;
}
Iterator<LocalChangeList> it = lists.iterator();
changeList = it.hasNext() ? it.next() : null;
}
return changeList == null ? defaultChangeList : changeList;
}
示例2: testMergeCommitWithSpacesInPath
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入方法依赖的package包/类
/**
* Tests that merge commit after resolving a conflict works fine if there is a file with spaces in its path.
* IDEA-50318
*/
@Test
public void testMergeCommitWithSpacesInPath() throws IOException {
final String PATH = "dir with spaces/file with spaces.txt";
GitTestUtil.createFileStructure(myProjectRoot, PATH);
addCommit("created some file structure");
git("branch feature");
File file = new File(myProjectPath, PATH);
assertTrue("File doesn't exist!", file.exists());
overwrite(file, "my content");
addCommit("modified in master");
checkout("feature");
overwrite(file, "brother content");
addCommit("modified in feature");
checkout("master");
git("merge feature", true); // ignoring non-zero exit-code reporting about conflicts
overwrite(file, "merged content"); // manually resolving conflict
git("add .");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
updateChangeListManager();
final LocalChangeList changeList = changeListManager.getDefaultChangeList();
changeList.setComment("Commit message");
List<Change> changes = ContainerUtil.newArrayList(changeListManager.getChangesIn(myProjectRoot));
assertTrue(!changes.isEmpty());
CheckinEnvironment checkingEnv = ObjectUtils.assertNotNull(myVcs.getCheckinEnvironment());
List<VcsException> exceptions = checkingEnv.commit(changes, "comment");
assertNoExceptions(exceptions);
updateChangeListManager();
assertTrue(changeListManager.getChangesIn(myProjectRoot).isEmpty());
}
示例3: actionPerformed
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) return;
final ShelvedChangeList[] changeLists = e.getData(ShelvedChangesViewManager.SHELVED_CHANGELIST_KEY);
List<ShelvedChange> changes = e.getData(ShelvedChangesViewManager.SHELVED_CHANGE_KEY);
List<ShelvedBinaryFile> binaryFiles = e.getData(ShelvedChangesViewManager.SHELVED_BINARY_FILE_KEY);
if (changes != null && binaryFiles != null && changes.size() == 0 && binaryFiles.size() == 0) {
changes = null;
binaryFiles = null;
}
LOG.assertTrue(changeLists != null);
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
final List<LocalChangeList> allChangeLists = changeListManager.getChangeListsCopy();
String defaultName = changeLists[0].DESCRIPTION;
LocalChangeList list = null;
if (changeLists.length == 1) {
final LocalChangeList sameNamedList = changeListManager.findChangeList(defaultName);
if (sameNamedList != null) {
list = sameNamedList;
}
else {
list = tryToMatchWithExistingChangelist(changeListManager, defaultName);
}
}
if (list == null) {
list = changeListManager.getDefaultChangeList();
}
final ChangeListChooser chooser = new ChangeListChooser(project, allChangeLists, list,
VcsBundle.message("unshelve.changelist.chooser.title"), defaultName);
if (!chooser.showAndGet()) {
return;
}
FileDocumentManager.getInstance().saveAllDocuments();
final List<ShelvedBinaryFile> finalBinaryFiles = binaryFiles;
final List<ShelvedChange> finalChanges = changes;
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Unshelve Changes", true, BackgroundFromStartOption.getInstance()) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
for (ShelvedChangeList changeList : changeLists) {
ShelveChangesManager.getInstance(project)
.unshelveChangeList(changeList, finalChanges, finalBinaryFiles, chooser.getSelectedList(), true);
}
}
});
}