當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。