-
-
Notifications
You must be signed in to change notification settings - Fork 353
/
SpDiffPresenter.class.st
143 lines (117 loc) · 3.52 KB
/
SpDiffPresenter.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
"
I am a Spec widget useful for visualising differences between two strings.
When a classContext: is setted, the strings are highlighted using such contextual information.
Examples:
self exampleWithoutOptions.
self exampleWithOptions.
"
Class {
#name : #SpDiffPresenter,
#superclass : #SpAbstractWidgetPresenter,
#instVars : [
'#showOptions => SpObservableSlot',
'#showOnlyDestination => SpObservableSlot',
'#showOnlySource => SpObservableSlot',
'#contextClass => SpObservableSlot',
'#leftLabel => SpObservableSlot',
'#leftText => SpObservableSlot',
'#rightLabel => SpObservableSlot',
'#rightText => SpObservableSlot'
],
#category : #'Spec2-Core-Widgets'
}
{ #category : #specs }
SpDiffPresenter class >> adapterName [
^ #DiffAdapter
]
{ #category : #'undo-redo' }
SpDiffPresenter >> clearUndoManager [
"The diff presenter does not allow edition, it does not have undo history. But this message is added to have polimorphism in the Message Browser"
]
{ #category : #accessing }
SpDiffPresenter >> contextClass [
^ contextClass
]
{ #category : #accessing }
SpDiffPresenter >> contextClass: anObject [
contextClass := anObject
]
{ #category : #initialization }
SpDiffPresenter >> initialize [
super initialize.
leftText := ''.
rightText := ''.
showOptions := true.
showOnlyDestination := false.
showOnlySource := false.
self property: #leftText whenChangedDo: [ :newText | self changed: #leftText: with: {newText} ].
self property: #rightText whenChangedDo: [ :newText | self changed: #rightText: with: {newText} ].
self property: #contextClass whenChangedDo: [ :newClass | self changed: #contextClass: with: {newClass} ].
self property: #showOptions whenChangedDo: [ :aBoolean | self changed: #showOptions: with: {aBoolean} ].
self property: #showOnlyDestination whenChangedDo: [ :aBoolean | self changed: #showOnlyDestination: with: {aBoolean} ].
self property: #showOnlySource whenChangedDo: [ :aBoolean | self changed: #showOnlySource: with: {aBoolean} ].
self property: #leftLabel whenChangedDo: [ :newText | self changed: #leftLabel: with: {newText} ].
self property: #rightLabel whenChangedDo: [ :newText | self changed: #rightLabel: with: {newText} ]
]
{ #category : #accessing }
SpDiffPresenter >> leftLabel [
^ leftLabel
]
{ #category : #accessing }
SpDiffPresenter >> leftLabel: anObject [
leftLabel := anObject
]
{ #category : #accessing }
SpDiffPresenter >> leftText [
^ leftText
]
{ #category : #accessing }
SpDiffPresenter >> leftText: anObject [
leftText := anObject
]
{ #category : #accessing }
SpDiffPresenter >> rightLabel [
^ rightLabel
]
{ #category : #accessing }
SpDiffPresenter >> rightLabel: anObject [
rightLabel := anObject
]
{ #category : #accessing }
SpDiffPresenter >> rightText [
^ rightText
]
{ #category : #accessing }
SpDiffPresenter >> rightText: anObject [
rightText := anObject
]
{ #category : #api }
SpDiffPresenter >> showBoth [
self property: #showOnlySource rawValue: false.
self property: #showOnlyDestination rawValue: false.
self changed: #showBoth with: {}
]
{ #category : #api }
SpDiffPresenter >> showOnlyDestination [
^ showOnlyDestination
]
{ #category : #api }
SpDiffPresenter >> showOnlyDestination: aBoolean [
showOnlyDestination := aBoolean
]
{ #category : #api }
SpDiffPresenter >> showOnlySource [
^ showOnlySource
]
{ #category : #api }
SpDiffPresenter >> showOnlySource: aBoolean [
showOnlySource := aBoolean
]
{ #category : #api }
SpDiffPresenter >> showOptions [
^ showOptions
]
{ #category : #api }
SpDiffPresenter >> showOptions: aBoolean [
showOptions := aBoolean
]