@@ -68,11 +68,13 @@ class EditorFragment(private val project: Project, private val editor: EditorEx,
68
68
val lineHeight = editor.lineHeight
69
69
val insets = editor.scrollPane.getInsets()
70
70
val height = lineHeight * editorLineThreshold + insets.height
71
+
71
72
var editorMaxHeight = height + expandCollapseTextLabel.preferredSize.height + getInsets().height
72
- val it = editor.headerComponent
73
- if (it != null ) {
74
- editorMaxHeight + = it .getPreferredSize().height
73
+ val header = editor.headerComponent
74
+ if (header != null ) {
75
+ editorMaxHeight + = header .getPreferredSize().height
75
76
}
77
+
76
78
return Dimension (preferredSize.width, editorMaxHeight)
77
79
}
78
80
@@ -83,7 +85,7 @@ class EditorFragment(private val project: Project, private val editor: EditorEx,
83
85
content.setBorder(
84
86
JBUI .Borders .compound(
85
87
JBUI .Borders .empty(10 , 0 ),
86
- JBUI .Borders .customLine(JBColor (13949150 , 4740710 ))
88
+ JBUI .Borders .customLine(JBColor (0xD4E1570 , 0x474071 ))
87
89
)
88
90
)
89
91
content.setOpaque(false )
@@ -96,12 +98,12 @@ class EditorFragment(private val project: Project, private val editor: EditorEx,
96
98
override fun mouseClicked (e : MouseEvent ? ) {
97
99
setCollapsed(! getCollapsed())
98
100
}
99
- } as MouseListener )
101
+ })
100
102
}
101
103
102
- fun getCollapsed (): Boolean {
103
- return collapsed
104
- }
104
+ fun getContent (): JComponent = content
105
+
106
+ fun getCollapsed (): Boolean = collapsed
105
107
106
108
fun setCollapsed (value : Boolean ) {
107
109
collapsed = value
@@ -111,18 +113,8 @@ class EditorFragment(private val project: Project, private val editor: EditorEx,
111
113
fun updateExpandCollapseLabel () {
112
114
val linesCount = editor.document.lineCount
113
115
expandCollapseTextLabel.isVisible = linesCount > editorLineThreshold
114
- if (collapsed) {
115
- expandCollapseTextLabel.text = " More lines"
116
- expandCollapseTextLabel.icon = AllIcons .General .ChevronDown
117
- return
118
- }
119
-
120
- expandCollapseTextLabel.text = " "
121
- expandCollapseTextLabel.icon = AllIcons .General .ChevronUp
122
- }
123
-
124
- fun getContent (): JComponent {
125
- return content
116
+ expandCollapseTextLabel.text = if (collapsed) " More lines" else " "
117
+ expandCollapseTextLabel.icon = if (collapsed) AllIcons .General .ChevronDown else AllIcons .General .ChevronUp
126
118
}
127
119
}
128
120
0 commit comments