Skip to content

Commit 3ef3fd5

Browse files
authored
Merge pull request #98 from hpi-swa-lab/enhancement/hide-annotations
Adds an unannotated view to the BPBrowser
2 parents cfb992b + 5ac4963 commit 3ef3fd5

18 files changed

+143
-14
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
as yet unclassified
1+
compiling
22
compilerClass
33

44
^ BPCompiler

packages/Babylonian-Tests.package/BPSearchCollection.class/methodProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"class" : {
3-
"compilerClass" : "pre 11/9/2019 15:00",
3+
"compilerClass" : "jb 10/30/2021 00:30",
44
"numbersUpTo10" : "pre 11/9/2019 15:06",
55
"numbersUpTo10000" : "pre 10/22/2020 13:54" },
66
"instance" : {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
controls
2+
defaultContentsSymbolQuints
3+
4+
^ {super defaultContentsSymbolQuints first},
5+
{{#unannotated
6+
. #toggleUnannotatedSource
7+
. #showingUnannotatedSourceString
8+
. 'unannotated'
9+
. 'the textual source without Babylonian annotations'}},
10+
super defaultContentsSymbolQuints allButFirst
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
message list
2+
selectedMessage
3+
4+
"Has to be copied from CodeHolder and get injected to check for unannotated source
5+
before moving on to showingDocumentation"
6+
7+
| class selector method |
8+
contents == nil ifFalse: [^ contents copy].
9+
10+
self showingDecompile ifTrue:
11+
[^ self decompiledSourceIntoContents].
12+
13+
class := self selectedClassOrMetaClass.
14+
selector := self selectedMessageName.
15+
method := class compiledMethodAt: selector ifAbsent: [^ '']. "method deleted while in another project"
16+
currentCompiledMethod := method.
17+
18+
"=== BABYLONIAN CODE START ==="
19+
self showingUnannotated ifTrue: [^ self sourceStringUnannotated].
20+
"=== BABYLONIAN CODE END ==="
21+
22+
^ contents := (self showingDocumentation
23+
ifFalse: [ self sourceStringPrettifiedAndDiffed ]
24+
ifTrue: [ self commentContents ])
25+
copy asText makeSelectorBoldIn: class
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
what to show
2+
showUnannotated: aBoolean
3+
4+
self contentsSymbol: (aBoolean ifFalse: [#source] ifTrue: [#unannotated])
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
what to show
2+
showingUnannotated
3+
4+
^ self contentsSymbol == #unannotated
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
what to show
2+
showingUnannotatedSourceString
3+
4+
^ (self showingUnannotated
5+
ifTrue:
6+
['<yes>']
7+
ifFalse:
8+
['<no>']), 'unannotated'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
message list
2+
sourceStringUnannotated
3+
4+
"Adapt super to deal with actual methods, hence duplicated code"
5+
"Answer a copy of the source code for the selected message, transformed by diffing and pretty-printing exigencies"
6+
7+
| class selector sourceString |
8+
class := self selectedClassOrMetaClass.
9+
selector := self selectedMessageName.
10+
(class isNil or: [selector isNil]) ifTrue: [^'missing'].
11+
sourceString := class ultimateSourceCodeAt: selector ifAbsent: [^'error'].
12+
self validateMessageSource: sourceString forSelector: selector inClass: class.
13+
sourceString := BPUnannotatedStyler new
14+
selectedMethod: (MethodReference class: class selector: selector);
15+
classOrMetaClass: class;
16+
styledTextFor: sourceString.
17+
^ sourceString
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
what to show
2+
toggleUnannotatedSource
3+
4+
| wasShowing |
5+
self okToChange ifTrue:
6+
[wasShowing := self showingUnannotated.
7+
self restoreTextualCodingPane.
8+
self showUnannotated: wasShowing not.
9+
self setContentsToForceRefetch.
10+
self contentsChanged].

packages/Babylonian-UI.package/BPBrowser.class/methodProperties.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"automaticallyAcceptMethodOnAddingAnnotations" : "pre 6/7/2021 14:34",
44
"automaticallyAcceptMethodOnAddingAnnotations:" : "pre 6/7/2021 14:35",
55
"compilerClass" : "pre 7/26/2019 10:07",
6+
"defaultContentsSymbolQuints" : "jb 10/30/2021 17:40",
67
"initialize" : "pre 8/25/2020 10:35",
78
"startUp" : "jb 12/3/2020 23:07" },
89
"instance" : {
@@ -21,5 +22,11 @@
2122
"messageList" : "pre 9/24/2020 14:26",
2223
"openExampleInstanceInHand:" : "pre 9/28/2021 16:25",
2324
"rawMessageCategoryList" : "jb 12/3/2020 22:54",
25+
"selectedMessage" : "jb 10/30/2021 13:52",
26+
"showUnannotated:" : "jb 10/29/2021 23:07",
27+
"showingUnannotated" : "jb 10/29/2021 22:58",
28+
"showingUnannotatedSourceString" : "jb 11/1/2021 00:58",
29+
"sourceStringUnannotated" : "jb 11/10/2021 23:53",
30+
"toggleUnannotatedSource" : "jb 10/29/2021 23:15",
2431
"toolBuilderModelsMenu:" : "pre 9/28/2021 16:32",
2532
"wantsMessageCategoriesDrop:" : "jb 8/29/2021 22:15" } }

0 commit comments

Comments
 (0)