Skip to content

Commit

Permalink
Merge 381e5da
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 17, 2024
2 parents 9ec68f8 + 381e5da commit 0a44c51
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ OPUmlAttributeController >> dependingOnElements [
nullableElement
ifNil: [ Set empty ]
ifNotNil: [ :element | Set with: element ] ].

^ super dependingOnElements
, (asSetOrEmpty value: model owningAssociation)
]
Expand Down Expand Up @@ -169,7 +170,18 @@ OPUmlAttributeController >> modelClass [
{ #category : 'hooks' }
OPUmlAttributeController >> placeholderName [

^ 'attribute'
(self model isNil or: [
self model type isNil or: [
self model type name isNil or: [ self model type name isEmpty ] ] ])
ifTrue: [ ^ 'attribute' ].
^ String streamContents: [ :s |
| words |
words := (self model type name select: [ :each |
each isAlphaNumeric or: [ each isSeparator ] ])
splitOn: [ :each | each isSeparator ].
s << words first first asLowercase asString.
s << words first allButFirst asString.
words allButFirstDo: [ :eachWord | s << eachWord capitalized ] ]
]

{ #category : 'construction' }
Expand Down Expand Up @@ -204,6 +216,27 @@ OPUmlAttributeController >> typeNamed: aName [
^ OPUMLClass new name: aName
]

{ #category : 'validation' }
OPUmlAttributeController >> validate [

super validate.
model ifNil: [ ^ self ].
(model owningClass isNotNil and: [ model owningAssociation isNotNil ])
ifTrue: [
OPModelInvalid signal: (String streamContents: [ :s |
s << 'Property "' << model name asString << '" owned by class "'
<< model owningClass name asString
<< '" is also owned by assoc. '.
model owningAssociation name
ifNil: [
model owningAssociation memberEnds
do: [ :each |
each type ifNotNil: [ :type | s << '"' << type name << '"' ] ]
separatedBy: [ s << ' <-> ' ] ]
ifNotNil: [ :assName | s << '"' << assName << '"' ] ]) ].
model owningAssociation: nil
]

{ #category : 'forms' }
OPUmlAttributeController >> writeMultiplicityFrom: aString to: aProperty [
| values |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ Class {
{ #category : 'sorting' }
OPUmlClassItemListCompartment >> sortOwnedElements [

ownedElements sort: [ :a :b |
(a modelElement isStatic and: [ b modelElement isStatic not ]) or: [
(a modelElement isStatic or: [ b modelElement isStatic not ]) and: [
a modelElement name < b modelElement name ] ] ]
ownedElements sort: [ :a :b |
(a modelElement isStatic and: [ b modelElement isStatic not ]) or: [
(a modelElement isStatic or: [ b modelElement isStatic not ]) and: [
a modelElement name < b modelElement name or: [
a modelElement name = b modelElement name and: [
a modelElement uuid < b modelElement uuid ] ] ] ] ]
]

0 comments on commit 0a44c51

Please sign in to comment.