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