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


Java PsiUtilCore.getQualifiedNameAfterRename方法代码示例

本文整理汇总了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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RenameJavaClassProcessor.java

示例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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RenameJavaClassProcessor.java

示例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);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:RenamePsiPackageProcessor.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PsiPackageBase.java


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