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


Java ConflictsDialog.isOK方法代码示例

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


在下文中一共展示了ConflictsDialog.isOK方法的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);
    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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: checkConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入方法依赖的package包/类
@Override
public boolean checkConflicts(final GrPullUpDialog dialog) {
  /*                         todo */
  List<GrMemberInfo> _infos = dialog.getSelectedMemberInfos();
  final GrMemberInfo[] infos = _infos.toArray(new GrMemberInfo[_infos.size()]);
  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() {
    @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(GrPullUpConflictsUtil.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:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:GrPullUpHandler.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()) {
    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:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:ExtractSuperClassUtil.java

示例11: preprocessUsages

import com.intellij.refactoring.ui.ConflictsDialog; //导入方法依赖的package包/类
protected boolean preprocessUsages(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);
      conflictsDialog.show();
      if (!conflictsDialog.isOK()){
        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:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:InheritanceToDelegationProcessor.java

示例12: preprocessUsages

import com.intellij.refactoring.ui.ConflictsDialog; //导入方法依赖的package包/类
@Override
protected boolean preprocessUsages(Ref<UsageInfo[]> refUsages) {
  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());
    }

    ConflictsDialog dialog = prepareConflictsDialog(conflictDescriptions, usagesIn);
    dialog.show();
    if (!dialog.isOK()) {
      if (dialog.isShowConflicts()) prepareSuccessful();
      return false;
    }
  }
  refUsages.set(usagesSet.toArray(new UsageInfo[usagesSet.size()]));
  prepareSuccessful();
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:GrChangeSignatureProcessor.java

示例13: processIntention

import com.intellij.refactoring.ui.ConflictsDialog; //导入方法依赖的package包/类
@Override
protected final void processIntention(@NotNull PsiElement element) throws IncorrectOperationException {
  final PsiMember member = (PsiMember)element.getParent();
  final PsiModifierList modifierList = member.getModifierList();
  if (modifierList == null) {
    return;
  }
  final MultiMap<PsiElement, String> conflicts = checkForConflicts(member);
  final boolean conflictsDialogOK;
  if (conflicts.isEmpty()) {
    conflictsDialogOK = true;
  } else {
    final ConflictsDialog conflictsDialog = new ConflictsDialog(member.getProject(), conflicts, new Runnable() {
      @Override
      public void run() {
        final AccessToken token = WriteAction.start();
        try {
          modifierList.setModifierProperty(getModifier(), true);
        }
        finally {
          token.finish();
        }
      }
    });
    conflictsDialog.show();
    conflictsDialogOK = conflictsDialog.isOK();
  }
  if (conflictsDialogOK) {
    modifierList.setModifierProperty(getModifier(), true);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:ModifierIntention.java

示例14: checkConflicts

import com.intellij.refactoring.ui.ConflictsDialog; //导入方法依赖的package包/类
@Override
public boolean checkConflicts(final HaxePullUpDialog 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:HaxeFoundation,项目名称:intellij-haxe,代码行数:32,代码来源:HaxePullUpHandler.java

示例15: showConflictsDialog

import com.intellij.refactoring.ui.ConflictsDialog; //导入方法依赖的package包/类
private boolean showConflictsDialog(final JSNamedElement existing, final String name)
{
	final String message = existing instanceof JSFunction ? JavaScriptBundle.message("javascript.introduce.variable.function.already.exists",
			CommonRefactoringUtil.htmlEmphasize(name)) : JavaScriptBundle.message("javascript.introduce.variable.variable.already.exists",
			CommonRefactoringUtil.htmlEmphasize(name));
	final ConflictsDialog conflictsDialog = new ConflictsDialog(myProject, message);
	conflictsDialog.show();
	return conflictsDialog.isOK();
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:10,代码来源:JSBaseIntroduceDialog.java


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