當前位置: 首頁>>代碼示例>>Java>>正文


Java ApplyPatchStatus類代碼示例

本文整理匯總了Java中com.intellij.openapi.diff.impl.patch.ApplyPatchStatus的典型用法代碼示例。如果您正苦於以下問題:Java ApplyPatchStatus類的具體用法?Java ApplyPatchStatus怎麽用?Java ApplyPatchStatus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ApplyPatchStatus類屬於com.intellij.openapi.diff.impl.patch包,在下文中一共展示了ApplyPatchStatus類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:PatchApplier.java

示例2: getApplyPatchStatus

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
@CalledInAwt
@NotNull
private ApplyPatchStatus getApplyPatchStatus(@NotNull final TriggerAdditionOrDeletion trigger) {
  final Ref<ApplyPatchStatus> refStatus = Ref.create(ApplyPatchStatus.FAILURE);
  try {
    setConfirmationToDefault();
    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
      @Override
      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();
    VcsFileListenerContextHelper.getInstance(myProject).clearContext();
  }
  return refStatus.get();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:PatchApplier.java

示例3: executeWritable

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
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);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:PatchApplier.java

示例4: 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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:PatchApplier.java

示例5: getStatus

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
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;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:GenericPatchApplier.java

示例6: applyChange

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ApplyBinaryShelvedFilePatch.java

示例7: executeWritable

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
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);
  }
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:21,代碼來源:PatchApplier.java

示例8: 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;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:20,代碼來源:PatchApplier.java

示例9: 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());
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:25,代碼來源:PatchApplier.java

示例10: getApplyPatchStatus

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
@CalledInAwt
@Nonnull
private ApplyPatchStatus getApplyPatchStatus(@Nonnull final TriggerAdditionOrDeletion trigger) {
  final Ref<ApplyPatchStatus> refStatus = Ref.create(null);
  try {
    setConfirmationToDefault();
    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
      @Override
      public void run() {
        //consider pre-check status only if not successful, otherwise we could not detect already applied status
        if (createFiles() != ApplyPatchStatus.SUCCESS) {
          refStatus.set(createFiles());
        }
        addSkippedItems(trigger);
        trigger.prepare();
        refStatus.set(ApplyPatchStatus.and(refStatus.get(), executeWritable()));
      }
    }, VcsBundle.message("patch.apply.command"), null);
  }
  finally {
    returnConfirmationBack();
    VcsFileListenerContextHelper.getInstance(myProject).clearContext();
  }
  final ApplyPatchStatus status = refStatus.get();
  return status == null ? ApplyPatchStatus.ALREADY_APPLIED : status;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:27,代碼來源:PatchApplier.java

示例11: 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);
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:19,代碼來源:PatchApplier.java

示例12: 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;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:22,代碼來源:PatchApplier.java

示例13: getStatus

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
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;
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:20,代碼來源:GenericPatchApplier.java

示例14: applyChange

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
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;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:24,代碼來源:ApplyBinaryShelvedFilePatch.java

示例15: nonWriteActionPreCheck

import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; //導入依賴的package包/類
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) ;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:PatchApplier.java


注:本文中的com.intellij.openapi.diff.impl.patch.ApplyPatchStatus類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。