Search in sources :

Example 1 with HgPatchReferenceValidator

use of org.zmlx.hg4idea.util.HgPatchReferenceValidator in project intellij-community by JetBrains.

the class HgQRenameCommand method execute.

public void execute(@NotNull final Hash patchHash) {
    final Project project = myRepository.getProject();
    HgNameWithHashInfo patchInfo = ContainerUtil.find(myRepository.getMQAppliedPatches(), new Condition<HgNameWithHashInfo>() {

        @Override
        public boolean value(HgNameWithHashInfo info) {
            return info.getHash().equals(patchHash);
        }
    });
    if (patchInfo == null) {
        LOG.error("Could not find patch " + patchHash.toString());
        return;
    }
    final String oldName = patchInfo.getName();
    final String newName = Messages.showInputDialog(project, String.format("Enter a new name for %s patch:", oldName), "Rename Patch", Messages.getQuestionIcon(), "", new HgPatchReferenceValidator(myRepository));
    if (newName != null) {
        performPatchRename(myRepository, oldName, newName);
    }
}
Also used : Project(com.intellij.openapi.project.Project) HgNameWithHashInfo(org.zmlx.hg4idea.HgNameWithHashInfo) HgPatchReferenceValidator(org.zmlx.hg4idea.util.HgPatchReferenceValidator)

Aggregations

Project (com.intellij.openapi.project.Project)1 HgNameWithHashInfo (org.zmlx.hg4idea.HgNameWithHashInfo)1 HgPatchReferenceValidator (org.zmlx.hg4idea.util.HgPatchReferenceValidator)1