当前位置: 首页>>代码示例>>Java>>正文


Java FoldingDescriptor.EMPTY属性代码示例

本文整理汇总了Java中com.intellij.lang.folding.FoldingDescriptor.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java FoldingDescriptor.EMPTY属性的具体用法?Java FoldingDescriptor.EMPTY怎么用?Java FoldingDescriptor.EMPTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.lang.folding.FoldingDescriptor的用法示例。


在下文中一共展示了FoldingDescriptor.EMPTY属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFoldRegions

@NotNull
@Override
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
  if (!(root instanceof PsiJavaFile) || quick || !JavaCodeFoldingSettings.getInstance().isCollapseSuppressWarnings()) {
    return FoldingDescriptor.EMPTY;
  }
  if (!PsiUtil.isLanguageLevel5OrHigher(root)) {
    return FoldingDescriptor.EMPTY;
  }
  final List<FoldingDescriptor> result = new ArrayList<FoldingDescriptor>();
  root.accept(new JavaRecursiveElementWalkingVisitor(){
    @Override
    public void visitAnnotation(PsiAnnotation annotation) {
      if (Comparing.strEqual(annotation.getQualifiedName(), SuppressWarnings.class.getName())) {
        result.add(new FoldingDescriptor(annotation, annotation.getTextRange()));
      }
      super.visitAnnotation(annotation);
    }
  });
  return result.toArray(new FoldingDescriptor[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SuppressWarningsFoldingBuilder.java

示例2: buildFoldRegions

@NotNull
@Override
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
    if (!(root instanceof XQueryFile)) return FoldingDescriptor.EMPTY;
    XQueryFile file = (XQueryFile) root;
    List<FoldingDescriptor> descriptorList = new ArrayList<FoldingDescriptor>();


    updateImportFoldingDescriptors(descriptorList, new ArrayList<XQueryPsiElement>(file.getModuleImports()));
    updateImportFoldingDescriptors(descriptorList, new ArrayList<XQueryPsiElement>(file.getNamespaceDeclarations()));

    for (XQueryFunctionDecl function : file.getFunctionDeclarations()) {
        final XQueryFunctionBody functionBody = function.getFunctionBody();
        if (functionBody != null && functionBody.getTextLength() > 2) {
            descriptorList.add(new FoldingDescriptor(function, functionBody.getTextRange()));
        }
    }

    return descriptorList.toArray(new FoldingDescriptor[descriptorList.size()]);
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:20,代码来源:XQueryFoldingBuilder.java

示例3: buildFoldRegions

@Override
@NotNull
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement element, @NotNull Document document, boolean quick)
{
	if(!(element instanceof PsiJavaFile) || quick || !isFoldingsOn())
	{
		return FoldingDescriptor.EMPTY;
	}
	final PsiJavaFile file = (PsiJavaFile) element;
	final Project project = file.getProject();
	final List<FoldingDescriptor> result = new ArrayList<FoldingDescriptor>();
	//hack here because JspFile PSI elements are not threaded correctly via nextSibling/prevSibling
	file.accept(new JavaRecursiveElementWalkingVisitor()
	{
		@Override
		public void visitLiteralExpression(PsiLiteralExpression expression)
		{
			checkLiteral(project, expression, result);
		}
	});

	return result.toArray(new FoldingDescriptor[result.size()]);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:PropertyFoldingBuilder.java

示例4: buildFoldRegions

@Override
@NotNull
public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) {
  final PsiElement psiElement = node.getPsi();
  XmlDocument xmlDocument = null;

  if (psiElement instanceof XmlFile) {
    XmlFile file = (XmlFile)psiElement;
    xmlDocument = file.getDocument();
  }
  else if (psiElement instanceof XmlDocument) {
    xmlDocument = (XmlDocument)psiElement;
  }

  XmlElement rootTag = xmlDocument == null ? null : xmlDocument.getRootTag();
  if (rootTag == null) {
    rootTag = xmlDocument;
  }
  List<FoldingDescriptor> foldings = null;

  if (rootTag != null) {
    foldings = new ArrayList<FoldingDescriptor>();

    doAddForChildren(xmlDocument, foldings, document);
  }

  return foldings != null ? foldings.toArray(new FoldingDescriptor[foldings.size()]):FoldingDescriptor.EMPTY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:XmlCodeFoldingBuilder.java

示例5: buildFoldRegions

@Override
@NotNull
public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) {

  final ArrayList<FoldingDescriptor> regions = new ArrayList<FoldingDescriptor>();
  process(node, document, regions);

  return regions.size() > 0
          ? regions.toArray(new FoldingDescriptor[regions.size()])
          : FoldingDescriptor.EMPTY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:RncFoldingBuilder.java

示例6: buildFoldRegions

@NotNull
@Override
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
    if (!(root instanceof CMakeFile)) return FoldingDescriptor.EMPTY;
    CMakeFile file = (CMakeFile) root;
    
    final List<FoldingDescriptor> result = ContainerUtil.newArrayList();

    if (!quick) {
        // Add condition to check if tokens pair
        PsiTreeUtil.processElements(file, new PsiElementProcessor() {
            @Override
            public boolean execute(@NotNull PsiElement element) {
                if (TokenSet.create(CMakeTypes.LINE_COMMENT,
                        CMakeTypes.BRACKET_COMMENT,
                        CMakeTypes.COMPOUND_EXPR,
                        CMakeTypes.PREDICATE_EXPR
                ).contains(element.getNode().getElementType()) && element.getTextRange().getLength() > 2) {
                    result.add(new FoldingDescriptor(element, element.getTextRange()));
                }
                return true;
            }
        });
    }

    return result.toArray(new FoldingDescriptor[result.size()]);
}
 
开发者ID:dubrousky,项目名称:CMaker,代码行数:27,代码来源:CMakeFoldingBuilder.java

示例7: buildFoldRegions

@NotNull
public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) {
  final PsiElement psiElement = node.getPsi();
  XmlDocument xmlDocument = null;

  if (psiElement instanceof XmlFile) {
    XmlFile file = (XmlFile)psiElement;
    xmlDocument = file.getDocument();
  }
  else if (psiElement instanceof XmlDocument) {
    xmlDocument = (XmlDocument)psiElement;
  }

  XmlElement rootTag = xmlDocument == null ? null : xmlDocument.getRootTag();
  if (rootTag == null) {
    rootTag = xmlDocument;
  }
  List<FoldingDescriptor> foldings = null;

  if (rootTag != null) {
    foldings = new ArrayList<FoldingDescriptor>();

    doAddForChildren(xmlDocument, foldings, document);
  }

  return foldings != null ? foldings.toArray(new FoldingDescriptor[foldings.size()]):FoldingDescriptor.EMPTY;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:XmlCodeFoldingBuilder.java

示例8: buildFoldRegions

@NotNull
public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) {

  final ArrayList<FoldingDescriptor> regions = new ArrayList<FoldingDescriptor>();
  process(node, document, regions);

  return regions.size() > 0
          ? regions.toArray(new FoldingDescriptor[regions.size()])
          : FoldingDescriptor.EMPTY;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:RncFoldingBuilder.java

示例9: buildFoldRegions

@RequiredReadAction
@NotNull
@Override
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick)
{
	// build by CSharpFoldingBuilder
	return FoldingDescriptor.EMPTY;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:8,代码来源:CSharpDocFoldingBuilder.java

示例10: buildFoldRegions

@Override
@NotNull
public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) {

  final ArrayList<FoldingDescriptor> regions = new ArrayList<>();
  process(node, document, regions);

  return regions.size() > 0
          ? regions.toArray(new FoldingDescriptor[regions.size()])
          : FoldingDescriptor.EMPTY;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:11,代码来源:RncFoldingBuilder.java

示例11: buildFoldRegions

@NotNull
public FoldingDescriptor[] buildFoldRegions(@NotNull final ASTNode node, @NotNull final Document document) {
    final PsiElement element = node.getPsi();
    if (!(element instanceof VtlFile)) {
        return FoldingDescriptor.EMPTY;
    }
    List<FoldingDescriptor> descriptors = new ArrayList<FoldingDescriptor>();
    for (VtlDirective composite : ((VtlFile) element).getDirectiveChildren()) {
        addFoldingDescriptors(descriptors, composite);
    }
    return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:12,代码来源:VtlFoldingBuilder.java


注:本文中的com.intellij.lang.folding.FoldingDescriptor.EMPTY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。