diff --git a/repository/OpenPonk-ClassEditor/OPRSCairoMetricsProvider.class.st b/repository/OpenPonk-ClassEditor/OPRSCairoMetricsProvider.class.st new file mode 100644 index 00000000..650372ed --- /dev/null +++ b/repository/OpenPonk-ClassEditor/OPRSCairoMetricsProvider.class.st @@ -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 +] diff --git a/repository/OpenPonk-ClassEditor/OPTUmlBaseController.trait.st b/repository/OpenPonk-ClassEditor/OPTUmlBaseController.trait.st index afadf29f..e39611d7 100644 --- a/repository/OpenPonk-ClassEditor/OPTUmlBaseController.trait.st +++ b/repository/OpenPonk-ClassEditor/OPTUmlBaseController.trait.st @@ -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' } diff --git a/repository/OpenPonk-ClassEditor/OPUmlAttributeController.class.st b/repository/OpenPonk-ClassEditor/OPUmlAttributeController.class.st index 8c9f6a3e..05e6f287 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlAttributeController.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlAttributeController.class.st @@ -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 diff --git a/repository/OpenPonk-ClassEditor/OPUmlClassController.class.st b/repository/OpenPonk-ClassEditor/OPUmlClassController.class.st index 459fed7d..1d3e2e99 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlClassController.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlClassController.class.st @@ -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) @@ -154,12 +116,13 @@ OPUmlClassController >> dependentElements [ { #category : 'forms' } OPUmlClassController >> descriptionIsAbstract [ + ^ MABooleanDescription new - accessor: (self descriptionAccessor: #isAbstract); - label: 'Is Abstract'; - priority: 5; - yourself + accessor: (self descriptionAccessor: #isAbstract); + label: 'Is Abstract'; + priority: 5; + yourself ] { #category : 'forms' } diff --git a/repository/OpenPonk-ClassEditor/OPUmlClassEditorPlugin.class.st b/repository/OpenPonk-ClassEditor/OPUmlClassEditorPlugin.class.st index b50e698c..fdc79949 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlClassEditorPlugin.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlClassEditorPlugin.class.st @@ -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 @@ -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 | diff --git a/repository/OpenPonk-ClassEditor/OPUmlClassifierController.class.st b/repository/OpenPonk-ClassEditor/OPUmlClassifierController.class.st index cfda76d0..235d4602 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlClassifierController.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlClassifierController.class.st @@ -8,11 +8,6 @@ Class { #tag : 'Controllers' } -{ #category : 'figures' } -OPUmlClassifierController >> adornments [ - ^ self subclassResponsibility -] - { #category : 'adding' } OPUmlClassifierController >> canBeSourceFor: aController [ ^ aController isKindOf: OPUmlAssociationController diff --git a/repository/OpenPonk-ClassEditor/OPUmlClassifierNameLabel.class.st b/repository/OpenPonk-ClassEditor/OPUmlClassifierNameLabel.class.st index b0b6e93f..2fc39d1c 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlClassifierNameLabel.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlClassifierNameLabel.class.st @@ -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 ] diff --git a/repository/OpenPonk-ClassEditor/OPUmlEnumerationController.class.st b/repository/OpenPonk-ClassEditor/OPUmlEnumerationController.class.st index 0d5e05f1..7a49fd50 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlEnumerationController.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlEnumerationController.class.st @@ -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) diff --git a/repository/OpenPonk-ClassEditor/OPUmlGeneralizationSetDescriptions.class.st b/repository/OpenPonk-ClassEditor/OPUmlGeneralizationSetDescriptions.class.st index ecf66fb4..3f674787 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlGeneralizationSetDescriptions.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlGeneralizationSetDescriptions.class.st @@ -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 ] ] ] ] diff --git a/repository/OpenPonk-ClassEditor/OPUmlPackageDiagramController.class.st b/repository/OpenPonk-ClassEditor/OPUmlPackageDiagramController.class.st index 90677d1c..ef82510c 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlPackageDiagramController.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlPackageDiagramController.class.st @@ -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; diff --git a/repository/OpenPonk-ClassEditor/OPUmlPropertyMagritteDescriptions.class.st b/repository/OpenPonk-ClassEditor/OPUmlPropertyMagritteDescriptions.class.st index 2aae613f..51d72b5b 100644 --- a/repository/OpenPonk-ClassEditor/OPUmlPropertyMagritteDescriptions.class.st +++ b/repository/OpenPonk-ClassEditor/OPUmlPropertyMagritteDescriptions.class.st @@ -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.