Skip to content

Commit

Permalink
Remove depedent elements even when not shown
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Nov 2, 2024
1 parent ecaf4b1 commit 00c992c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions repository/OpenPonk-Spec/OPDiagramRemoveFigureCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,40 @@ OPDiagramRemoveFigureCommand >> executeWithConfirmation [
{ #category : 'execution' }
OPDiagramRemoveFigureCommand >> executeWithoutConfirmation [

| allShown |
diagramController deselectAll.

allShown := self showDependentAndReturnOriginallyShown.

figures do: [ :each |
(diagramController hasControllerForFigure: each) ifTrue: [
diagramController removeModelOfRoassalShape: each ] ].

self removeAllNotOriginallyShown: allShown.

canvas signalUpdate
]

{ #category : 'execution' }
OPDiagramRemoveFigureCommand >> removeAllNotOriginallyShown: allShown [

diagramController allVisibleShowableElements
reject: [ :any | allShown includes: any ]
thenDo: [ :each |
diagramController
controllerForModel: each
ifFound: [ :controller |
controller removeControllerAndDiagramElement ] ]
]

{ #category : 'execution' }
OPDiagramRemoveFigureCommand >> showDependentAndReturnOriginallyShown [

| executor allShown dependent |
executor := OPDiagramExplorer on: diagramController.
allShown := diagramController allVisibleShowableElements asSet.
dependent := models flatCollect: [ :each |
executor dependentFor: each ].
executor showElements: dependent.
^ allShown
]

0 comments on commit 00c992c

Please sign in to comment.