Skip to content

Commit f3501eb

Browse files
authored
Merge pull request #254 from OpenSmock/dev-issue239
2 parents 42477ee + a467804 commit f3501eb

1 file changed

Lines changed: 84 additions & 64 deletions

File tree

src/Molecule-IDE/MolComponentImpl.extension.st

Lines changed: 84 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,94 +3,114 @@ Extension { #name : #MolComponentImpl }
33
{ #category : #'*Molecule-IDE' }
44
MolComponentImpl >> asRSMoleculeShape [
55

6-
| classNameLabel componentNameLabel contracts composite |
7-
classNameLabel := RSLabel new
8-
text: self className;
9-
color: Color black lighter lighter;
10-
italic;
11-
fontSize: 14;
12-
yourself.
13-
componentNameLabel := RSLabel new
14-
text: self componentName;
6+
| implementationLabel componentNameLabel contracts composite componentTypeLabel componentNameText |
7+
componentTypeLabel := RSLabel new
8+
text: self class componentType asString;
159
color: Color black;
10+
bold;
1611
fontSize: 18;
1712
yourself.
1813

14+
implementationLabel := RSLabel new
15+
text: self className;
16+
color: Color black lighter lighter;
17+
italic;
18+
fontSize: 12;
19+
yourself.
20+
21+
"don't display the default name to have better visual identification of named components"
22+
componentNameText := self componentName
23+
= MolUtils defaultComponentName
24+
ifTrue: [ '' ]
25+
ifFalse: [ '#' , self componentName ].
26+
27+
componentNameLabel := RSLabel new
28+
text: componentNameText;
29+
color: Color black lighter;
30+
fontSize: 16;
31+
yourself.
32+
1933
contracts := MolComponentToRoassal makeContractShapesFor: self.
2034

2135
RSVerticalLineLayout new
2236
alignCenter;
2337
on: {
38+
componentTypeLabel.
39+
implementationLabel.
2440
componentNameLabel.
25-
classNameLabel.
2641
contracts }.
2742

2843
composite := RSComposite new
2944
draggable;
30-
popupText: [ :comp | comp componentName ];
45+
popupText: [ :comp |
46+
'Type: <1s><r>Impl: <2s><r>Name: <3s>'
47+
expandMacrosWith: comp class componentType asString
48+
with: comp className asString
49+
with: comp componentName asString ];
3150
model: self;
3251
withBorder;
3352
color: Color gray muchLighter;
3453
shapes: {
54+
componentTypeLabel.
55+
implementationLabel.
3556
componentNameLabel.
36-
classNameLabel.
3757
contracts };
3858
yourself.
3959
composite adjustToChildren.
4060
composite extent: composite extent + (0 @ 20).
4161
composite @ (RSMenuActivable new menuDo: [ :aMenuMorph :anRSBox |
42-
(aMenuMorph
43-
add: 'Inspect component'
44-
target: self
45-
selector: #inspect
46-
argument: #( )) icon:
47-
(Smalltalk ui icons iconNamed: #smallInspectIt).
48-
(aMenuMorph
49-
add: 'Browse component'
50-
target: self
51-
selector: #browse
52-
argument: #( )) icon: (Smalltalk ui icons iconNamed: #nautilus).
53-
(aMenuMorph
54-
add: 'Inspect component type implementors'
55-
target: self
56-
selector: #showComponentTypeImplementor
57-
argument: #( )) icon: (Smalltalk ui icons iconNamed: #dropDown).
58-
aMenuMorph addSeparator.
59-
(aMenuMorph
60-
add: 'Break once when state switch to #initialize'
61-
target: self class
62-
selector: #breakOnceOnComponentInitialize) icon:
63-
(Smalltalk ui icons iconNamed: #halt).
64-
(aMenuMorph
65-
add: 'Break once when state switch to #activate'
66-
target: self class
67-
selector: #breakOnceOnComponentActivate) icon:
68-
(Smalltalk ui icons iconNamed: #halt).
69-
(aMenuMorph
70-
add: 'Break once when state switch to #passivate'
71-
target: self class
72-
selector: #breakOnceOnComponentPassivate) icon:
73-
(Smalltalk ui icons iconNamed: #halt).
74-
(aMenuMorph
75-
add: 'Break once when state switch to #remove'
76-
target: self class
77-
selector: #breakOnceOnComponentRemove) icon:
78-
(Smalltalk ui icons iconNamed: #halt).
79-
(aMenuMorph
80-
add: 'Break once when this component state switch to #activate'
81-
target: self
82-
selector: #breakObjectOrientedOnceOnComponentActivate) icon:
83-
(Smalltalk ui icons iconNamed: #bug).
84-
(aMenuMorph
85-
add: 'Break once when state this component switch to #passivate'
86-
target: self
87-
selector: #breakObjectOrientedOnceOnComponentPassivate) icon:
88-
(Smalltalk ui icons iconNamed: #bug).
89-
(aMenuMorph
90-
add: 'Break once when state this component switch to #remove'
91-
target: self
92-
selector: #breakObjectOrientedOnceOnComponentRemove) icon:
93-
(Smalltalk ui icons iconNamed: #bug) ]).
62+
(aMenuMorph
63+
add: 'Inspect component'
64+
target: self
65+
selector: #inspect
66+
argument: #( )) icon:
67+
(Smalltalk ui icons iconNamed: #smallInspectIt).
68+
(aMenuMorph
69+
add: 'Browse component'
70+
target: self
71+
selector: #browse
72+
argument: #( )) icon: (Smalltalk ui icons iconNamed: #nautilus).
73+
(aMenuMorph
74+
add: 'Inspect component type implementors'
75+
target: self
76+
selector: #showComponentTypeImplementor
77+
argument: #( )) icon: (Smalltalk ui icons iconNamed: #dropDown).
78+
aMenuMorph addSeparator.
79+
(aMenuMorph
80+
add: 'Break once when state switch to #initialize'
81+
target: self class
82+
selector: #breakOnceOnComponentInitialize) icon:
83+
(Smalltalk ui icons iconNamed: #halt).
84+
(aMenuMorph
85+
add: 'Break once when state switch to #activate'
86+
target: self class
87+
selector: #breakOnceOnComponentActivate) icon:
88+
(Smalltalk ui icons iconNamed: #halt).
89+
(aMenuMorph
90+
add: 'Break once when state switch to #passivate'
91+
target: self class
92+
selector: #breakOnceOnComponentPassivate) icon:
93+
(Smalltalk ui icons iconNamed: #halt).
94+
(aMenuMorph
95+
add: 'Break once when state switch to #remove'
96+
target: self class
97+
selector: #breakOnceOnComponentRemove) icon:
98+
(Smalltalk ui icons iconNamed: #halt).
99+
(aMenuMorph
100+
add: 'Break once when this component state switch to #activate'
101+
target: self
102+
selector: #breakObjectOrientedOnceOnComponentActivate) icon:
103+
(Smalltalk ui icons iconNamed: #bug).
104+
(aMenuMorph
105+
add: 'Break once when state this component switch to #passivate'
106+
target: self
107+
selector: #breakObjectOrientedOnceOnComponentPassivate) icon:
108+
(Smalltalk ui icons iconNamed: #bug).
109+
(aMenuMorph
110+
add: 'Break once when state this component switch to #remove'
111+
target: self
112+
selector: #breakObjectOrientedOnceOnComponentRemove) icon:
113+
(Smalltalk ui icons iconNamed: #bug) ]).
94114

95115

96116
^ composite

0 commit comments

Comments
 (0)