use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.
the class RemoveChangeListAction method askIfShouldRemoveChangeLists.
private static boolean askIfShouldRemoveChangeLists(@NotNull List<? extends LocalChangeList> lists, Project project) {
for (LocalChangeList list : lists) {
if (list.isDefault()) {
return confirmActiveChangeListRemoval(project, lists, list.getChanges().isEmpty());
}
}
boolean haveNoChanges = lists.stream().noneMatch(list -> !list.getChanges().isEmpty());
String message = lists.size() == 1 ? VcsBundle.message("changes.removechangelist.warning.text", lists.get(0).getName()) : VcsBundle.message("changes.removechangelist.multiple.warning.text", lists.size());
return haveNoChanges || Messages.YES == Messages.showYesNoDialog(project, message, VcsBundle.message("changes.removechangelist.warning.title"), Messages.getQuestionIcon());
}
use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.
the class RenameChangeListAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
ChangeList[] lists = e.getData(VcsDataKeys.CHANGE_LISTS);
assert lists != null;
final LocalChangeList list = ChangeListManager.getInstance(project).findChangeList(lists[0].getName());
if (list != null) {
new EditChangelistDialog(project, list).show();
}
}
use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.
the class ApplyPatchDifferentiatedDialog method runExecutor.
@CalledInAwt
private void runExecutor(ApplyPatchExecutor executor) {
final Collection<AbstractFilePatchInProgress> included = getIncluded();
if (included.isEmpty())
return;
final MultiMap<VirtualFile, AbstractFilePatchInProgress> patchGroups = new MultiMap<>();
for (AbstractFilePatchInProgress patchInProgress : included) {
patchGroups.putValue(patchInProgress.getBase(), patchInProgress);
}
final LocalChangeList selected = getSelectedChangeList();
FilePresentationModel presentation = myRecentPathFileChange.get();
VirtualFile vf = presentation != null ? presentation.getVf() : null;
executor.apply(getOriginalRemaining(), patchGroups, selected, vf == null ? null : vf.getName(), myReader == null ? null : myReader.getAdditionalInfo(ApplyPatchDefaultExecutor.pathsFromGroups(patchGroups)));
}
use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.
the class SwitchTaskAction method removeTask.
public static void removeTask(@NotNull final Project project, LocalTask task, TaskManager manager) {
if (task.isDefault()) {
Messages.showInfoMessage(project, "Default task cannot be removed", "Cannot Remove");
} else {
List<ChangeListInfo> infos = task.getChangeLists();
List<LocalChangeList> lists = ContainerUtil.mapNotNull(infos, (NullableFunction<ChangeListInfo, LocalChangeList>) changeListInfo -> {
LocalChangeList changeList = ChangeListManager.getInstance(project).getChangeList(changeListInfo.id);
return changeList != null && !changeList.isDefault() ? changeList : null;
});
boolean removeIt = true;
l: for (LocalChangeList list : lists) {
if (!list.getChanges().isEmpty()) {
int result = Messages.showYesNoCancelDialog(project, "Changelist associated with '" + task.getSummary() + "' is not empty.\n" + "Do you want to remove it and move the changes to the active changelist?", "Changelist Not Empty", Messages.getWarningIcon());
switch(result) {
case Messages.YES:
break l;
case Messages.NO:
removeIt = false;
break;
default:
return;
}
}
}
if (removeIt) {
for (LocalChangeList list : lists) {
ChangeListManager.getInstance(project).removeChangeList(list);
}
}
manager.removeTask(task);
}
}
use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.
the class HgTestChangeListManager method commitFiles.
/**
* Commits all changes of the given files.
*/
public void commitFiles(VirtualFile... files) {
ensureUpToDate();
final List<Change> changes = new ArrayList<>(files.length);
for (VirtualFile f : files) {
changes.addAll(peer.getChangesIn(f));
}
final LocalChangeList list = peer.getDefaultChangeList();
assertNotNull(list);
list.setComment("A comment to a commit");
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
Assert.assertTrue(peer.commitChangesSynchronouslyWithResult(list, changes));
}
});
ensureUpToDate();
}
Aggregations