本文整理汇总了Java中com.intellij.psi.util.PsiUtilCore.getQualifiedNameAfterRename方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtilCore.getQualifiedNameAfterRename方法的具体用法?Java PsiUtilCore.getQualifiedNameAfterRename怎么用?Java PsiUtilCore.getQualifiedNameAfterRename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiUtilCore
的用法示例。
在下文中一共展示了PsiUtilCore.getQualifiedNameAfterRename方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findExistingNameConflicts
import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
public void findExistingNameConflicts(final PsiElement element, final String newName, final MultiMap<PsiElement,String> conflicts) {
if (element instanceof PsiCompiledElement) return;
final PsiClass aClass = (PsiClass)element;
if (newName.equals(aClass.getName())) return;
final PsiClass containingClass = aClass.getContainingClass();
if (containingClass != null) { // innerClass
PsiClass[] innerClasses = containingClass.getInnerClasses();
for (PsiClass innerClass : innerClasses) {
if (newName.equals(innerClass.getName())) {
conflicts.putValue(innerClass, RefactoringBundle.message("inner.class.0.is.already.defined.in.class.1", newName, containingClass.getQualifiedName()));
break;
}
}
}
else if (!(aClass instanceof PsiTypeParameter)) {
final String qualifiedNameAfterRename = PsiUtilCore.getQualifiedNameAfterRename(aClass.getQualifiedName(), newName);
Project project = element.getProject();
final PsiClass conflictingClass =
JavaPsiFacade.getInstance(project).findClass(qualifiedNameAfterRename, GlobalSearchScope.allScope(project));
if (conflictingClass != null) {
conflicts.putValue(conflictingClass, RefactoringBundle.message("class.0.already.exists", qualifiedNameAfterRename));
}
}
}
示例2: getQualifiedNameAfterRename
import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
public String getQualifiedNameAfterRename(final PsiElement element, final String newName, final boolean nonJava) {
if (nonJava) {
final PsiClass aClass = (PsiClass)element;
return PsiUtilCore.getQualifiedNameAfterRename(aClass.getQualifiedName(), newName);
}
else {
return newName;
}
}
示例3: getPostRenameCallback
import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
@Nullable
public Runnable getPostRenameCallback(final PsiElement element, final String newName, final RefactoringElementListener listener) {
final Project project = element.getProject();
final PsiPackage psiPackage = (PsiPackage)element;
final String newQualifiedName = PsiUtilCore.getQualifiedNameAfterRename(psiPackage.getQualifiedName(), newName);
return new Runnable() {
public void run() {
final PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage(newQualifiedName);
if (aPackage == null) {
return; //rename failed e.g. when the dir is used by another app
}
listener.elementRenamed(aPackage);
}
};
}
示例4: setName
import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
@Override
@Nullable
public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
checkSetName(name);
PsiDirectory[] dirs = getDirectories();
for (PsiDirectory dir : dirs) {
dir.setName(name);
}
String nameAfterRename = PsiUtilCore.getQualifiedNameAfterRename(getQualifiedName(), name);
return findPackage(nameAfterRename);
}