• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / MooseIDE / 17938860495

23 Sep 2025 07:28AM UTC coverage: 66.75% (+0.4%) from 66.37%
17938860495

push

github

web-flow
Merge pull request #1423 from moosetechnology/a-good-cleaning

New settings implementation

2683 of 3100 new or added lines in 117 files covered. (86.55%)

105 existing lines in 29 files now uncovered.

20400 of 30562 relevant lines covered (66.75%)

1.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.1
/src/MooseIDE-Famix/MiSourceTextBrowserModel.class.st
1
"
2
I am a model for the SourceTextBrowser
3

4
I take care of getting the source code for an entity and ""formatting"" it (actually finding where to apply formats: the highlights)
5

6
I also keep the displayedEntity and the selectedEntity (in the source code) if any
7
"
8
Class {
9
        #name : 'MiSourceTextBrowserModel',
10
        #superclass : 'MiAbstractModel',
11
        #instVars : [
12
                'displayedText',
13
                'highlights',
14
                'shouldHighlightChildren',
15
                'entity'
16
        ],
17
        #category : 'MooseIDE-Famix-SourceText',
18
        #package : 'MooseIDE-Famix',
19
        #tag : 'SourceText'
20
}
21

22
{ #category : 'accessing' }
23
MiSourceTextBrowserModel class >> defaultConfiguration [
2✔
24

2✔
25
        ^ MiSourceTextSettingsConfiguration new
2✔
26
                  shouldHighlightChildren: self defaultShouldHighlightChildren;
2✔
27
                  yourself
2✔
28
]
2✔
29

30
{ #category : 'as yet unclassified' }
31
MiSourceTextBrowserModel class >> defaultShouldHighlightChildren [
2✔
32

2✔
33
        ^ true
2✔
34
]
2✔
35

36
{ #category : 'accessing' }
37
MiSourceTextBrowserModel >> addHighlight: aSourceTextHighlight [
2✔
38
        highlights add: aSourceTextHighlight
2✔
39
]
2✔
40

41
{ #category : 'highlights' }
42
MiSourceTextBrowserModel >> commentHighlightFor: aComment [
2✔
43

2✔
44
        self addHighlight: (MiSourceTextCommentHighlight new
2✔
45
                highlightedEntity: aComment ;
2✔
46
                yourself)
2✔
47

2✔
48
]
2✔
49

50
{ #category : 'highlights' }
51
MiSourceTextBrowserModel >> createHighlightsFor: anEntity [
2✔
52

2✔
53
        (anEntity class usesFamixTrait: FamixTComment)
2✔
54
        ifTrue: [
2✔
55
                self commentHighlightFor: anEntity.
2✔
56
                ^self
2✔
57
        ].
2✔
58

2✔
59
        (anEntity class usesFamixTrait: FamixTNamedEntity)
2✔
60
        ifTrue: [
2✔
61
                self identifierHighlightFor: anEntity
2✔
62
        ].
2✔
63

2✔
64
        anEntity children do: [ :childChild |
2✔
65
                self createHighlightsFor: childChild ].
2✔
66

2✔
67
        (anEntity tags size = 1) ifTrue: [
2✔
68
                self tagHighlight: anEntity tags anyOne for: anEntity ].
2✔
69

2✔
70
        "aChildEntity queryAllOutgoing do: [:mseAssoc |
2✔
71
                mseAssoc allTargets do: [ :target |         self addHighlight: (self dependencyHighlightFor: mseAssoc) ]
2✔
72
        ]."
2✔
73
]
2✔
74

75
{ #category : 'highlights' }
76
MiSourceTextBrowserModel >> createKeywordHighlights [
2✔
77
        "search for all sourceLanguage keywords in the displayedText and highlight them
2✔
78
        There are several guard conditions because this feature is work in progress and
2✔
79
        not all language implement it"
2✔
80

2✔
81
        self selectedEntity mooseModel
2✔
82
        ifNotNil: [ :mooseModel |
2✔
83
                mooseModel sourceLanguage
2✔
84
                ifNotNil: [ :sourceLanguage |
2✔
85
                        sourceLanguage languageKeyWords do: [ :kw || matcher |
2✔
86
                                matcher := RxMatcher forString: ('\W' , kw , '\W').
2✔
87
                                (matcher matchingRangesIn: self displayedText) do: [ :range |
2✔
88
                                        self keywordHighlightInterval: (range first + 1 to: range last - 1)
2✔
89
                                ]
2✔
90
                        ]
2✔
91
                ]
2✔
92
        ]
2✔
93
]
2✔
94

95
{ #category : 'settings management' }
96
MiSourceTextBrowserModel >> currentConfiguration [
2✔
97

2✔
98
        ^ MiSourceTextSettingsConfiguration new
2✔
99
                  shouldHighlightChildren: shouldHighlightChildren;
2✔
100
                  yourself
2✔
101
]
2✔
102

103
{ #category : 'settings management' }
104
MiSourceTextBrowserModel >> defaultConfiguration [
2✔
105

2✔
106
        ^ self class defaultConfiguration
2✔
107
]
2✔
108

109
{ #category : 'accessing' }
110
MiSourceTextBrowserModel >> displayedEntity: anEntity [
2✔
111

2✔
112
        self selectedEntity: anEntity.
2✔
113

2✔
114
        self resetHighlights.
2✔
115
        self prepareFormating.
2✔
116
        browser renderTextFor: anEntity
2✔
117
]
2✔
118

119
{ #category : 'accessing' }
120
MiSourceTextBrowserModel >> displayedText [
2✔
121
        ^displayedText
2✔
122
]
2✔
123

124
{ #category : 'accessing' }
125
MiSourceTextBrowserModel >> entities [
2✔
126

2✔
127
        ^ entity ifNil: [ #(  ) ] ifNotNil: [ { entity } ]
2✔
128
]
2✔
129

130
{ #category : 'accessing' }
NEW
131
MiSourceTextBrowserModel >> entity: anEntity [
×
UNCOV
132
]
×
133

134
{ #category : 'highlights' }
135
MiSourceTextBrowserModel >> errorHighlightInterval: anInterval [
2✔
136

2✔
137
        self addHighlight: (MiSourceTextErrorHighlight new
2✔
138
                highlightInterval: anInterval ;
2✔
139
                yourself)
2✔
140

2✔
141
]
2✔
142

143
{ #category : 'actions' }
144
MiSourceTextBrowserModel >> event: aMouseEvent selectedEntity: anEntity [
×
145

×
146
        self selectedEntity: anEntity.
×
147

×
148
        aMouseEvent controlKeyPressed
×
149
                ifTrue: [ anEntity inspect ]
×
150
]
×
151

152
{ #category : 'testing' }
153
MiSourceTextBrowserModel >> hasSettings [
2✔
154

2✔
155
        ^ true
2✔
156
]
2✔
157

158
{ #category : 'accessing' }
159
MiSourceTextBrowserModel >> highlights [
2✔
160
        ^highlights
2✔
161
]
2✔
162

163
{ #category : 'highlights' }
164
MiSourceTextBrowserModel >> identifierHighlightFor: aChildEntity [
2✔
165
        
2✔
166
        self addHighlight: (MiSourceTextIdentifierHighlight new
2✔
167
                highlightedEntity: aChildEntity ;
2✔
168
                yourself)
2✔
169

2✔
170
]
2✔
171

172
{ #category : 'initialization' }
173
MiSourceTextBrowserModel >> initialize [
2✔
174
        super initialize.
2✔
175
        
2✔
176
        self resetHighlights
2✔
177
]
2✔
178

179
{ #category : 'initialization' }
180
MiSourceTextBrowserModel >> initializeSettings [
2✔
181

2✔
182
        shouldHighlightChildren := self class defaultShouldHighlightChildren
2✔
183
]
2✔
184

185
{ #category : 'highlights' }
186
MiSourceTextBrowserModel >> keywordHighlightInterval: anInterval [
×
187

×
188
        self addHighlight: (MiSourceTextKeywordHighlight new
×
189
                highlightInterval: anInterval ;
×
190
                yourself)
×
191

×
192
]
×
193

194
{ #category : 'accessing' }
195
MiSourceTextBrowserModel >> miSelectedItem [
×
196

×
197
        ^self entities
×
198
]
×
199

200
{ #category : 'formatting' }
201
MiSourceTextBrowserModel >> noSourceCodeFor: anEntity [
2✔
202
        displayedText := ('There is no source code to show for {1}'
2✔
203
                format: { anEntity name }).
2✔
204

2✔
205
        self errorHighlightInterval: (Interval from: 37 to: displayedText size)
2✔
206
]
2✔
207

208
{ #category : 'highlights' }
209
MiSourceTextBrowserModel >> nullHighlightFor: aChildEntity [
×
210

×
211
]
×
212

213
{ #category : 'formatting' }
214
MiSourceTextBrowserModel >> prepareFormating [
2✔
215
        entity sourceText
2✔
216
                ifEmpty: [ self noSourceCodeFor: entity ]
2✔
217
                ifNotEmpty: [ :code | self prepareFormating: code ]
2✔
218

2✔
219
]
2✔
220

221
{ #category : 'formatting' }
222
MiSourceTextBrowserModel >> prepareFormating: aString [
2✔
223

2✔
224
        displayedText := aString.
2✔
225

2✔
226
        shouldHighlightChildren
2✔
227
                ifTrue: [
2✔
228
                                self createHighlightsFor: self selectedEntity.
2✔
229
                                self createKeywordHighlights ]
2✔
230
                ifFalse: [ self resetHighlights ]
2✔
231
]
2✔
232

233
{ #category : 'highlights' }
234
MiSourceTextBrowserModel >> resetHighlights [
2✔
235

2✔
236
        highlights := OrderedCollection new
2✔
237
]
2✔
238

239
{ #category : 'accessing' }
240
MiSourceTextBrowserModel >> selectedEntity [
2✔
241
        ^entity
2✔
242
]
2✔
243

244
{ #category : 'accessing' }
245
MiSourceTextBrowserModel >> selectedEntity: anEntity [
2✔
246

2✔
247
        entity := anEntity.
2✔
248
        browser updateToolbar
2✔
249
]
2✔
250

251
{ #category : 'settings management' }
252
MiSourceTextBrowserModel >> settingsPresenterExtent [
2✔
253

2✔
254
        ^ 375 @ 200
2✔
255
]
2✔
256

257
{ #category : 'highlights' }
258
MiSourceTextBrowserModel >> tagHighlight: aTag for: anEntity [
×
259

×
260
        self addHighlight: (MiSourceTextTagHighlight new
×
261
                highlightedEntity: anEntity ;
×
262
                tag: aTag ;
×
263
                yourself)
×
264

×
265
]
×
266

267
{ #category : 'settings management' }
268
MiSourceTextBrowserModel >> updateFromConfiguration: aConfiguration [
2✔
269

2✔
270
        shouldHighlightChildren := aConfiguration shouldHighlightChildren.
2✔
271

2✔
272
        entity ifNil: [ ^ self ].
2✔
273

2✔
274
        self resetHighlights.
2✔
275
        self prepareFormating.
2✔
276
        browser renderTextFor: entity
2✔
277
]
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc