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


Java AutomaticRenamingDialog类代码示例

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


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

示例1: preprocessUsages

import com.intellij.refactoring.rename.AutomaticRenamingDialog; //导入依赖的package包/类
protected boolean preprocessUsages(Ref<UsageInfo[]> refUsages) {
  UsageInfo[] usages = refUsages.get();
  List<UsageInfo> filtered = new ArrayList<UsageInfo>();
  for (UsageInfo usage : usages) {
    if (usage instanceof TurnToSuperReferenceUsageInfo) {
      filtered.add(usage);
    }
  }

  myVariableRenamer = new AutomaticVariableRenamer(myClass, mySuperClassName, filtered);
  if (!ApplicationManager.getApplication().isUnitTestMode() &&
      myVariableRenamer.hasAnythingToRename()) {
    final AutomaticRenamingDialog dialog = new AutomaticRenamingDialog(myProject, myVariableRenamer);
    dialog.show();
    if (!dialog.isOK()) return false;

    final List<PsiNamedElement> variables = myVariableRenamer.getElements();
    for (final PsiNamedElement namedElement : variables) {
      final PsiVariable variable = (PsiVariable)namedElement;
      final SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(variable);
      myVariablesRenames.put(pointer, myVariableRenamer.getNewName(variable));
    }

    Runnable runnable = new Runnable() {
      public void run() {
        myVariableRenamer.findUsages(myVariablesUsages, false, false);
      }
    };

    if (!ProgressManager.getInstance()
      .runProcessWithProgressSynchronously(runnable, RefactoringBundle.message("searching.for.variables"), true, myProject)) {
      return false;
    }
  }

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

示例2: preprocessUsages

import com.intellij.refactoring.rename.AutomaticRenamingDialog; //导入依赖的package包/类
@Override
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
  UsageInfo[] usages = refUsages.get();
  List<UsageInfo> filtered = new ArrayList<UsageInfo>();
  for (UsageInfo usage : usages) {
    if (usage instanceof TurnToSuperReferenceUsageInfo) {
      filtered.add(usage);
    }
  }

  if (myClass.getName() != null) {
    final AutomaticVariableRenamer variableRenamer = new AutomaticVariableRenamer(myClass, mySuperClassName, filtered);
    if (!ApplicationManager.getApplication().isUnitTestMode() &&
        variableRenamer.hasAnythingToRename()) {
      final AutomaticRenamingDialog dialog = new AutomaticRenamingDialog(myProject, variableRenamer);
      if (!dialog.showAndGet()) {
        return false;
      }

      final List<PsiNamedElement> variables = variableRenamer.getElements();
      for (final PsiNamedElement namedElement : variables) {
        final PsiVariable variable = (PsiVariable)namedElement;
        final SmartPsiElementPointer pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(variable);
        myVariablesRenames.put(pointer, variableRenamer.getNewName(variable));
      }

      Runnable runnable = new Runnable() {
        @Override
        public void run() {
          ApplicationManager.getApplication().runReadAction(new Runnable() {
            @Override
            public void run() {
              variableRenamer.findUsages(myVariablesUsages, false, false);
            }
          });
        }
      };

      if (!ProgressManager.getInstance()
        .runProcessWithProgressSynchronously(runnable, RefactoringBundle.message("searching.for.variables"), true, myProject)) {
        return false;
      }
    }
  }

  prepareSuccessful();
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:TurnRefsToSuperProcessorBase.java


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