当前位置: 首页>>代码示例>>Java>>正文


Java ConflictsDialog类代码示例

本文整理汇总了Java中com.intellij.refactoring.ui.ConflictsDialog的典型用法代码示例。如果您正苦于以下问题:Java ConflictsDialog类的具体用法?Java ConflictsDialog怎么用?Java ConflictsDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConflictsDialog类属于com.intellij.refactoring.ui包,在下文中一共展示了ConflictsDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doOKAction

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected void doOKAction() {
  MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
  if (myCreateInnerClassRb.isSelected()) {
    final PsiClass innerClass = myTargetClass.findInnerClassByName(myInnerClassName.getText(), false);
    if (innerClass != null) {
      conflicts.putValue(innerClass, "Inner class " + myInnerClassName.getText() + " already defined in class " + myTargetClass.getName());
    }
  }
  if (conflicts.size() > 0) {
    final ConflictsDialog conflictsDialog = new ConflictsDialog(myProject, conflicts);
    if (!conflictsDialog.showAndGet()) {
      if (conflictsDialog.isShowConflicts()) close(CANCEL_EXIT_CODE);
      return;
    }
  }

  final JCheckBox makeVarargsCb = myCreateInnerClassRb.isSelected() ? myCbMakeVarargs : myCbMakeVarargsAnonymous;
  if (makeVarargsCb != null && makeVarargsCb.isSelected()) {
    final VariableData data = myInputVariables[myInputVariables.length - 1];
    if (data.type instanceof PsiArrayType) {
      data.type = new PsiEllipsisType(((PsiArrayType)data.type).getComponentType());
    }
  }
  super.doOKAction();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ExtractMethodObjectDialog.java

示例2: preprocessUsages

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected final boolean preprocessUsages(@NotNull final Ref<UsageInfo[]> refUsages) {
  UsageInfo[] usagesIn = refUsages.get();
  if (myPrepareSuccessfulSwingThreadCallback != null) {
    MultiMap<PsiElement, String> conflicts = getConflictDescriptions(usagesIn);
    if (conflicts.size() > 0) {
      ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, refUsages.get());
      if (!conflictsDialog.showAndGet()) {
        if (conflictsDialog.isShowConflicts()) prepareSuccessful();
        return false;
      }
    }
    if(!mySettings.isChangeSignature()) {
      refUsages.set(filterInternalUsages(usagesIn));
    }
  }
  final Set<UsageInfo> toMakeStatic = new LinkedHashSet<UsageInfo>();
  refUsages.set(filterOverriding(usagesIn, toMakeStatic));
  if (!findAdditionalMembers(toMakeStatic)) return false;
  prepareSuccessful();
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MakeMethodOrClassStaticProcessor.java

示例3: showConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:BaseRefactoringProcessor.java

示例4: doOKAction

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected void doOKAction() {
  MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
  if (myCreateInnerClassRb.isSelected()) {
    final PsiClass innerClass = myTargetClass.findInnerClassByName(myInnerClassName.getText(), false);
    if (innerClass != null) {
      conflicts.putValue(innerClass, "Inner class " + myInnerClassName.getText() + " already defined in class " + myTargetClass.getName());
    }
  }
  if (conflicts.size() > 0) {
    final ConflictsDialog conflictsDialog = new ConflictsDialog(myProject, conflicts);
    conflictsDialog.show();
    if (!conflictsDialog.isOK()){
      if (conflictsDialog.isShowConflicts()) close(CANCEL_EXIT_CODE);
      return;
    }
  }

  final JCheckBox makeVarargsCb = myCreateInnerClassRb.isSelected() ? myCbMakeVarargs : myCbMakeVarargsAnonymous;
  if (makeVarargsCb != null && makeVarargsCb.isSelected()) {
    final VariableData data = myInputVariables[myInputVariables.length - 1];
    if (data.type instanceof PsiArrayType) {
      data.type = new PsiEllipsisType(((PsiArrayType)data.type).getComponentType());
    }
  }
  super.doOKAction();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:ExtractMethodObjectDialog.java

示例5: doOKAction

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected void doOKAction() {
  MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
  checkMethodConflicts(conflicts);
  if (!conflicts.isEmpty()) {
    final ConflictsDialog conflictsDialog = new ConflictsDialog(myProject, conflicts);
    conflictsDialog.show();
    if (!conflictsDialog.isOK()){
      if (conflictsDialog.isShowConflicts()) close(CANCEL_EXIT_CODE);
      return;
    }
  }

  if (myMakeVarargs != null && myMakeVarargs.isSelected()) {
    final VariableData data = myInputVariables[myInputVariables.length - 1];
    if (data.type instanceof PsiArrayType) {
      data.type = new PsiEllipsisType(((PsiArrayType)data.type).getComponentType());
    }
  }
  super.doOKAction();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ExtractMethodDialog.java

示例6: preprocessUsages

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected final boolean preprocessUsages(final Ref<UsageInfo[]> refUsages) {
  UsageInfo[] usagesIn = refUsages.get();
  if (myPrepareSuccessfulSwingThreadCallback != null) {
    MultiMap<PsiElement, String> conflicts = getConflictDescriptions(usagesIn);
    if (conflicts.size() > 0) {
      ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, refUsages.get());
      conflictsDialog.show();
      if (!conflictsDialog.isOK()) {
        if (conflictsDialog.isShowConflicts()) prepareSuccessful();
        return false;
      }
    }
    if(!mySettings.isChangeSignature()) {
      refUsages.set(filterInternalUsages(usagesIn));
    }
  }
  refUsages.set(filterOverriding(usagesIn));

  prepareSuccessful();
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:MakeMethodOrClassStaticProcessor.java

示例7: checkConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
public boolean checkConflicts(final PullUpDialog dialog) {
  final MemberInfo[] infos = dialog.getSelectedMemberInfos();
  final PsiClass superClass = dialog.getSuperClass();
  if (!checkWritable(superClass, infos)) return false;
  final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
  if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    public void run() {
      final PsiDirectory targetDirectory = superClass.getContainingFile().getContainingDirectory();
      final PsiPackage targetPackage = targetDirectory != null ? JavaDirectoryService.getInstance().getPackage(targetDirectory) : null;
      conflicts
        .putAllValues(PullUpConflictsUtil.checkConflicts(infos, mySubclass, superClass, targetPackage, targetDirectory, dialog.getContainmentVerifier()));
    }
  }, RefactoringBundle.message("detecting.possible.conflicts"), true, myProject)) return false;
  if (!conflicts.isEmpty()) {
    ConflictsDialog conflictsDialog = new ConflictsDialog(myProject, conflicts);
    conflictsDialog.show();
    final boolean ok = conflictsDialog.isOK();
    if (!ok && conflictsDialog.isShowConflicts()) dialog.close(DialogWrapper.CANCEL_EXIT_CODE);
    return ok;
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:JavaPullUpHandler.java

示例8: showConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected boolean showConflicts(final MultiMap<PsiElement, String> conflicts, @Nullable final UsageInfo[] usages) {
  if (!conflicts.isEmpty() && ApplicationManager.getApplication().isUnitTestMode()) {
    throw new ConflictsInTestsException(conflicts.values());
  }

  if (myPrepareSuccessfulSwingThreadCallback != null && !conflicts.isEmpty()) {
    final ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, usages);
    conflictsDialog.show();
    if (!conflictsDialog.isOK()) {
      if (conflictsDialog.isShowConflicts()) prepareSuccessful();
      return false;
    }
  }

  prepareSuccessful();
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:BaseRefactoringProcessor.java

示例9: showConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected boolean showConflicts(@Nonnull 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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:BaseRefactoringProcessor.java

示例10: showConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
public static boolean showConflicts(DialogWrapper dialog, MultiMap<PsiElement, String> conflicts, final Project project) {
  if (!conflicts.isEmpty()) {
    fireConflictsEvent(conflicts, project);
    ConflictsDialog conflictsDialog = new ConflictsDialog(project, conflicts);
    conflictsDialog.show();
    final boolean ok = conflictsDialog.isOK();
    if (!ok && conflictsDialog.isShowConflicts()) dialog.close(DialogWrapper.CANCEL_EXIT_CODE);
    return ok;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ExtractSuperClassUtil.java

示例11: preprocessUsages

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
  for (ChangeSignatureUsageProcessor processor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
    if (!processor.setupDefaultValues(myChangeInfo, refUsages, myProject)) return false;
  }
  MultiMap<PsiElement, String> conflictDescriptions = new MultiMap<PsiElement, String>();
  for (ChangeSignatureUsageProcessor usageProcessor : ChangeSignatureUsageProcessor.EP_NAME.getExtensions()) {
    final MultiMap<PsiElement, String> conflicts = usageProcessor.findConflicts(myChangeInfo, refUsages);
    for (PsiElement key : conflicts.keySet()) {
      Collection<String> collection = conflictDescriptions.get(key);
      if (collection.size() == 0) collection = new HashSet<String>();
      collection.addAll(conflicts.get(key));
      conflictDescriptions.put(key, collection);
    }
  }

  final UsageInfo[] usagesIn = refUsages.get();
  RenameUtil.addConflictDescriptions(usagesIn, conflictDescriptions);
  Set<UsageInfo> usagesSet = new HashSet<UsageInfo>(Arrays.asList(usagesIn));
  RenameUtil.removeConflictUsages(usagesSet);
  if (!conflictDescriptions.isEmpty()) {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      throw new ConflictsInTestsException(conflictDescriptions.values());
    }
    if (myPrepareSuccessfulSwingThreadCallback != null) {
      ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
      if (!dialog.showAndGet()) {
        if (dialog.isShowConflicts()) prepareSuccessful();
        return false;
      }
    }
  }

  if (myChangeInfo.isReturnTypeChanged()) {
    askToRemoveCovariantOverriders(usagesSet);
  }

  refUsages.set(usagesSet.toArray(new UsageInfo[usagesSet.size()]));
  prepareSuccessful();
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ChangeSignatureProcessor.java

示例12: preprocessUsages

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
  final UsageInfo[] usagesIn = refUsages.get();
  ArrayList<UsageInfo> oldUsages = new ArrayList<UsageInfo>();
  addAll(oldUsages, usagesIn);
  final ObjectUpcastedUsageInfo[] objectUpcastedUsageInfos = objectUpcastedUsages(usagesIn);
  if (myPrepareSuccessfulSwingThreadCallback != null) {
    MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
    if (objectUpcastedUsageInfos.length > 0) {
      final String message = RefactoringBundle.message("instances.of.0.upcasted.to.1.were.found",
                                                       RefactoringUIUtil.getDescription(myClass, true), CommonRefactoringUtil.htmlEmphasize(
        CommonClassNames.JAVA_LANG_OBJECT));

      conflicts.putValue(myClass, message);
    }

    analyzeConflicts(usagesIn, conflicts);
    if (!conflicts.isEmpty()) {
      ConflictsDialog conflictsDialog = prepareConflictsDialog(conflicts, usagesIn);
      if (!conflictsDialog.showAndGet()) {
        if (conflictsDialog.isShowConflicts()) prepareSuccessful();
        return false;
      }
    }

    if (objectUpcastedUsageInfos.length > 0) {
      showObjectUpcastedUsageView(objectUpcastedUsageInfos);
      setPreviewUsages(true);
    }
  }
  ArrayList<UsageInfo> filteredUsages = filterUsages(oldUsages);
  refUsages.set(filteredUsages.toArray(new UsageInfo[filteredUsages.size()]));
  prepareSuccessful();
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:InheritanceToDelegationProcessor.java

示例13: reportConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
protected boolean reportConflicts(final MultiMap<PsiElement,String> conflicts, final Project project, IntroduceVariableSettings dialog) {
  ConflictsDialog conflictsDialog = new ConflictsDialog(project, conflicts);
  conflictsDialog.show();
  final boolean ok = conflictsDialog.isOK();
  if (!ok && conflictsDialog.isShowConflicts()) {
    if (dialog instanceof DialogWrapper) ((DialogWrapper)dialog).close(DialogWrapper.CANCEL_EXIT_CODE);
  }
  return ok;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:IntroduceVariableHandler.java

示例14: checkConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
@Override
public boolean checkConflicts(final PullUpDialog dialog) {
  final List<MemberInfo> infos = dialog.getSelectedMemberInfos();
  final MemberInfo[] memberInfos = infos.toArray(new MemberInfo[infos.size()]);
  final PsiClass superClass = dialog.getSuperClass();
  if (!checkWritable(superClass, memberInfos)) return false;
  final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
  if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runReadAction(new Runnable() {
        @Override
        public void run() {
          final PsiDirectory targetDirectory = superClass.getContainingFile().getContainingDirectory();
          final PsiPackage targetPackage = targetDirectory != null ? JavaDirectoryService.getInstance().getPackage(targetDirectory) : null;
          conflicts
            .putAllValues(PullUpConflictsUtil.checkConflicts(memberInfos, mySubclass, superClass, targetPackage, targetDirectory, dialog.getContainmentVerifier()));
        }
      });

    }
  }, RefactoringBundle.message("detecting.possible.conflicts"), true, myProject)) return false;
  if (!conflicts.isEmpty()) {
    ConflictsDialog conflictsDialog = new ConflictsDialog(myProject, conflicts);
    conflictsDialog.show();
    final boolean ok = conflictsDialog.isOK();
    if (!ok && conflictsDialog.isShowConflicts()) dialog.close(DialogWrapper.CANCEL_EXIT_CODE);
    return ok;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:JavaPullUpHandler.java

示例15: createConflictsDialog

import com.intellij.refactoring.ui.ConflictsDialog; //导入依赖的package包/类
@NotNull
protected ConflictsDialog createConflictsDialog(@NotNull MultiMap<PsiElement, String> conflicts, @Nullable final UsageInfo[] usages) {
  return new ConflictsDialog(myProject, conflicts, usages == null ? null : new Runnable() {
      @Override
      public void run() {
        execute(usages);
      }
    }, false, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:BaseRefactoringProcessor.java


注:本文中的com.intellij.refactoring.ui.ConflictsDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。