Skip to content

Commit

Permalink
Merge 576c3f2
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 3, 2024
2 parents 35cb8e9 + 576c3f2 commit fe141f4
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 88 deletions.
22 changes: 22 additions & 0 deletions repository/OpenPonk-ClassEditor/OPRSCairoMetricsProvider.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Class {
#name : 'OPRSCairoMetricsProvider',
#superclass : 'RSCairoMetricsProvider',
#category : 'OpenPonk-ClassEditor-Shapes',
#package : 'OpenPonk-ClassEditor',
#tag : 'Shapes'
}

{ #category : 'hooks' }
OPRSCairoMetricsProvider >> extentsOf: aRSLabel [
"This entire class exists to overcome
https://github.com/pharo-graphics/Roassal/issues/64"

| copy |
self flag: 'https://github.com/pharo-graphics/Roassal/issues/64'.
aRSLabel isNormal ifTrue: [ ^ super extentsOf: aRSLabel ].
copy := RSLabel new
font: aRSLabel font;
text: aRSLabel text , '.';
yourself.
^ copy textExtents
]
9 changes: 5 additions & 4 deletions repository/OpenPonk-ClassEditor/OPTUmlBaseController.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ Trait {

{ #category : 'forms' }
OPTUmlBaseController >> descriptionAccessor: aSymbol [

^ MAPluggableAccessor
read: [ :me | me model perform: aSymbol ]
write: [ :me :newValue |
me model perform: (aSymbol , ':') asSymbol with: newValue.
self diagramElement modelChanged ]
read: [ :me | me model perform: aSymbol ]
write: [ :me :newValue |
me model perform: (aSymbol , ':') asSymbol with: newValue.
self diagramElement modelChanged ]
]

{ #category : 'forms' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ OPUmlAttributeController >> descriptionDefaultValue [
^ MAStringDescription new
accessor: (self descriptionAccessor: #defaultValue);
accessor: (MAPluggableAccessor
read: [ :me |
me model defaultValue ifNil: [ '' ] ifNotNil: [
read: [ :me |
me model defaultValue ifNil: [ '' ] ifNotNil: [
(me model defaultValue isKindOf: OPUMLOpaqueExpression)
ifTrue: [ me model defaultValue bodies first ]
ifFalse: [ '' ] ] ]
write: [ :me :newValue |
me model defaultValue ifNil: [
write: [ :me :newValue |
me model defaultValue ifNil: [
me model defaultValue: OPUMLOpaqueExpression new ].
(me model defaultValue isKindOf: OPUMLOpaqueExpression)
ifTrue: [
(me model defaultValue isKindOf: OPUMLOpaqueExpression)
ifTrue: [
me model defaultValue bodies:
(newValue ifEmpty: [ { } ] ifNotEmpty: [ { newValue } ]) ].
self refreshFigure ]);
self diagramElement modelChanged ]);
label: 'Default Value';
priority: 42;
yourself
Expand Down
47 changes: 5 additions & 42 deletions repository/OpenPonk-ClassEditor/OPUmlClassController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,6 @@ Class {
#tag : 'Controllers'
}

{ #category : 'figures' }
OPUmlClassController >> adornments [

^ {
(OPUmlIcons attributeIcon -> [
| tool |
tool := OPCreationTool new
palette: self diagramController editor palette;
factory: [ OPUmlAttributeController new ].
self diagramController editor palette selectTool: tool.
tool whenCreated: [ :ctrl |
OPRenameElementCommand executeOn: ctrl ].
tool selectedTargetControllers: { self } ]).
(OPUmlIcons directedAssociationIcon -> [
| tool |
tool := OPConnectionCreationTool new
palette: self diagramController editor palette;
factory: [ OPUmlAssociationController new ].
self diagramController editor palette selectTool: tool.
tool selectedSourceControllers: { self } ]).
(OPUmlIcons generalizationIcon -> [
| tool |
tool := OPConnectionCreationTool new
palette: self diagramController editor palette;
factory: [ OPUmlGeneralizationController new ].
self diagramController editor palette selectTool: tool.
tool selectedSourceControllers: { self } ]) }
]

{ #category : 'forms' }
OPUmlClassController >> buildAbstractEditorForm: aForm [
(aForm addCheckbox: 'Is Abstract')
state: self model isAbstract;
whenChangedDo: [ :val |
self model isAbstract: val.
self refreshFigure ]
]

{ #category : 'adding' }
OPUmlClassController >> canBeSourceFor: aController [
^ (aController isKindOf: OPUmlGeneralizationController)
Expand Down Expand Up @@ -154,12 +116,13 @@ OPUmlClassController >> dependentElements [

{ #category : 'forms' }
OPUmlClassController >> descriptionIsAbstract [

<magritteDescription>
^ MABooleanDescription new
accessor: (self descriptionAccessor: #isAbstract);
label: 'Is Abstract';
priority: 5;
yourself
accessor: (self descriptionAccessor: #isAbstract);
label: 'Is Abstract';
priority: 5;
yourself
]

{ #category : 'forms' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ OPUmlClassEditorPlugin class >> defaultProfiles [
{ #category : 'toolbar' }
OPUmlClassEditorPlugin class >> exportPackage: aPackage [

StFBSaveFileDialog new
StSaveFilePresenter new
title: 'Choose a XMI file to export to';
okAction: [ :file |
file
Expand All @@ -39,7 +39,7 @@ OPUmlClassEditorPlugin class >> exportPackage: aPackage [
{ #category : 'toolbar' }
OPUmlClassEditorPlugin class >> importToPackage: aPackage [

StFBOpenFileDialog new
StOpenFilePresenter new
title: 'Choose a XMI export of UML model';
okAction: [ :file |
| model |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ Class {
#tag : 'Controllers'
}

{ #category : 'figures' }
OPUmlClassifierController >> adornments [
^ self subclassResponsibility
]

{ #category : 'adding' }
OPUmlClassifierController >> canBeSourceFor: aController [
^ aController isKindOf: OPUmlAssociationController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,10 @@ OPUmlClassifierNameLabel >> updateRenderFromModel [

roassalShape := labeled labelShape.

roassalShape shapes do: [ :each |
self flag: 'https://github.com/pharo-graphics/Roassal/issues/64'.
each metricsProvider: OPRSCairoMetricsProvider new ].
roassalShape adjustToChildren.

roassalShape signalUpdate
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@ Class {
#tag : 'Controllers'
}

{ #category : 'figures' }
OPUmlEnumerationController >> adornments [

^ { (OPUmlIcons literalIcon -> [
| tool |
tool := OPCreationTool new
palette: self diagramController editor palette;
factory: [ OPUMLEnumerationLiteral new ].
self diagramController editor palette selectTool: tool.
tool whenCreated: [ :ctrl |
OPRenameElementCommand executeOn: ctrl.
ctrl refreshFigure ].
tool selectedTargetControllers: { self } ]) }
]

{ #category : 'adding' }
OPUmlEnumerationController >> canBeTargetFor: aController [
^ (aController isKindOf: OPUmlEnumerationLiteralController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ OPUmlGeneralizationSetDescriptions >> descriptionAccessor: aSymbol [

^ MAPluggableAccessor
read: [ :me | set perform: aSymbol ]
write: [ :me :newValue |
write: [ :me :newValue |
set perform: (aSymbol , ':') asSymbol with: newValue.
{ controller model } asSet , set generalizations
collect: [ :each |
collect: [ :each |
controller diagramController controllerForModel: each ]
thenDo: [ :ctrl |
ctrl diagramElement ifNotNil: [
thenDo: [ :ctrl |
ctrl diagramElement ifNotNil: [
ctrl diagramElement modelChanged ] ] ]
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,23 @@ OPUmlPackageDiagramController >> descriptionAppliedProfiles [
distinct: true;
reference: MAStringDescription new;
accessor: (MAPluggableAccessor
read: [ :me |
read: [ :me |
me model profileApplications collect: #appliedProfile ]
write: [ :me :selectedProfiles |
write: [ :me :selectedProfiles |
me model profileApplications:
(me model profileApplications select: [ :any |
(me model profileApplications select: [ :any |
selectedProfiles includes: any appliedProfile ]).
me model profileApplications:
me model profileApplications , (selectedProfiles
select: [ :eachSelectedProfile |
me model profileApplications noneSatisfy: [
:eachExistingProfileApplication |
select: [ :eachSelectedProfile |
me model profileApplications noneSatisfy: [
:eachExistingProfileApplication |
eachExistingProfileApplication = eachSelectedProfile ] ]
thenCollect: [ :each |
thenCollect: [ :each |
OPUMLProfileApplication new appliedProfile:
each yourself ]).
self rebuildPalette.
self refreshFigure ]);
self diagramElement modelChanged ]);
label: 'Applied Profiles';
priority: 10;
beSorted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OPUmlPropertyMagritteDescriptions >> descriptionAccessor: aSymbol [

^ MAPluggableAccessor
read: [ :me | (reader value: me) perform: aSymbol ]
write: [ :me :newValue |
write: [ :me :newValue |
(reader value: me)
perform: (aSymbol , ':') asSymbol
with: newValue.
Expand Down

0 comments on commit fe141f4

Please sign in to comment.