コード例 #1
0
  protected boolean showConflicts(
      @NotNull MultiMap<PsiElement, String> conflicts, @Nullable final UsageInfo[] usages) {
    if (!conflicts.isEmpty() && ApplicationManager.getApplication().isUnitTestMode()) {
      if (!ConflictsInTestsException.isTestIgnore())
        throw new ConflictsInTestsException(conflicts.values());
      return true;
    }

    if (myPrepareSuccessfulSwingThreadCallback != null && !conflicts.isEmpty()) {
      final String refactoringId = getRefactoringId();
      if (refactoringId != null) {
        RefactoringEventData conflictUsages = new RefactoringEventData();
        conflictUsages.putUserData(RefactoringEventData.CONFLICTS_KEY, conflicts.values());
        myProject
            .getMessageBus()
            .syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC)
            .conflictsDetected(refactoringId, conflictUsages);
      }
      final ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, usages);
      if (!conflictsDialog.showAndGet()) {
        if (conflictsDialog.isShowConflicts()) prepareSuccessful();
        return false;
      }
    }

    prepareSuccessful();
    return true;
  }
コード例 #2
0
 /**
  * Is called inside atomic action.
  *
  * @param refUsages usages to be filtered
  * @return true if preprocessed successfully
  */
 protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
   prepareSuccessful();
   return true;
 }