• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UsageGroup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.usages.UsageGroup的典型用法代码示例。如果您正苦于以下问题:Java UsageGroup类的具体用法?Java UsageGroup怎么用?Java UsageGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UsageGroup类属于com.intellij.usages包,在下文中一共展示了UsageGroup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: appendUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Nullable
UsageNode appendUsage(@NotNull Usage usage, @NotNull Consumer<Runnable> edtQueue) {
  if (!isVisible(usage)) return null;

  final boolean dumb = DumbService.isDumb(myProject);

  GroupNode lastGroupNode = myRoot;
  for (int i = 0; i < myGroupingRules.length; i++) {
    final UsageGroupingRule rule = myGroupingRules[i];
    if (dumb && !DumbService.isDumbAware(rule)) continue;
    
    final UsageGroup group;
    if (rule instanceof UsageGroupingRuleEx) {
      group = ((UsageGroupingRuleEx) rule).groupUsage(usage, myTargets);
    }
    else {
      group = rule.groupUsage(usage);
    }
    if (group != null) {
      lastGroupNode = lastGroupNode.addGroup(group, i, edtQueue);
    }
  }

  return lastGroupNode.addUsage(usage, edtQueue);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:UsageNodeTreeBuilder.java


示例2: appendNodeText

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
private void appendNodeText(StringBuilder buf, DefaultMutableTreeNode node, String lineSeparator) {
  if (node instanceof Node && ((Node)node).isExcluded()) {
    buf.append("(").append(UsageViewBundle.message("usage.excluded")).append(") ");
  }

  if (node instanceof UsageNode) {
    TextChunk[] chunks = ((UsageNode)node).getUsage().getPresentation().getText();
    for (TextChunk chunk : chunks) {
      buf.append(chunk.getText());
    }
  }
  else if (node instanceof GroupNode) {
    UsageGroup group = ((GroupNode)node).getGroup();
    buf.append(group != null ? group.getText(myUsageView) : UsageViewBundle.message("usages.title"));
    buf.append(" ");
    int count = ((GroupNode)node).getRecursiveUsageCount();
    buf.append(" (").append(UsageViewBundle.message("usages.n", count)).append(")");
  }
  else if (node instanceof UsageTargetNode) {
    buf.append(((UsageTargetNode)node).getTarget().getPresentation().getPresentableText());
  }
  else {
    buf.append(node.toString());
  }
  buf.append(lineSeparator);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ExporterToTextFile.java


示例3: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
public UsageGroup groupUsage(@NotNull Usage usage) {
  if (usage instanceof UsageInModule) {
    UsageInModule usageInModule = (UsageInModule)usage;
    Module module = usageInModule.getModule();
    if (module != null) return new ModuleUsageGroup(module);
  }

  if (usage instanceof UsageInLibrary) {
    UsageInLibrary usageInLibrary = (UsageInLibrary)usage;
    OrderEntry entry = usageInLibrary.getLibraryEntry();
    if (entry != null) return new LibraryUsageGroup(entry);
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ModuleGroupingRule.java


示例4: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
public UsageGroup groupUsage(@NotNull Usage usage) {
  if (!(usage instanceof PsiElementUsage)) {
    return null;
  }
  PsiElementUsage elementUsage = (PsiElementUsage)usage;

  PsiElement element = elementUsage.getElement();
  VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);

  if (virtualFile == null) {
    return null;
  }
  ProjectFileIndex fileIndex = ProjectRootManager.getInstance(element.getProject()).getFileIndex();
  boolean isInLib = fileIndex.isInLibraryClasses(virtualFile) || fileIndex.isInLibrarySource(virtualFile);
  if (isInLib) return LIBRARY;
  boolean isInTest = fileIndex.isInTestSourceContent(virtualFile);
  return isInTest ? TEST : PRODUCTION;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:UsageScopeGroupingRule.java


示例5: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
@Nullable
public UsageGroup groupUsage(@NotNull Usage usage) {
  if (usage instanceof UsageInFile) {
    UsageInFile usageInFile = (UsageInFile)usage;
    VirtualFile file = usageInFile.getFile();
    if (file != null) {
      if (file instanceof VirtualFileWindow) {
        file = ((VirtualFileWindow)file).getDelegate();
      }
      VirtualFile dir = file.getParent();
      if (dir == null) return null;
      return getGroupForFile(dir);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DirectoryGroupingRule.java


示例6: appendGroupText

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
private void appendGroupText(final GroupNode node, JPanel panel, Color fileBgColor) {
  UsageGroup group = node == null ? null : node.getGroup();
  if (group == null) return;
  GroupNode parentGroup = (GroupNode)node.getParent();
  appendGroupText(parentGroup, panel, fileBgColor);
  if (node.canNavigateToSource()) {
    SimpleColoredComponent renderer = new SimpleColoredComponent();

    renderer.setIcon(group.getIcon(false));
    SimpleTextAttributes attributes = deriveAttributesWithColor(SimpleTextAttributes.REGULAR_ATTRIBUTES, fileBgColor);
    renderer.append(group.getText(myUsageView), attributes);
    renderer.append(" ", attributes);
    renderer.setIpad(new Insets(0,0,0,0));
    renderer.setBorder(null);
    panel.add(renderer);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ShowUsagesTableCellRenderer.java


示例7: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Nullable
public UsageGroup groupUsage(@NotNull Usage usage) {
    if (usage instanceof UsageInfo2UsageAdapter) {
        final UsageInfo2UsageAdapter u = (UsageInfo2UsageAdapter)usage;
        final UsageInfo usageInfo = u.getUsageInfo();
        if (usageInfo instanceof MoveRenameUsageInfo) {
            final MoveRenameUsageInfo info = (MoveRenameUsageInfo)usageInfo;
            return buildGroup(info.getReferencedElement(), usageInfo, true);
        } else {
            final PsiReference[] references = u.getElement().getReferences();
            for (PsiReference reference : references) {
                if (reference.getRangeInElement().equals(usageInfo.getRangeInElement())) {
                    return buildGroup(reference.resolve(), usageInfo, false);
                }
            }
        }
    }
    return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XsltStuffProvider.java


示例8: buildGroup

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Nullable
private static UsageGroup buildGroup(PsiElement referencedElement, UsageInfo u, boolean mustBeForeign) {
    if (referencedElement instanceof XsltParameter) {
        final XsltParameter parameter = (XsltParameter)referencedElement;
        final PsiElement element = u.getElement();
        if (element == null) return null;
        final XsltTemplate template = XsltCodeInsightUtil.getTemplate(element, false);
        if (template == null) return null;

        final boolean isForeign = XsltCodeInsightUtil.getTemplate(parameter, false) != template;
        if (template.getMatchExpression() != null && (isForeign || !mustBeForeign)) {
            return new TemplateUsageGroup(template);
        }
    }
    return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:XsltStuffProvider.java


示例9: appendUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Nullable
UsageNode appendUsage(@NotNull Usage usage, @NotNull Consumer<Runnable> edtQueue) {
  if (!isVisible(usage)) return null;

  GroupNode lastGroupNode = myRoot;
  for (int i = 0; i < myGroupingRules.length; i++) {
    final UsageGroupingRule rule = myGroupingRules[i];
    final UsageGroup group;
    if (rule instanceof UsageGroupingRuleEx) {
      group = ((UsageGroupingRuleEx) rule).groupUsage(usage, myTargets);
    }
    else {
      group = rule.groupUsage(usage);
    }
    if (group != null) {
      lastGroupNode = lastGroupNode.addGroup(group, i, edtQueue);
    }
  }

  return lastGroupNode.addUsage(usage, edtQueue);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:UsageNodeTreeBuilder.java


示例10: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
public UsageGroup groupUsage(@NotNull Usage usage) {
  if (usage instanceof PsiElementUsage) {
    if (usage instanceof UsageInfo2UsageAdapter) {
      final UsageInfo usageInfo = ((UsageInfo2UsageAdapter)usage).getUsageInfo();
      if (usageInfo.isDynamicUsage()) {
        return DynamicUsageGroup.INSTANCE;
      }
    }
    if (((PsiElementUsage)usage).isNonCodeUsage()) {
      return NonCodeUsageGroup.INSTANCE;
    }
    else {
      return CodeUsageGroup.INSTANCE;
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:NonCodeUsageGroupingRule.java


示例11: getUsageGroupingRule

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Nullable
@Override
public UsageGroupingRule getUsageGroupingRule(Project project)
{
	return new UsageGroupingRule()
	{
		@Nullable
		@Override
		public UsageGroup groupUsage(@NotNull Usage usage)
		{
			if(!(usage instanceof PsiElementUsage))
			{
				return null;
			}
			PsiElement element = ((PsiElementUsage) usage).getElement();

			DotNetTypeDeclaration typeDeclaration = PsiTreeUtil.getParentOfType(element, DotNetTypeDeclaration.class);
			if(typeDeclaration != null)
			{
				return new CSharpBaseGroupingRule<DotNetTypeDeclaration>(typeDeclaration);
			}
			return null;
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:26,代码来源:CSharpTypeGroupRuleProvider.java


示例12: getUsageGroupingRule

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Nullable
@Override
public UsageGroupingRule getUsageGroupingRule(Project project)
{
	return new UsageGroupingRule()
	{
		@Nullable
		@Override
		public UsageGroup groupUsage(@NotNull Usage usage)
		{
			if(!(usage instanceof PsiElementUsage))
			{
				return null;
			}
			PsiElement element = ((PsiElementUsage) usage).getElement();

			DotNetCodeBlockOwner codeBlockOwner = PsiTreeUtil.getParentOfType(element, DotNetCodeBlockOwner.class);
			if(codeBlockOwner != null)
			{
				return new CSharpBaseGroupingRule<DotNetCodeBlockOwner>(codeBlockOwner);
			}
			return null;
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:26,代码来源:CSharpCodeBlockOwnerGroupRuleProvider.java


示例13: appendGroupText

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
private void appendGroupText(final GroupNode node, JPanel panel, Color fileBgColor) {
  UsageGroup group = node == null ? null : node.getGroup();
  if (group == null) return;
  GroupNode parentGroup = (GroupNode) node.getParent();
  appendGroupText(parentGroup, panel, fileBgColor);
  if (node.canNavigateToSource()) {
    SimpleColoredComponent renderer = new SimpleColoredComponent();

    renderer.setIcon(group.getIcon(false));
    SimpleTextAttributes attributes =
        deriveAttributesWithColor(SimpleTextAttributes.REGULAR_ATTRIBUTES, fileBgColor);
    renderer.append(group.getText(myUsageView), attributes);
    renderer.append(" ", attributes);
    renderer.setIpad(new Insets(0, 0, 0, 0));
    renderer.setBorder(null);
    panel.add(renderer);
  }
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:19,代码来源:ShowUsagesTableCellRenderer.java


示例14: appendUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
UsageNode appendUsage(@Nonnull Usage usage, @Nonnull Consumer<Node> edtInsertedUnderQueue, boolean filterDuplicateLines) {
  if (!isVisible(usage)) return null;

  final boolean dumb = DumbService.isDumb(myProject);

  GroupNode groupNode = myRoot;
  for (int i = 0; i < myGroupingRules.length; i++) {
    UsageGroupingRule rule = myGroupingRules[i];
    if (dumb && !DumbService.isDumbAware(rule)) continue;

    List<UsageGroup> groups = rule.getParentGroupsFor(usage, myTargets);
    for (UsageGroup group : groups) {
      groupNode = groupNode.addOrGetGroup(group, i, edtInsertedUnderQueue);
    }
  }

  return groupNode.addUsage(usage, edtInsertedUnderQueue, filterDuplicateLines);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:UsageNodeTreeBuilder.java


示例15: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
public UsageGroup groupUsage(@Nonnull Usage usage) {
  if (usage instanceof UsageInModule) {
    UsageInModule usageInModule = (UsageInModule)usage;
    Module module = usageInModule.getModule();
    if (module != null) return new ModuleUsageGroup(module);
  }

  if (usage instanceof UsageInLibrary) {
    UsageInLibrary usageInLibrary = (UsageInLibrary)usage;
    OrderEntry entry = usageInLibrary.getLibraryEntry();
    if (entry != null) return new LibraryUsageGroup(entry);
  }

  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ModuleGroupingRule.java


示例16: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
public UsageGroup groupUsage(@Nonnull Usage usage) {
  if (!(usage instanceof PsiElementUsage)) {
    return null;
  }
  PsiElementUsage elementUsage = (PsiElementUsage)usage;

  PsiElement element = elementUsage.getElement();
  VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);

  if (virtualFile == null) {
    return null;
  }
  ProjectFileIndex fileIndex = ProjectRootManager.getInstance(element.getProject()).getFileIndex();
  boolean isInLib = fileIndex.isInLibraryClasses(virtualFile) || fileIndex.isInLibrarySource(virtualFile);
  if (isInLib) return LIBRARY;
  boolean isInTest = fileIndex.isInTestSourceContent(virtualFile);
  return isInTest ? TEST : PRODUCTION;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:UsageScopeGroupingRule.java


示例17: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
@Nullable
public UsageGroup groupUsage(@Nonnull Usage usage) {
  if (usage instanceof UsageInFile) {
    UsageInFile usageInFile = (UsageInFile)usage;
    VirtualFile file = usageInFile.getFile();
    if (file != null) {
      if (file instanceof VirtualFileWindow) {
        file = ((VirtualFileWindow)file).getDelegate();
      }
      VirtualFile dir = file.getParent();
      if (dir == null) return null;
      return getGroupForFile(dir);
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:DirectoryGroupingRule.java


示例18: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
public UsageGroup groupUsage(@Nonnull Usage usage) {
  if (usage instanceof UsageInFile) {
    VirtualFile file = ((UsageInFile)usage).getFile();
    if (file != null) {
      if (GeneratedSourcesFilter.isGenerated(myProject, file)) {
        return UsageInGeneratedCodeGroup.INSTANCE;
      }
    }
  }
  if (usage instanceof PsiElementUsage) {
    if (usage instanceof UsageInfo2UsageAdapter) {
      final UsageInfo usageInfo = ((UsageInfo2UsageAdapter)usage).getUsageInfo();
      if (usageInfo.isDynamicUsage()) {
        return DynamicUsageGroup.INSTANCE;
      }
    }
    if (((PsiElementUsage)usage).isNonCodeUsage()) {
      return NonCodeUsageGroup.INSTANCE;
    }
    else {
      return CodeUsageGroup.INSTANCE;
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:NonCodeUsageGroupingRule.java


示例19: compareTo

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
public int compareTo(UsageGroup usageGroup) {
  if (!(usageGroup instanceof MethodUsageGroup)) {
    LOG.error("MethodUsageGroup expected but " + usageGroup.getClass() + " found");
  }
  MethodUsageGroup other = (MethodUsageGroup)usageGroup;
  if (SmartPointerManager.getInstance(myProject).pointToTheSameElement(myMethodPointer, other.myMethodPointer)) {
    return 0;
  }
  if (!UsageViewSettings.getInstance().IS_SORT_MEMBERS_ALPHABETICALLY) {
    Segment segment1 = myMethodPointer.getRange();
    Segment segment2 = other.myMethodPointer.getRange();
    if (segment1 != null && segment2 != null) {
      return segment1.getStartOffset() - segment2.getStartOffset();
    }
  }

  return myName.compareToIgnoreCase(other.myName);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:MethodGroupingRule.java


示例20: groupUsage

import com.intellij.usages.UsageGroup; //导入依赖的package包/类
@Override
public UsageGroup groupUsage(@NotNull Usage usage) {
  final FileUsageGroup usageGroup = (FileUsageGroup)super.groupUsage(usage);
  if (usageGroup != null) {
    final PsiFile psiFile = usageGroup.getPsiFile();
    if (psiFile instanceof PsiJavaFile && !(psiFile instanceof ServerPageFile)) {
      return null;
    }
  }
  return usageGroup;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:NonJavaFileGroupingRule.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractUrlHandlerMapping类代码示例发布时间:2022-05-22
下一篇:
Java Column类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap