本文整理汇总了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;
}
示例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;
}