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


Java ConflictsUtil.getContainer方法代码示例

本文整理汇总了Java中com.intellij.refactoring.util.ConflictsUtil.getContainer方法的典型用法代码示例。如果您正苦于以下问题:Java ConflictsUtil.getContainer方法的具体用法?Java ConflictsUtil.getContainer怎么用?Java ConflictsUtil.getContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.refactoring.util.ConflictsUtil的用法示例。


在下文中一共展示了ConflictsUtil.getContainer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitPackageLocalMemberReference

import com.intellij.refactoring.util.ConflictsUtil; //导入方法依赖的package包/类
private void visitPackageLocalMemberReference(PsiJavaCodeReferenceElement qualified, PsiModifierListOwner member) {
  PsiElement container = ConflictsUtil.getContainer(qualified);
  HashSet<PsiElement> reportedContainers = myReportedElementToContainer.get(member);
  if (reportedContainers == null) {
    reportedContainers = new HashSet<PsiElement>();
    myReportedElementToContainer.put(member, reportedContainers);
  }

  if (!reportedContainers.contains(container)) {
    reportedContainers.add(container);
    if (!isInsideMoved(container)) {
      PsiFile containingFile = container.getContainingFile();
      if (containingFile != null) {
        PsiDirectory directory = containingFile.getContainingDirectory();
        if (directory != null) {
          PsiJavaPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
          if (!myTargetPackage.equalToPackage(aPackage)) {
            String message = RefactoringBundle.message("0.will.be.inaccessible.from.1", RefactoringUIUtil.getDescription(member, true),
                                                  RefactoringUIUtil.getDescription(container, true));
            myConflicts.putValue(member, CommonRefactoringUtil.capitalize(message));
          }
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:MoveClassesOrPackagesProcessor.java

示例2: registerConflict

import com.intellij.refactoring.util.ConflictsUtil; //导入方法依赖的package包/类
private static void registerConflict(PsiJavaCodeReferenceElement reference,
                                     PsiElement resolved,
                                     HashMap<PsiElement, HashSet<PsiElement>> reported, MultiMap<PsiElement, String> conflicts) {
  final PsiElement container = ConflictsUtil.getContainer(reference);
  HashSet<PsiElement> containerSet = reported.get(container);
  if (containerSet == null) {
    containerSet = new HashSet<PsiElement>();
    reported.put(container, containerSet);
  }
  if (!containerSet.contains(resolved)) {
    containerSet.add(resolved);
    String placesDescription;
    if (containerSet.size() == 1) {
      placesDescription = RefactoringUIUtil.getDescription(resolved, true);
    } else {
      placesDescription = "<ol><li>" + StringUtil.join(containerSet, new Function<PsiElement, String>() {
        @Override
        public String fun(PsiElement element) {
          return RefactoringUIUtil.getDescription(element, true);
        }
      }, "</li><li>") + "</li></ol>";
    }
    String message = RefactoringBundle.message("0.will.become.inaccessible.from.1",
                                               placesDescription,
                                               RefactoringUIUtil.getDescription(container, true));
    conflicts.put(container, Collections.singletonList(message));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:MoveInnerProcessor.java

示例3: visitResolvedReference

import com.intellij.refactoring.util.ConflictsUtil; //导入方法依赖的package包/类
private void visitResolvedReference(PsiElement resolved, PsiJavaCodeReferenceElement reference) {
  if (resolved instanceof PsiModifierListOwner) {
    final PsiModifierList modifierList = ((PsiModifierListOwner)resolved).getModifierList();
    if (PsiModifier.PACKAGE_LOCAL.equals(VisibilityUtil.getVisibilityModifier(modifierList))) {
      PsiFile aFile = resolved.getContainingFile();
      if (aFile != null && !isInsideMoved(resolved)) {
        final PsiDirectory containingDirectory = aFile.getContainingDirectory();
        if (containingDirectory != null) {
          PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(containingDirectory);
          if (aPackage != null && !myTargetPackage.equalToPackage(aPackage)) {
            HashSet<PsiElement> reportedRefs = myReported.get(resolved);
            if (reportedRefs == null) {
              reportedRefs = new HashSet<PsiElement>();
              myReported.put(resolved, reportedRefs);
            }
            PsiElement container = ConflictsUtil.getContainer(reference);
            if (!reportedRefs.contains(container)) {
              final String message = RefactoringBundle.message("0.uses.a.package.local.1",
                                                               RefactoringUIUtil.getDescription(container, true),
                                                               RefactoringUIUtil.getDescription(resolved, true));
              myConflicts.putValue(resolved, CommonRefactoringUtil.capitalize(message));
              reportedRefs.add(container);
            }
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PackageLocalsUsageCollector.java

示例4: visitResolvedReference

import com.intellij.refactoring.util.ConflictsUtil; //导入方法依赖的package包/类
private void visitResolvedReference(PsiElement resolved, PsiJavaCodeReferenceElement reference) {
  if (resolved instanceof PsiModifierListOwner) {
    final PsiModifierList modifierList = ((PsiModifierListOwner)resolved).getModifierList();
    if (PsiModifier.PACKAGE_LOCAL.equals(VisibilityUtil.getVisibilityModifier(modifierList))) {
      PsiFile aFile = resolved.getContainingFile();
      if (aFile != null && !isInsideMoved(resolved)) {
        final PsiDirectory containingDirectory = aFile.getContainingDirectory();
        if (containingDirectory != null) {
          PsiJavaPackage aPackage = JavaDirectoryService.getInstance().getPackage(containingDirectory);
          if (aPackage != null && !myTargetPackage.equalToPackage(aPackage)) {
            HashSet<PsiElement> reportedRefs = myReported.get(resolved);
            if (reportedRefs == null) {
              reportedRefs = new HashSet<PsiElement>();
              myReported.put(resolved, reportedRefs);
            }
            PsiElement container = ConflictsUtil.getContainer(reference);
            if (!reportedRefs.contains(container)) {
              final String message = RefactoringBundle.message("0.uses.a.package.local.1",
                                                               RefactoringUIUtil.getDescription(container, true),
                                                               RefactoringUIUtil.getDescription(resolved, true));
              myConflicts.putValue(resolved, CommonRefactoringUtil.capitalize(message));
              reportedRefs.add(container);
            }
          }
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:30,代码来源:PackageLocalsUsageCollector.java

示例5: getDescription

import com.intellij.refactoring.util.ConflictsUtil; //导入方法依赖的package包/类
public String getDescription() {
  final PsiElement container = ConflictsUtil.getContainer(myHiddenClass);
  return RefactoringBundle.message("renamed.class.will.hide.0.in.1", RefactoringUIUtil.getDescription(myHiddenClass, false),
                                   RefactoringUIUtil.getDescription(container, false));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ClassHidesUnqualifiableClassUsageInfo.java


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