本文整理汇总了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;未经允许,请勿转载。 |
请发表评论