use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class GitUnstash method perform.
/**
* {@inheritDoc}
*/
protected void perform(@NotNull final Project project, @NotNull final List<VirtualFile> gitRoots, @NotNull final VirtualFile defaultRoot) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.isFreezedWithNotification("Can not unstash changes now"))
return;
GitUnstashDialog.showUnstashDialog(project, gitRoots, defaultRoot);
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class ChangeListChooserPanel method getSelectedList.
/**
* Method used as getResult, usually invoked inside doOkAction
*/
@Nullable
public LocalChangeList getSelectedList(Project project) {
ChangeListManager manager = ChangeListManager.getInstance(project);
String changeListName = myListPanel.getChangeListName();
LocalChangeList localChangeList = manager.findChangeList(changeListName);
if (localChangeList == null) {
localChangeList = manager.addChangeList(changeListName, myListPanel.getDescription());
myListPanel.changelistCreatedOrChanged(localChangeList);
} else {
//update description if changed
localChangeList.setComment(myListPanel.getDescription());
}
rememberSettings(project, localChangeList.isDefault(), myListPanel.getMakeActiveCheckBox().isSelected());
if (myListPanel.getMakeActiveCheckBox().isSelected()) {
manager.setDefaultChangeList(localChangeList);
}
return localChangeList;
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class AddHandler method execute.
@SuppressWarnings({ "UnnecessaryContinue" })
public void execute() {
//for(final File file: myIOFiles) {
// ApplicationManager.getApplication().runWriteAction(new Runnable() {
// public void run() {
// final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
// if (virtualFile != null) {
// myAllFiles.add(virtualFile);
// }
// }
// });
//}
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
final CvsEntriesManager cvsEntriesManager = CvsEntriesManager.getInstance();
for (VirtualFile file : myAllFiles) {
if (changeListManager.isIgnoredFile(file)) {
continue;
} else if (!CvsUtil.fileIsUnderCvs(file.getParent())) {
continue;
} else if (CvsUtil.fileIsLocallyRemoved(file)) {
CvsUtil.restoreFile(file);
} else if (CvsUtil.fileIsUnderCvs(file)) {
continue;
} else if (cvsEntriesManager.getCvsConnectionSettingsFor(file.getParent()).isOffline()) {
continue;
} else if (cvsEntriesManager.fileIsIgnored(file)) {
continue;
} else {
myAddedFiles.add(file);
}
}
if (!myAddedFiles.isEmpty()) {
if (CvsVcs2.getInstance(myProject).getAddConfirmation().getValue() != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) {
final Runnable addRunnable = () -> {
if (!myCvsStorageComponent.getIsActive())
return;
AddFileOrDirectoryAction.createActionToAddNewFileAutomatically().actionPerformed(createDataContext(myAddedFiles));
};
if (ApplicationManager.getApplication().isUnitTestMode()) {
addRunnable.run();
} else {
WaitForProgressToShow.runOrInvokeLaterAboveProgress(addRunnable, null, myProject);
}
}
}
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testComplex.
@Test
public void testComplex() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
final VirtualFile fileB = createFileInCommand("b.txt", "old content");
final VirtualFile fileC = createFileInCommand("c.txt", "old content");
final VirtualFile fileD = createFileInCommand("d.txt", "old content");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
final LocalChangeList list = changeListManager.addChangeList("test", null);
final LocalChangeList toBeDeletedList = changeListManager.addChangeList("toBeDeletedList", null);
changeListManager.moveChangesTo(list, new Change[] { changeListManager.getChange(file), changeListManager.getChange(fileB) });
changeListManager.moveChangesTo(toBeDeletedList, new Change[] { changeListManager.getChange(fileC), changeListManager.getChange(fileD) });
changeListManager.ensureUpToDate(false);
final String targetName = "target";
final String finalName = "final list name";
myScheme.doTest(() -> {
final LocalChangeList target = changeListManager.addChangeList(targetName, null);
changeListManager.moveChangesTo(target, new Change[] { changeListManager.getChange(file), changeListManager.getChange(fileB) });
checkFilesAreInList(new VirtualFile[] { file, fileB }, targetName, changeListManager);
changeListManager.editName(targetName, finalName);
checkFilesAreInList(new VirtualFile[] { file, fileB }, finalName, changeListManager);
changeListManager.removeChangeList(toBeDeletedList.getName());
checkFilesAreInList(new VirtualFile[] { fileC, fileD }, myDefaulListName, changeListManager);
changeListManager.moveChangesTo(LocalChangeList.createEmptyChangeList(myProject, finalName), new Change[] { changeListManager.getChange(fileC) });
checkFilesAreInList(new VirtualFile[] { file, fileB, fileC }, finalName, changeListManager);
checkFilesAreInList(new VirtualFile[] { fileD }, myDefaulListName, changeListManager);
});
checkFilesAreInList(new VirtualFile[] { file, fileB, fileC }, finalName, changeListManager);
checkFilesAreInList(new VirtualFile[] { fileD }, myDefaulListName, changeListManager);
changeListManager.ensureUpToDate(false);
checkFilesAreInList(new VirtualFile[] { file, fileB, fileC }, finalName, changeListManager);
checkFilesAreInList(new VirtualFile[] { fileD }, myDefaulListName, changeListManager);
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testAddPlusMove.
@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(() -> {
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);
}
Aggregations