本文整理汇总了Java中com.intellij.openapi.vcs.changes.ChangeListManager类的典型用法代码示例。如果您正苦于以下问题:Java ChangeListManager类的具体用法?Java ChangeListManager怎么用?Java ChangeListManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChangeListManager类属于com.intellij.openapi.vcs.changes包,在下文中一共展示了ChangeListManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAffectedFiles
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@NotNull
private static List<VirtualFile> getAffectedFiles(String changeListName, Project project) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListName == null) {
return changeListManager.getAffectedFiles();
}
final LocalChangeList changeList = changeListManager.findChangeList(changeListName);
if (changeList != null) {
List<VirtualFile> files = new ArrayList<VirtualFile>();
for (Change change : changeList.getChanges()) {
final ContentRevision afterRevision = change.getAfterRevision();
if (afterRevision != null) {
final VirtualFile file = afterRevision.getFile().getVirtualFile();
if (file != null) {
files.add(file);
}
}
}
return files;
}
return Collections.emptyList();
}
示例2: testMovePackageToParent
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@Test
public void testMovePackageToParent() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile child = createDirInCommand(myWorkingCopyDir, "child");
final VirtualFile grandChild = createDirInCommand(child, "grandChild");
createFileInCommand(grandChild, "a.txt", "a");
checkin();
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
insideInitializedChangeListManager(changeListManager, new Runnable() {
@Override
public void run() {
moveFileInCommand(grandChild, myWorkingCopyDir);
refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener
changeListManager.ensureUpToDate(false);
final List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
Assert.assertEquals(listToString(changes), 2, changes.size());
sortChanges(changes);
verifyChange(changes.get(0), "child" + File.separatorChar + "grandChild", "grandChild");
verifyChange(changes.get(1), "child" + File.separatorChar + "grandChild" + File.separatorChar + "a.txt",
"grandChild" + File.separatorChar + "a.txt");
}
});
}
示例3: VcsVFSListener
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
protected VcsVFSListener(@NotNull Project project, @NotNull AbstractVcs vcs) {
myProject = project;
myVcs = vcs;
myChangeListManager = ChangeListManager.getInstance(project);
myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject);
final MyVirtualFileAdapter myVFSListener = new MyVirtualFileAdapter();
final MyCommandAdapter myCommandListener = new MyCommandAdapter();
myVcsManager = ProjectLevelVcsManager.getInstance(project);
myAddOption = myVcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, vcs);
myRemoveOption = myVcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, vcs);
VirtualFileManager.getInstance().addVirtualFileListener(myVFSListener, this);
CommandProcessor.getInstance().addCommandListener(myCommandListener, this);
myVcsFileListenerContextHelper = VcsFileListenerContextHelper.getInstance(myProject);
}
示例4: 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;
}
示例5: tryToMatchWithExistingChangelist
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@Nullable
private static LocalChangeList tryToMatchWithExistingChangelist(@NotNull ChangeListManager changeListManager,
@NotNull final String defaultName) {
List<LocalChangeList> matched = ContainerUtil.findAll(changeListManager.getChangeListsCopy(), new Condition<LocalChangeList>() {
@Override
public boolean value(LocalChangeList list) {
return defaultName.contains(list.getName().trim());
}
});
return matched.isEmpty() ? null : Collections.max(matched, new Comparator<LocalChangeList>() {
@Override
public int compare(LocalChangeList o1, LocalChangeList o2) {
return Ints.compare(o1.getName().trim().length(), o2.getName().trim().length());
}
});
}
示例6: actionPerformed
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
NewChangelistDialog dlg = new NewChangelistDialog(project);
dlg.show();
if (dlg.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
String name = dlg.getName();
if (name.length() == 0) {
name = getUniqueName(project);
}
final LocalChangeList list = ChangeListManager.getInstance(project).addChangeList(name, dlg.getDescription());
if (dlg.isNewChangelistActive()) {
ChangeListManager.getInstance(project).setDefaultChangeList(list);
}
dlg.getPanel().changelistCreatedOrChanged(list);
}
}
示例7: update
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
super.update(vcsContext, presentation);
if (presentation.isVisible() && presentation.isEnabled()) {
final ChangeList[] selectedChangeLists = vcsContext.getSelectedChangeLists();
final Change[] selectedChanges = vcsContext.getSelectedChanges();
if (vcsContext.getPlace().equals(ActionPlaces.CHANGES_VIEW_POPUP)) {
if (selectedChangeLists != null && selectedChangeLists.length > 0) {
presentation.setEnabled(selectedChangeLists.length == 1 && !ContainerUtil.isEmpty(selectedChangeLists[0].getChanges()));
}
else {
presentation.setEnabled (selectedChanges != null && selectedChanges.length > 0);
}
}
if (presentation.isEnabled() && selectedChanges != null) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(vcsContext.getProject());
for(Change c: selectedChanges) {
if (c.getFileStatus() == FileStatus.HIJACKED && changeListManager.getChangeList(c) == null) {
presentation.setEnabled(false);
break;
}
}
}
}
}
示例8: testRollbackRenameDir
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@Test
public void testRollbackRenameDir() throws Exception {
final VirtualFile child = prepareDirectoriesForRename();
renameFileInCommand(child, "newchild");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
insideInitializedChangeListManager(changeListManager, new Runnable() {
@Override
public void run() {
changeListManager.ensureUpToDate(false);
final Change change = changeListManager.getChange(myWorkingCopyDir.findChild("newchild"));
Assert.assertNotNull(change);
final List<VcsException> exceptions = new ArrayList<VcsException>();
SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(Collections.singletonList(change), exceptions,
RollbackProgressListener.EMPTY);
Assert.assertTrue(exceptions.isEmpty());
Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "newchild").exists());
Assert.assertTrue(new File(myWorkingCopyDir.getPath(), "child").exists());
}
});
}
示例9: actionPerformed
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的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));
}
}
示例10: testIgnoreTargetFolder
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
public void testIgnoreTargetFolder() throws Exception {
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
new File(myProjectRoot.getPath(), "target/classes").mkdirs();
updateProjectFolders();
assertExcludes("project", "target");
myProjectRoot.refresh(false, true);
VirtualFile target = myProjectRoot.findChild("target");
assertNotNull(target);
if (!Registry.is("ide.hide.excluded.files")) {
assertTrue(ChangeListManager.getInstance(myProject).isIgnoredFile(target));
}
}
示例11: tryFastForwardMergeForRebaseUpdaters
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@NotNull
private Map<VirtualFile, GitUpdater> tryFastForwardMergeForRebaseUpdaters(@NotNull Map<VirtualFile, GitUpdater> updaters) {
Map<VirtualFile, GitUpdater> modifiedUpdaters = new HashMap<VirtualFile, GitUpdater>();
Map<VirtualFile, Collection<Change>> changesUnderRoots =
new LocalChangesUnderRoots(ChangeListManager.getInstance(myProject), ProjectLevelVcsManager.getInstance(myProject)).
getChangesUnderRoots(updaters.keySet());
for (Map.Entry<VirtualFile, GitUpdater> updaterEntry : updaters.entrySet()) {
VirtualFile root = updaterEntry.getKey();
GitUpdater updater = updaterEntry.getValue();
Collection<Change> changes = changesUnderRoots.get(root);
if (updater instanceof GitRebaseUpdater && changes != null && !changes.isEmpty()) {
// check only if there are local changes, otherwise stash won't happen anyway and there would be no optimization
GitRebaseUpdater rebaseUpdater = (GitRebaseUpdater) updater;
if (rebaseUpdater.fastForwardMerge()) {
continue;
}
}
modifiedUpdaters.put(root, updater);
}
return modifiedUpdaters;
}
示例12: testAddPlusMove
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@Test
public void testAddPlusMove() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
changeListManager.ensureUpToDate(false);
final LocalChangeList list = changeListManager.addChangeList("test", null);
changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
final String targetName = "target";
myScheme.doTest(new Runnable() {
@Override
public void run() {
final LocalChangeList target = changeListManager.addChangeList(targetName, null);
changeListManager.moveChangesTo(target, new Change[] {changeListManager.getChange(file)});
checkFilesAreInList(new VirtualFile[] {file}, targetName, changeListManager);
}
});
checkFilesAreInList(new VirtualFile[] {file}, targetName, changeListManager);
changeListManager.ensureUpToDate(false);
checkFilesAreInList(new VirtualFile[] {file}, targetName, changeListManager);
}
示例13: perform
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected void perform(@NotNull final Project project,
@NotNull final List<VirtualFile> gitRoots,
@NotNull final VirtualFile defaultRoot,
final Set<VirtualFile> affectedRoots,
final List<VcsException> exceptions) throws VcsException {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.isFreezedWithNotification("Can not stash changes now")) return;
GitStashDialog d = new GitStashDialog(project, gitRoots, defaultRoot);
if (!d.showAndGet()) {
return;
}
VirtualFile root = d.getGitRoot();
affectedRoots.add(root);
final GitLineHandler h = d.handler();
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitHandlerUtil.doSynchronously(h, GitBundle.getString("stashing.title"), h.printableCommandLine());
}
finally {
DvcsUtil.workingTreeChangeFinished(project, token);
}
ServiceManager.getService(project, GitPlatformFacade.class).hardRefresh(root);
}
示例14: perform
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@Override
public boolean perform(@NotNull final Project project, GitVcs vcs, @NotNull final List<VcsException> exceptions, @NotNull VirtualFile[] affectedFiles) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.isFreezedWithNotification("Can not revert now")) return true;
final List<Change> changes = new ArrayList<Change>(affectedFiles.length);
for (VirtualFile f : affectedFiles) {
Change ch = changeListManager.getChange(f);
if (ch != null) {
changes.add(ch);
}
}
RollbackChangesDialog.rollbackChanges(project, changes);
for (GitRepository repository : GitUtil.getRepositoriesForFiles(project, Arrays.asList(affectedFiles))) {
repository.update();
}
return false;
}
示例15: testMovePackageToParent
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入依赖的package包/类
@Test
public void testMovePackageToParent() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile child = createDirInCommand(myWorkingCopyDir, "child");
final VirtualFile grandChild = createDirInCommand(child, "grandChild");
createFileInCommand(grandChild, "a.txt", "a");
checkin();
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
moveFileInCommand(grandChild, myWorkingCopyDir);
refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener
changeListManager.ensureUpToDate(false);
final List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
Assert.assertEquals(listToString(changes), 2, changes.size());
sortChanges(changes);
verifyChange(changes.get(0), "child" + File.separatorChar + "grandChild", "grandChild");
verifyChange(changes.get(1), "child" + File.separatorChar + "grandChild" + File.separatorChar + "a.txt", "grandChild" + File.separatorChar + "a.txt");
}