本文整理汇总了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()]);
}
示例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()]);
}
示例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()]);
}
示例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;
}
示例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;
}
示例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()]);
}
示例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;
}
示例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;
}
示例9: buildFoldRegions
@RequiredReadAction
@NotNull
@Override
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick)
{
// build by CSharpFoldingBuilder
return FoldingDescriptor.EMPTY;
}
示例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;
}
示例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()]);
}