Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jetbrains-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
jetbrains-plugin
Merge requests
!6
Resolve "Folding Empty Aspects"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Folding Empty Aspects"
bugfix/folding-empty-aspects
into
develop
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
Johannes Mey
requested to merge
bugfix/folding-empty-aspects
into
develop
3 years ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
Closes
#12 (closed)
Edited
3 years ago
by
Johannes Mey
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
6c605dee
1 commit,
3 years ago
1 file
+
25
−
15
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/main/java/org/jastadd/tooling/aspect/AspectFoldingBuilder.java
+
25
−
15
Options
@@ -24,33 +24,43 @@ public class AspectFoldingBuilder extends FoldingBuilderEx {
List
<
FoldingDescriptor
>
descriptors
=
new
ArrayList
<>();
Collection
<
JastAddAspectAspectDeclaration
>
aspectDeclarations
=
PsiTreeUtil
.
findChildrenOfType
(
root
,
JastAddAspectAspectDeclaration
.
class
);
for
(
final
JastAddAspectAspectDeclaration
aspectDeclaration
:
aspectDeclarations
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
aspectDeclaration
.
getNode
(),
new
TextRange
(
aspectDeclaration
.
getAspectBody
().
getTextRange
().
getStartOffset
()
+
1
,
aspectDeclaration
.
getAspectBody
().
getTextRange
().
getEndOffset
()
-
1
)));
if
(
aspectDeclaration
.
getAspectBody
().
getTextRange
().
getLength
()
>
2
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
aspectDeclaration
.
getNode
(),
new
TextRange
(
aspectDeclaration
.
getAspectBody
().
getTextRange
().
getStartOffset
()
+
1
,
aspectDeclaration
.
getAspectBody
().
getTextRange
().
getEndOffset
()
-
1
)));
}
}
Collection
<
JastAddAspectClassDeclaration
>
classDeclarations
=
PsiTreeUtil
.
findChildrenOfType
(
root
,
JastAddAspectClassDeclaration
.
class
);
for
(
final
JastAddAspectClassDeclaration
classDeclaration
:
classDeclarations
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
classDeclaration
.
getNode
(),
new
TextRange
(
classDeclaration
.
getClassBody
().
getTextRange
().
getStartOffset
()
+
1
,
classDeclaration
.
getClassBody
().
getTextRange
().
getEndOffset
()
-
1
)));
if
(
classDeclaration
.
getClassBody
().
getTextRange
().
getLength
()
>
2
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
classDeclaration
.
getNode
(),
new
TextRange
(
classDeclaration
.
getClassBody
().
getTextRange
().
getStartOffset
()
+
1
,
classDeclaration
.
getClassBody
().
getTextRange
().
getEndOffset
()
-
1
)));
}
}
Collection
<
JastAddAspectEnumBody
>
enumBodies
=
PsiTreeUtil
.
findChildrenOfType
(
root
,
JastAddAspectEnumBody
.
class
);
for
(
final
JastAddAspectEnumBody
enumBody
:
enumBodies
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
enumBody
.
getNode
(),
new
TextRange
(
enumBody
.
getTextRange
().
getStartOffset
()
+
1
,
enumBody
.
getTextRange
().
getEndOffset
()
-
1
)));
if
(
enumBody
.
getTextRange
().
getLength
()
>
2
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
enumBody
.
getNode
(),
new
TextRange
(
enumBody
.
getTextRange
().
getStartOffset
()
+
1
,
enumBody
.
getTextRange
().
getEndOffset
()
-
1
)));
}
}
Collection
<
JastAddAspectAnnotationTypeBody
>
annotationTypeBodies
=
PsiTreeUtil
.
findChildrenOfType
(
root
,
JastAddAspectAnnotationTypeBody
.
class
);
for
(
final
JastAddAspectAnnotationTypeBody
annotationTypeBody
:
annotationTypeBodies
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
annotationTypeBody
.
getNode
(),
new
TextRange
(
annotationTypeBody
.
getTextRange
().
getStartOffset
()
+
1
,
annotationTypeBody
.
getTextRange
().
getEndOffset
()
-
1
)));
if
(
annotationTypeBody
.
getTextRange
().
getLength
()
>
2
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
annotationTypeBody
.
getNode
(),
new
TextRange
(
annotationTypeBody
.
getTextRange
().
getStartOffset
()
+
1
,
annotationTypeBody
.
getTextRange
().
getEndOffset
()
-
1
)));
}
}
Collection
<
JastAddAspectBlock
>
aspectBlocks
=
PsiTreeUtil
.
findChildrenOfType
(
root
,
JastAddAspectBlock
.
class
);
for
(
final
JastAddAspectBlock
block
:
aspectBlocks
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
block
.
getNode
(),
new
TextRange
(
block
.
getTextRange
().
getStartOffset
()
+
1
,
block
.
getTextRange
().
getEndOffset
()
-
1
)));
if
(
block
.
getTextRange
().
getLength
()
>
2
)
{
descriptors
.
add
(
new
FoldingDescriptor
(
block
.
getNode
(),
new
TextRange
(
block
.
getTextRange
().
getStartOffset
()
+
1
,
block
.
getTextRange
().
getEndOffset
()
-
1
)));
}
}
return
descriptors
.
toArray
(
new
FoldingDescriptor
[
0
]);
}
Loading