本文整理匯總了Java中com.intellij.openapi.diff.impl.patch.ApplyPatchStatus.and方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplyPatchStatus.and方法的具體用法?Java ApplyPatchStatus.and怎麽用?Java ApplyPatchStatus.and使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.diff.impl.patch.ApplyPatchStatus
的用法示例。
在下文中一共展示了ApplyPatchStatus.and方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
@CalledInAwt
public void run() {
myRemainingPatches.addAll(myPatches);
final ApplyPatchStatus patchStatus = nonWriteActionPreCheck();
if (ApplyPatchStatus.FAILURE.equals(patchStatus)) {
if (myShowNotification) {
showApplyStatus(myProject, patchStatus);
}
myStatus = patchStatus;
return;
}
final TriggerAdditionOrDeletion trigger = new TriggerAdditionOrDeletion(myProject, mySystemOperation);
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();
if(myShowNotification || !ApplyPatchStatus.SUCCESS.equals(myStatus)) {
showApplyStatus(myProject, myStatus);
}
refreshFiles(trigger.getAffected());
}
示例2: applyList
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
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: applyList
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
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;
}
示例4: run
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
@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());
}
示例5: executeWritable
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
@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);
}
}
示例6: applyList
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
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;
}
示例7: actualApply
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
@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;
}
示例8: actualApply
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
@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 (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;
}
示例9: actualApply
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
@Nullable
private ApplyPatchStatus actualApply(final List<Pair<VirtualFile, ApplyTextFilePatch>> textPatches,
final List<Pair<VirtualFile, ApplyFilePatchBase<BinaryType>>> binaryPatches,
final CommitContext commitContext) {
final ApplyPatchContext context = new ApplyPatchContext(myBaseDirectory, 0, true, true);
ApplyPatchStatus status;
try {
status = applyList(textPatches, context, null, commitContext);
if (status == ApplyPatchStatus.ABORT) return status;
if (myCustomForBinaries == null) {
status = applyList(binaryPatches, context, status, commitContext);
}
else {
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.ABORT;
}
return status;
}
示例10: tryApply
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
private ApplyPatchStatus tryApply(final List<String> lines, boolean acceptPartial) throws ApplyPatchException {
final List<PatchLine> hunkLines = myHunk.getLines();
ApplyPatchStatus result = null;
int curLine = findStartLine(hunkLines, lines);
for(PatchLine line: hunkLines) {
final String patchLineText = line.getText();
switch (line.getType()) {
case CONTEXT:
checkContextMismatch(lines, curLine, patchLineText);
curLine++;
break;
case ADD:
if (curLine < lines.size() && lines.get(curLine).equals(patchLineText) && acceptPartial) {
result = ApplyPatchStatus.and(result, ApplyPatchStatus.ALREADY_APPLIED);
}
else {
lines.add(curLine, patchLineText);
result = ApplyPatchStatus.and(result, ApplyPatchStatus.SUCCESS);
}
curLine++;
break;
case REMOVE:
if (curLine >= lines.size() || !patchLineText.equals(lines.get(curLine))) {
if (acceptPartial) {
// we'll get a context mismatch exception later if it's actually a conflict and not an already applied line
result = ApplyPatchStatus.and(result, ApplyPatchStatus.ALREADY_APPLIED);
}
else {
checkContextMismatch(lines, curLine, patchLineText);
}
}
else {
lines.remove(curLine);
result = ApplyPatchStatus.and(result, ApplyPatchStatus.SUCCESS);
}
break;
}
}
if (result != null) {
return result;
}
return ApplyPatchStatus.SUCCESS;
}
示例11: run
import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入方法依賴的package包/類
@Override
public void run(ContinuationContext context) {
myRemainingPatches.addAll(myPatches);
final ApplyPatchStatus patchStatus = nonWriteActionPreCheck();
if (ApplyPatchStatus.FAILURE.equals(patchStatus)) {
if (myShowNotification) {
showApplyStatus(myProject, patchStatus);
}
myStatus = patchStatus;
return;
}
final TriggerAdditionOrDeletion trigger = new TriggerAdditionOrDeletion(myProject, mySystemOperation);
final ApplyPatchStatus applyStatus;
try {
applyStatus = ApplicationManager.getApplication().runReadAction(new Computable<ApplyPatchStatus>() {
public ApplyPatchStatus compute() {
final Ref<ApplyPatchStatus> refStatus = new Ref<ApplyPatchStatus>(ApplyPatchStatus.FAILURE);
try {
setConfirmationToDefault();
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
public void run() {
if (! createFiles()) {
refStatus.set(ApplyPatchStatus.FAILURE);
return;
}
addSkippedItems(trigger);
trigger.prepare();
refStatus.set(executeWritable());
}
}, VcsBundle.message("patch.apply.command"), null);
} finally {
returnConfirmationBack();
}
return refStatus.get();
}
});
} finally {
VcsFileListenerContextHelper.getInstance(myProject).clearContext();
}
myStatus = ApplyPatchStatus.SUCCESS.equals(patchStatus) ? applyStatus :
ApplyPatchStatus.and(patchStatus, applyStatus);
// listeners finished, all 'legal' file additions/deletions with VCS are done
trigger.processIt();
if(myShowNotification || !ApplyPatchStatus.SUCCESS.equals(myStatus)) {
showApplyStatus(myProject, myStatus);
}
refreshFiles(trigger.getAffected(), context);
}