use of com.perl5.lang.perl.idea.structureView.elements.PerlStructureViewElement in project Perl5-IDEA by Camelcade.
the class PerlAttributeGrouper method group.
@NotNull
@Override
public Collection<Group> group(@NotNull AbstractTreeNode parent, @NotNull Collection<TreeElement> children) {
if (children.isEmpty() || parent instanceof GroupWrapper && ((GroupWrapper) parent).getValue() instanceof AttributeGroup) {
return Collections.emptyList();
}
Map<PerlMooseAttributeWrapper, AttributeGroup> groupMap = FactoryMap.create(AttributeGroup::new);
for (TreeElement childTreeElement : children) {
if (!(childTreeElement instanceof PerlStructureViewElement)) {
continue;
}
Object value = ((PerlStructureViewElement) childTreeElement).getValue();
if (!(value instanceof PerlLightMethodDefinitionElement)) {
continue;
}
PsiElement delegate = ((PerlLightMethodDefinitionElement) value).getDelegate();
if (!(delegate instanceof PerlMooseAttributeWrapper)) {
continue;
}
groupMap.get(delegate).addChild(childTreeElement);
}
return new ArrayList<>(groupMap.values());
}
Aggregations