-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved association end label handling
- Loading branch information
1 parent
f13e172
commit c2e2235
Showing
9 changed files
with
203 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
repository/OpenPonk-ClassEditor/OPUmlDiagramEndLabelsFigureMenuGroup.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Class { | ||
#name : 'OPUmlDiagramEndLabelsFigureMenuGroup', | ||
#superclass : 'CmdMenuGroup', | ||
#category : 'OpenPonk-ClassEditor-Commands', | ||
#package : 'OpenPonk-ClassEditor', | ||
#tag : 'Commands' | ||
} | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramEndLabelsFigureMenuGroup >> name [ | ||
|
||
^ 'Association end labels' | ||
] |
22 changes: 10 additions & 12 deletions
22
repository/OpenPonk-ClassEditor/OPUmlDiagramHideEndLabelsFigureCommand.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
Class { | ||
#name : 'OPUmlDiagramHideEndLabelsFigureCommand', | ||
#superclass : 'OPUmlDiagramEndLabelsFigureCommand', | ||
#superclass : 'OPUmlDiagramSetEndLabelsFigureCommand', | ||
#category : 'OpenPonk-ClassEditor-Commands', | ||
#package : 'OpenPonk-ClassEditor', | ||
#tag : 'Commands' | ||
} | ||
|
||
{ #category : 'testing' } | ||
OPUmlDiagramHideEndLabelsFigureCommand class >> canBeExecutedInContext: aToolContext [ | ||
{ #category : 'hooks' } | ||
OPUmlDiagramHideEndLabelsFigureCommand class >> resultingShowState [ | ||
|
||
^ (super canBeExecutedInContext: aToolContext) and: [ | ||
aToolContext diagramElements anySatisfy: [ :any | | ||
any showAssociationEndLabels ] ] | ||
^ #show | ||
] | ||
|
||
{ #category : 'hooks' } | ||
OPUmlDiagramHideEndLabelsFigureCommand class >> resultingShowState [ | ||
{ #category : 'accessing' } | ||
OPUmlDiagramHideEndLabelsFigureCommand >> basicMenuItemName [ | ||
|
||
^ false | ||
^ 'Hide all' | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramHideEndLabelsFigureCommand >> defaultMenuItemName [ | ||
OPUmlDiagramHideEndLabelsFigureCommand >> defaultMenuIconFormSet [ | ||
|
||
^ 'Hide association end labels' | ||
^ FormSet form: OPCoreIcons opHideLabelsIcon | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramHideEndLabelsFigureCommand >> description [ | ||
|
||
^ 'Hide association end labels where the text is just name of the class' | ||
^ 'Hide all association end labels' | ||
] |
31 changes: 31 additions & 0 deletions
31
repository/OpenPonk-ClassEditor/OPUmlDiagramHideSameAsClassEndLabelsFigureCommand.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Class { | ||
#name : 'OPUmlDiagramHideSameAsClassEndLabelsFigureCommand', | ||
#superclass : 'OPUmlDiagramSetEndLabelsFigureCommand', | ||
#category : 'OpenPonk-ClassEditor-Commands', | ||
#package : 'OpenPonk-ClassEditor', | ||
#tag : 'Commands' | ||
} | ||
|
||
{ #category : 'hooks' } | ||
OPUmlDiagramHideSameAsClassEndLabelsFigureCommand class >> resultingShowState [ | ||
|
||
^ #hideSame | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramHideSameAsClassEndLabelsFigureCommand >> basicMenuItemName [ | ||
|
||
^ 'Hide same as class name' | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramHideSameAsClassEndLabelsFigureCommand >> defaultMenuIconFormSet [ | ||
|
||
^ FormSet form: OPCoreIcons opHideSameLabelsIcon | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramHideSameAsClassEndLabelsFigureCommand >> description [ | ||
|
||
^ 'Hide association end labels where the text is the same as name of the class' | ||
] |
44 changes: 44 additions & 0 deletions
44
repository/OpenPonk-ClassEditor/OPUmlDiagramSetEndLabelsFigureCommand.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Class { | ||
#name : 'OPUmlDiagramSetEndLabelsFigureCommand', | ||
#superclass : 'OPUmlDiagramEndLabelsFigureCommand', | ||
#category : 'OpenPonk-ClassEditor-Commands', | ||
#package : 'OpenPonk-ClassEditor', | ||
#tag : 'Commands' | ||
} | ||
|
||
{ #category : 'testing' } | ||
OPUmlDiagramSetEndLabelsFigureCommand class >> isAbstract [ | ||
|
||
^ self = OPUmlDiagramSetEndLabelsFigureCommand | ||
] | ||
|
||
{ #category : 'hooks' } | ||
OPUmlDiagramSetEndLabelsFigureCommand class >> resultingShowState [ | ||
|
||
^ #'' | ||
] | ||
|
||
{ #category : 'execution' } | ||
OPUmlDiagramSetEndLabelsFigureCommand >> execute [ | ||
|
||
diagramElements | ||
select: [ :each | each supportsHidingLabelEnds ] | ||
thenDo: [ :each | | ||
each showAssociationEndLabels: self resultingShowState ] | ||
] | ||
|
||
{ #category : 'testing' } | ||
OPUmlDiagramSetEndLabelsFigureCommand >> isCurrentStyle: aStyle [ | ||
|
||
aStyle ifNil: [ ^ false ]. | ||
^ aStyle | ||
at: OPUmlAssociationEndLabel showAssociationEndLabelsKey | ||
ifPresent: [ :styleValue | styleValue = self resultingShowState ] | ||
ifAbsent: [ false ] | ||
] | ||
|
||
{ #category : 'hooks' } | ||
OPUmlDiagramSetEndLabelsFigureCommand >> resultingShowState [ | ||
|
||
^ self class resultingShowState | ||
] |
22 changes: 10 additions & 12 deletions
22
repository/OpenPonk-ClassEditor/OPUmlDiagramShowEndLabelsFigureCommand.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
Class { | ||
#name : 'OPUmlDiagramShowEndLabelsFigureCommand', | ||
#superclass : 'OPUmlDiagramEndLabelsFigureCommand', | ||
#superclass : 'OPUmlDiagramSetEndLabelsFigureCommand', | ||
#category : 'OpenPonk-ClassEditor-Commands', | ||
#package : 'OpenPonk-ClassEditor', | ||
#tag : 'Commands' | ||
} | ||
|
||
{ #category : 'testing' } | ||
OPUmlDiagramShowEndLabelsFigureCommand class >> canBeExecutedInContext: aToolContext [ | ||
{ #category : 'hooks' } | ||
OPUmlDiagramShowEndLabelsFigureCommand class >> resultingShowState [ | ||
|
||
^ (super canBeExecutedInContext: aToolContext) and: [ | ||
aToolContext diagramElements anySatisfy: [ :any | | ||
any showAssociationEndLabels not ] ] | ||
^ #hide | ||
] | ||
|
||
{ #category : 'hooks' } | ||
OPUmlDiagramShowEndLabelsFigureCommand class >> resultingShowState [ | ||
{ #category : 'accessing' } | ||
OPUmlDiagramShowEndLabelsFigureCommand >> basicMenuItemName [ | ||
|
||
^ true | ||
^ 'Show all' | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramShowEndLabelsFigureCommand >> defaultMenuItemName [ | ||
OPUmlDiagramShowEndLabelsFigureCommand >> defaultMenuIconFormSet [ | ||
|
||
^ 'Show association end labels' | ||
^ FormSet form: OPCoreIcons opShowLabelsIcon | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramShowEndLabelsFigureCommand >> description [ | ||
|
||
^ 'Show association end labels even where the text is just name of the class' | ||
^ 'Show all association end labels' | ||
] |
37 changes: 37 additions & 0 deletions
37
repository/OpenPonk-ClassEditor/OPUmlDiagramUnsetEndLabelsFigureCommand.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Class { | ||
#name : 'OPUmlDiagramUnsetEndLabelsFigureCommand', | ||
#superclass : 'OPUmlDiagramEndLabelsFigureCommand', | ||
#category : 'OpenPonk-ClassEditor-Commands', | ||
#package : 'OpenPonk-ClassEditor', | ||
#tag : 'Commands' | ||
} | ||
|
||
{ #category : 'testing' } | ||
OPUmlDiagramUnsetEndLabelsFigureCommand class >> canBeExecutedInContext: aToolContext [ | ||
|
||
^ (super canBeExecutedInContext: aToolContext) and: [ | ||
aToolContext diagramElements anySatisfy: [ :any | | ||
any owningElement exists ] ] | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OPUmlDiagramUnsetEndLabelsFigureCommand >> basicMenuItemName [ | ||
|
||
^ 'Use diagram-level setting' | ||
] | ||
|
||
{ #category : 'execution' } | ||
OPUmlDiagramUnsetEndLabelsFigureCommand >> execute [ | ||
|
||
diagramElements | ||
select: [ :each | each owningElement exists ] | ||
thenDo: [ :each | each unsetAssociationEndLabels ] | ||
] | ||
|
||
{ #category : 'testing' } | ||
OPUmlDiagramUnsetEndLabelsFigureCommand >> isCurrentStyle: aStyle [ | ||
|
||
aStyle ifNil: [ ^ true ]. | ||
^ (aStyle includesKey: | ||
OPUmlAssociationEndLabel showAssociationEndLabelsKey) not | ||
] |