Java Code Examples for com.intellij.ide.structureView.StructureViewTreeElement#getValue()

The following examples show how to use com.intellij.ide.structureView.StructureViewTreeElement#getValue() . 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: GotoClassAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private static StructureViewTreeElement findElement(StructureViewTreeElement node, PsiElement element, int hopes) {
  final Object value = node.getValue();
  if (value instanceof PsiElement) {
    if (((PsiElement)value).isEquivalentTo(element)) return node;
    if (hopes != 0) {
      for (TreeElement child : node.getChildren()) {
        if (child instanceof StructureViewTreeElement) {
          final StructureViewTreeElement e = findElement((StructureViewTreeElement)child, element, hopes - 1);
          if (e != null) {
            return e;
          }
        }
      }
    }
  }
  return null;
}
 
Example 2
Source File: ProtoStructureViewModel.java    From protobuf-jetbrains-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isAlwaysLeaf(StructureViewTreeElement element) {
    Object value = element.getValue();
    return value instanceof RpcMethodNode
            || value instanceof EnumConstantNode
            || value instanceof FieldNode;
}
 
Example 3
Source File: CustomRegionTreeElement.java    From consulo with Apache License 2.0 5 votes vote down vote up
public boolean containsElement(StructureViewTreeElement element) {
  Object o = element.getValue();
  if (o instanceof PsiElement) {
    TextRange elementRange = ((PsiElement)o).getTextRange();
    if (elementRange.getStartOffset() >= myStartElement.getTextRange().getStartOffset() && elementRange.getEndOffset() <= myEndOffset) {
      return true;
    }
  }
  return false;
}
 
Example 4
Source File: StructureViewCompositeModel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isAutoExpand(@Nonnull StructureViewTreeElement element) {
  if (element.getValue() instanceof StructureViewComposite.StructureViewDescriptor) return true;
  for (ExpandInfoProvider p : getModels().filter(ExpandInfoProvider.class)) {
    if (p.isAutoExpand(element)) return true;
  }
  return false;
}
 
Example 5
Source File: ProtoStructureViewModel.java    From protobuf-jetbrains-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAlwaysShowsPlus(StructureViewTreeElement element) {
    Object value = element.getValue();
    return value instanceof ProtoPsiFileRoot;
}
 
Example 6
Source File: BuildStructureViewModel.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAlwaysShowsPlus(StructureViewTreeElement element) {
  final Object value = element.getValue();
  return value instanceof BuildFile;
}
 
Example 7
Source File: BuildStructureViewModel.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAlwaysLeaf(StructureViewTreeElement element) {
  return element.getValue() instanceof TargetExpression;
}
 
Example 8
Source File: BuildStructureViewModel.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAutoExpand(StructureViewTreeElement element) {
  return element.getValue() instanceof PsiFile;
}
 
Example 9
Source File: SampleStructureViewModel.java    From jetbrains-plugin-sample with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean isAlwaysShowsPlus(StructureViewTreeElement element) {
	Object value = element.getValue();
 		return value instanceof SamplePSIFileRoot;
}
 
Example 10
Source File: CSharpStructureViewModel.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAlwaysShowsPlus(StructureViewTreeElement structureViewTreeElement)
{
	Object value = structureViewTreeElement.getValue();
	return value instanceof CSharpFile || value instanceof CSharpTypeDeclaration;
}
 
Example 11
Source File: HaxeStructureViewModel.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAlwaysLeaf(StructureViewTreeElement element) {
  final Object value = element.getValue();
  return value instanceof HaxeNamedComponent && !(value instanceof HaxeClass);
}
 
Example 12
Source File: ANTLRv4StructureViewModel.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean isAlwaysShowsPlus(StructureViewTreeElement element) {
	Object value = element.getValue();
 		return value instanceof ANTLRv4FileRoot;
}
 
Example 13
Source File: ANTLRv4StructureViewModel.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean isAlwaysLeaf(StructureViewTreeElement element) {
	Object value = element.getValue();
	return value instanceof ParserRuleSpecNode || value instanceof LexerRuleSpecNode;
}
 
Example 14
Source File: ThriftStructureViewModel.java    From intellij-thrift with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAlwaysLeaf(StructureViewTreeElement element) {
  final Object value = element.getValue();
  return value instanceof ThriftSubDeclaration;
}