本文整理汇总了Java中com.intellij.usages.UsageGroup类的典型用法代码示例。如果您正苦于以下问题:Java UsageGroup类的具体用法?Java UsageGroup怎么用?Java UsageGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UsageGroup类属于com.intellij.usages包,在下文中一共展示了UsageGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
};
}
示例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;
}
};
}
示例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);
}
}
示例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);
}
示例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;
}