Java Code Examples for com.intellij.usages.impl.UsageNode#getUsage()
The following examples show how to use
com.intellij.usages.impl.UsageNode#getUsage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShowUsagesAction.java From dagger-intellij-plugin with Apache License 2.0 | 6 votes |
@Override public int compare(UsageNode c1, UsageNode c2) { if (c1 instanceof StringNode) return 1; if (c2 instanceof StringNode) return -1; Usage o1 = c1.getUsage(); Usage o2 = c2.getUsage(); if (o1 == MORE_USAGES_SEPARATOR) return 1; if (o2 == MORE_USAGES_SEPARATOR) return -1; VirtualFile v1 = UsageListCellRenderer.getVirtualFile(o1); VirtualFile v2 = UsageListCellRenderer.getVirtualFile(o2); String name1 = v1 == null ? null : v1.getName(); String name2 = v2 == null ? null : v2.getName(); int i = Comparing.compare(name1, name2); if (i != 0) return i; if (o1 instanceof Comparable && o2 instanceof Comparable) { return ((Comparable) o1).compareTo(o2); } FileEditorLocation loc1 = o1.getLocation(); FileEditorLocation loc2 = o2.getLocation(); return Comparing.compare(loc1, loc2); }
Example 2
Source File: ShowUsagesAction.java From otto-intellij-plugin with Apache License 2.0 | 6 votes |
@Override public int compare(UsageNode c1, UsageNode c2) { if (c1 instanceof StringNode) return 1; if (c2 instanceof StringNode) return -1; Usage o1 = c1.getUsage(); Usage o2 = c2.getUsage(); if (o1 == MORE_USAGES_SEPARATOR) return 1; if (o2 == MORE_USAGES_SEPARATOR) return -1; VirtualFile v1 = UsageListCellRenderer.getVirtualFile(o1); VirtualFile v2 = UsageListCellRenderer.getVirtualFile(o2); String name1 = v1 == null ? null : v1.getName(); String name2 = v2 == null ? null : v2.getName(); int i = Comparing.compare(name1, name2); if (i != 0) return i; if (o1 instanceof Comparable && o2 instanceof Comparable) { return ((Comparable)o1).compareTo(o2); } FileEditorLocation loc1 = o1.getLocation(); FileEditorLocation loc2 = o2.getLocation(); return Comparing.compare(loc1, loc2); }
Example 3
Source File: ShowUsagesAction.java From dagger-intellij-plugin with Apache License 2.0 | 5 votes |
private void addUsageNodes(@NotNull GroupNode root, @NotNull final UsageViewImpl usageView, @NotNull List<UsageNode> outNodes) { for (UsageNode node : root.getUsageNodes()) { Usage usage = node.getUsage(); if (usageView.isVisible(usage)) { node.setParent(root); outNodes.add(node); } } for (GroupNode groupNode : root.getSubGroups()) { groupNode.setParent(root); addUsageNodes(groupNode, usageView, outNodes); } }
Example 4
Source File: ShowUsagesAction.java From dagger-intellij-plugin with Apache License 2.0 | 5 votes |
@Override protected String getElementText(@NotNull Object element) { if (!(element instanceof UsageNode)) return element.toString(); UsageNode node = (UsageNode) element; if (node instanceof StringNode) return ""; Usage usage = node.getUsage(); if (usage == MORE_USAGES_SEPARATOR) return ""; GroupNode group = (GroupNode) node.getParent(); return usage.getPresentation().getPlainText() + group; }
Example 5
Source File: ShowUsagesAction.java From otto-intellij-plugin with Apache License 2.0 | 5 votes |
private void addUsageNodes(@NotNull GroupNode root, @NotNull final UsageViewImpl usageView, @NotNull List<UsageNode> outNodes) { for (UsageNode node : root.getUsageNodes()) { Usage usage = node.getUsage(); if (usageView.isVisible(usage)) { node.setParent(root); outNodes.add(node); } } for (GroupNode groupNode : root.getSubGroups()) { groupNode.setParent(root); addUsageNodes(groupNode, usageView, outNodes); } }
Example 6
Source File: ShowUsagesAction.java From otto-intellij-plugin with Apache License 2.0 | 5 votes |
@Override protected String getElementText(@NotNull Object element) { if (!(element instanceof UsageNode)) return element.toString(); UsageNode node = (UsageNode)element; if (node instanceof StringNode) return ""; Usage usage = node.getUsage(); if (usage == MORE_USAGES_SEPARATOR) return ""; GroupNode group = (GroupNode)node.getParent(); return usage.getPresentation().getPlainText() + group; }