本文整理匯總了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;
}