本文整理匯總了Java中com.intellij.openapi.diff.impl.patch.ApplyPatchStatus.FAILURE屬性的典型用法代碼示例。如果您正苦於以下問題:Java ApplyPatchStatus.FAILURE屬性的具體用法?Java ApplyPatchStatus.FAILURE怎麽用?Java ApplyPatchStatus.FAILURE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.intellij.openapi.diff.impl.patch.ApplyPatchStatus
的用法示例。
在下文中一共展示了ApplyPatchStatus.FAILURE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: executeWritable
protected ApplyPatchStatus executeWritable() {
if (!makeWritable(myVerifier.getWritableFiles())) {
return ApplyPatchStatus.FAILURE;
}
final List<Pair<VirtualFile, ApplyTextFilePatch>> textPatches = myVerifier.getTextPatches();
if (!fileTypesAreOk(textPatches)) {
return ApplyPatchStatus.FAILURE;
}
try {
markInternalOperation(textPatches, true);
return actualApply(myVerifier, myCommitContext);
}
finally {
markInternalOperation(textPatches, false);
}
}
示例2: applyList
private <V extends FilePatch, T extends ApplyFilePatchBase<V>> ApplyPatchStatus applyList(final List<Pair<VirtualFile, T>> patches,
final ApplyPatchContext context,
ApplyPatchStatus status,
CommitContext commiContext) throws IOException {
for (Pair<VirtualFile, T> patch : patches) {
ApplyPatchStatus patchStatus = ApplyPatchAction.applyOnly(myProject, patch.getSecond(), context, patch.getFirst(), commiContext,
myReverseConflict, myLeftConflictPanelTitle, myRightConflictPanelTitle);
if (patchStatus == ApplyPatchStatus.ABORT) return patchStatus;
status = ApplyPatchStatus.and(status, patchStatus);
if (patchStatus == ApplyPatchStatus.FAILURE) return status;
if (patchStatus != ApplyPatchStatus.SKIP) {
myVerifier.doMoveIfNeeded(patch.getFirst());
myRemainingPatches.remove(patch.getSecond().getPatch());
}
}
return status;
}
示例3: getStatus
public ApplyPatchStatus getStatus() {
if (! myNotExact.isEmpty()) {
return ApplyPatchStatus.FAILURE;
} else {
if (myTransformations.isEmpty() && myHadAlreadyAppliedMet) return ApplyPatchStatus.ALREADY_APPLIED;
boolean haveAlreadyApplied = myHadAlreadyAppliedMet;
boolean haveTrue = false;
for (MyAppliedData data : myTransformations.values()) {
if (data.isHaveAlreadyApplied()) {
haveAlreadyApplied |= true;
} else {
haveTrue = true;
}
}
if (haveAlreadyApplied && ! haveTrue) return ApplyPatchStatus.ALREADY_APPLIED;
if (haveAlreadyApplied) return ApplyPatchStatus.PARTIAL;
return ApplyPatchStatus.SUCCESS;
}
}
示例4: applyChange
protected Result applyChange(Project project, final VirtualFile fileToPatch, FilePath pathBeforeRename, Getter<CharSequence> baseContents)
throws IOException {
try {
ContentRevision contentRevision = myPatch.getShelvedBinaryFile().createChange(project).getAfterRevision();
if (contentRevision != null) {
assert (contentRevision instanceof ShelvedBinaryContentRevision);
byte[] binaryContent = ((ShelvedBinaryContentRevision)contentRevision).getBinaryContent();
//it may be new empty binary file
fileToPatch.setBinaryContent(binaryContent != null ? binaryContent : ArrayUtil.EMPTY_BYTE_ARRAY);
}
}
catch (VcsException e) {
LOG.error("Couldn't apply shelved binary patch", e);
return new Result(ApplyPatchStatus.FAILURE) {
@Override
public ApplyPatchForBaseRevisionTexts getMergeData() {
return null;
}
};
}
return SUCCESS;
}
示例5: executeWritable
protected ApplyPatchStatus executeWritable() {
if (!makeWritable(myVerifier.getWritableFiles())) {
return ApplyPatchStatus.FAILURE;
}
final List<Pair<VirtualFile, ApplyTextFilePatch>> textPatches = myVerifier.getTextPatches();
if (!fileTypesAreOk(textPatches)) {
return ApplyPatchStatus.FAILURE;
}
try {
markInternalOperation(textPatches, true);
final ApplyPatchStatus status = actualApply(myVerifier, myCommitContext);
return status;
}
finally {
markInternalOperation(textPatches, false);
}
}
示例6: applyList
private <V extends FilePatch, T extends ApplyFilePatchBase<V>> ApplyPatchStatus applyList(final List<Pair<VirtualFile, T>> patches,
final ApplyPatchContext context,
ApplyPatchStatus status,
CommitContext commiContext) throws IOException {
for (Pair<VirtualFile, T> patch : patches) {
ApplyPatchStatus patchStatus = ApplyPatchAction.applyOnly(myProject, patch.getSecond(), context, patch.getFirst(), commiContext,
myReverseConflict, myLeftConflictPanelTitle, myRightConflictPanelTitle);
myVerifier.doMoveIfNeeded(patch.getFirst());
status = ApplyPatchStatus.and(status, patchStatus);
if (patchStatus != ApplyPatchStatus.FAILURE) {
myRemainingPatches.remove(patch.getSecond().getPatch());
} else {
// interrupt if failure
return status;
}
}
return status;
}
示例7: run
@CalledInAwt
public void run() {
myRemainingPatches.addAll(myPatches);
final ApplyPatchStatus patchStatus = nonWriteActionPreCheck();
final Label beforeLabel = LocalHistory.getInstance().putSystemLabel(myProject, "Before patch");
final TriggerAdditionOrDeletion trigger = new TriggerAdditionOrDeletion(myProject);
final ApplyPatchStatus applyStatus = getApplyPatchStatus(trigger);
myStatus = ApplyPatchStatus.SUCCESS.equals(patchStatus) ? applyStatus :
ApplyPatchStatus.and(patchStatus, applyStatus);
// listeners finished, all 'legal' file additions/deletions with VCS are done
trigger.processIt();
LocalHistory.getInstance().putSystemLabel(myProject, "After patch"); // insert a label to be visible in local history dialog
if (myStatus == ApplyPatchStatus.FAILURE) {
suggestRollback(myProject, Collections.singletonList(PatchApplier.this), beforeLabel);
}
else if (myStatus == ApplyPatchStatus.ABORT) {
rollbackUnderProgress(myProject, myProject.getBaseDir(), beforeLabel);
}
if(myShowNotification || !ApplyPatchStatus.SUCCESS.equals(myStatus)) {
showApplyStatus(myProject, myStatus);
}
refreshFiles(trigger.getAffected());
}
示例8: executeWritable
@Nullable
protected ApplyPatchStatus executeWritable() {
final ReadonlyStatusHandler.OperationStatus readOnlyFilesStatus = getReadOnlyFilesStatus(myVerifier.getWritableFiles());
if (readOnlyFilesStatus.hasReadonlyFiles()) {
showError(myProject, readOnlyFilesStatus.getReadonlyFilesMessage(), true);
return ApplyPatchStatus.ABORT;
}
myFailedPatches.addAll(myVerifier.filterBadFileTypePatches());
ApplyPatchStatus result = myFailedPatches.isEmpty() ? null : ApplyPatchStatus.FAILURE;
final List<Pair<VirtualFile, ApplyTextFilePatch>> textPatches = myVerifier.getTextPatches();
try {
markInternalOperation(textPatches, true);
return ApplyPatchStatus.and(result, actualApply(textPatches, myVerifier.getBinaryPatches(), myCommitContext));
}
finally {
markInternalOperation(textPatches, false);
}
}
示例9: applyList
private <V extends FilePatch, T extends ApplyFilePatchBase<V>> ApplyPatchStatus applyList(final List<Pair<VirtualFile, T>> patches,
final ApplyPatchContext context,
ApplyPatchStatus status,
CommitContext commiContext) throws IOException {
for (Pair<VirtualFile, T> patch : patches) {
ApplyPatchStatus patchStatus = ApplyPatchAction.applyOnly(myProject, patch.getSecond(), context, patch.getFirst(), commiContext,
myReverseConflict, myLeftConflictPanelTitle, myRightConflictPanelTitle);
if (patchStatus == ApplyPatchStatus.ABORT) return patchStatus;
status = ApplyPatchStatus.and(status, patchStatus);
if (patchStatus == ApplyPatchStatus.FAILURE) {
myFailedPatches.add(patch.getSecond().getPatch());
continue;
}
if (patchStatus != ApplyPatchStatus.SKIP) {
myVerifier.doMoveIfNeeded(patch.getFirst());
myRemainingPatches.remove(patch.getSecond().getPatch());
}
}
return status;
}
示例10: getStatus
public ApplyPatchStatus getStatus() {
if (! myNotExact.isEmpty()) {
return ApplyPatchStatus.FAILURE;
} else {
if (myTransformations.isEmpty() && myHadAlreadyAppliedMet) return ALREADY_APPLIED;
boolean haveAlreadyApplied = myHadAlreadyAppliedMet;
boolean haveTrue = false;
for (MyAppliedData data : myTransformations.values()) {
if (data.isHaveAlreadyApplied()) {
haveAlreadyApplied |= true;
} else {
haveTrue = true;
}
}
if (haveAlreadyApplied && ! haveTrue) return ALREADY_APPLIED;
if (haveAlreadyApplied) return ApplyPatchStatus.PARTIAL;
return ApplyPatchStatus.SUCCESS;
}
}
示例11: applyChange
protected Result applyChange(Project project, final VirtualFile fileToPatch, FilePath pathBeforeRename, Getter<CharSequence> baseContents)
throws IOException {
try {
ContentRevision contentRevision = myPatch.getShelvedBinaryFile().createChange(project).getAfterRevision();
if (contentRevision != null) {
assert (contentRevision instanceof ShelvedBinaryContentRevision);
byte[] binaryContent = ((ShelvedBinaryContentRevision)contentRevision).getBinaryContent();
//it may be new empty binary file
fileToPatch.setBinaryContent(binaryContent != null ? binaryContent : ArrayUtil.EMPTY_BYTE_ARRAY);
}
}
catch (VcsException e) {
LOG.error("Couldn't apply shelved binary patch", e);
return new Result(ApplyPatchStatus.FAILURE) {
@Override
public ApplyPatchForBaseRevisionTexts getMergeData() {
return null;
}
};
}
return SUCCESS;
}
示例12: nonWriteActionPreCheck
public ApplyPatchStatus nonWriteActionPreCheck() {
final boolean value = myVerifier.nonWriteActionPreCheck();
if (! value) return ApplyPatchStatus.FAILURE;
final List<FilePatch> skipped = myVerifier.getSkipped();
final boolean applyAll = skipped.isEmpty();
myPatches.removeAll(skipped);
return applyAll ? ApplyPatchStatus.SUCCESS : ((skipped.size() == myPatches.size()) ? ApplyPatchStatus.ALREADY_APPLIED : ApplyPatchStatus.PARTIAL) ;
}
示例13: actualApply
@Nullable
private ApplyPatchStatus actualApply(final PathsVerifier<BinaryType> verifier, final CommitContext commitContext) {
final List<Pair<VirtualFile, ApplyTextFilePatch>> textPatches = verifier.getTextPatches();
final ApplyPatchContext context = new ApplyPatchContext(myBaseDirectory, 0, true, true);
ApplyPatchStatus status = null;
try {
status = applyList(textPatches, context, status, commitContext);
if (status == ApplyPatchStatus.ABORT) return status;
if (myCustomForBinaries == null) {
status = applyList(verifier.getBinaryPatches(), context, status, commitContext);
} else {
final List<Pair<VirtualFile, ApplyFilePatchBase<BinaryType>>> binaryPatches = verifier.getBinaryPatches();
ApplyPatchStatus patchStatus = myCustomForBinaries.apply(binaryPatches);
final List<FilePatch> appliedPatches = myCustomForBinaries.getAppliedPatches();
moveForCustomBinaries(binaryPatches, appliedPatches);
status = ApplyPatchStatus.and(status, patchStatus);
myRemainingPatches.removeAll(appliedPatches);
}
}
catch (IOException e) {
showError(myProject, e.getMessage(), true);
return ApplyPatchStatus.FAILURE;
}
return status;
}
示例14: createThrow
public static Result createThrow(final IOException e) {
return new Result(ApplyPatchStatus.FAILURE, e) {
@Override
public ApplyPatchForBaseRevisionTexts getMergeData() {
return null;
}
};
}
示例15: applyChange
@Nullable
protected Result applyChange(final Project project, final VirtualFile fileToPatch, final FilePath pathBeforeRename, final Getter<CharSequence> baseContents) throws IOException {
byte[] fileContents = fileToPatch.contentsToByteArray();
CharSequence text = LoadTextUtil.getTextByBinaryPresentation(fileContents, fileToPatch);
final GenericPatchApplier applier = new GenericPatchApplier(text, myPatch.getHunks());
if (applier.execute()) {
final Document document = FileDocumentManager.getInstance().getDocument(fileToPatch);
if (document == null) {
throw new IOException("Failed to set contents for updated file " + fileToPatch.getPath());
}
document.setText(applier.getAfter());
FileDocumentManager.getInstance().saveDocument(document);
return new Result(applier.getStatus()) {
@Override
public ApplyPatchForBaseRevisionTexts getMergeData() {
return null;
}
};
}
applier.trySolveSomehow();
return new Result(ApplyPatchStatus.FAILURE) {
@Override
public ApplyPatchForBaseRevisionTexts getMergeData() {
return ApplyPatchForBaseRevisionTexts.create(project, fileToPatch, pathBeforeRename, myPatch, baseContents);
}
};
}