當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。