diff --git a/src/Pyramid-Bloc/PyramidAbstractColumnsBuilder.class.st b/src/Pyramid-Bloc/PyramidAbstractColumnsBuilder.class.st new file mode 100644 index 00000000..afe4b59d --- /dev/null +++ b/src/Pyramid-Bloc/PyramidAbstractColumnsBuilder.class.st @@ -0,0 +1,34 @@ +Class { + #name : #PyramidAbstractColumnsBuilder, + #superclass : #Object, + #instVars : [ + 'editor' + ], + #category : #'Pyramid-Bloc-plugin-tree-library' +} + +{ #category : #testing } +PyramidAbstractColumnsBuilder class >> isAbstract [ + + ^ self == PyramidAbstractColumnsBuilder +] + +{ #category : #'as yet unclassified' } +PyramidAbstractColumnsBuilder >> buildOn: aPyramidTreePlugin [ +"aPyramidTreePlugin addColumns: { }" + self shouldBeImplemented + +] + +{ #category : #accessing } +PyramidAbstractColumnsBuilder >> editor [ + + editor ifNil: [ Error signal: 'Editor should not be nil.' ]. + ^ editor +] + +{ #category : #accessing } +PyramidAbstractColumnsBuilder >> editor: anObject [ + + editor := anObject +] diff --git a/src/Pyramid-Bloc/PyramidLibraryPresenter.class.st b/src/Pyramid-Bloc/PyramidLibraryPresenter.class.st index 8f10d4d4..0ca3a40e 100644 --- a/src/Pyramid-Bloc/PyramidLibraryPresenter.class.st +++ b/src/Pyramid-Bloc/PyramidLibraryPresenter.class.st @@ -8,23 +8,26 @@ Class { 'addButton', 'idGenerator' ], + #classVars : [ + 'IdGenerator' + ], #category : #'Pyramid-Bloc-plugin-tree-library' } { #category : #accessing } -PyramidLibraryPresenter class >> idGenerator [ +PyramidLibraryPresenter class >> makeIdGenerator [ ^ Generator on: [ :generator | - | index | - index := 1. - [ - Character alphabet do: [ :each | - | next suffix | - next := each asUppercase asString. - suffix := index = 1 - ifTrue: [ '' ] - ifFalse: [ index asString ]. - generator yield: next , suffix ]. - index := index + 1 ] repeat ]. + | index | + index := 1. + [ + Character alphabet do: [ :each | + | next suffix | + next := each asUppercase asString. + suffix := index = 1 + ifTrue: [ '' ] + ifFalse: [ index asString ]. + generator yield: next , suffix ]. + index := index + 1 ] repeat ] ] { #category : #initialization } @@ -92,7 +95,7 @@ PyramidLibraryPresenter >> defaultLayout [ expand: false; yourself) width: 300; - yourself) + yourself); yourself ] { #category : #accessing } @@ -109,6 +112,7 @@ PyramidLibraryPresenter >> editor: aPyramidEditor [ { #category : #accessing } PyramidLibraryPresenter >> idGenerator [ + idGenerator ifNil: [ idGenerator := self class makeIdGenerator ]. ^ idGenerator ] @@ -121,8 +125,6 @@ PyramidLibraryPresenter >> idGenerator: anObject [ { #category : #initialization } PyramidLibraryPresenter >> initializePresenters [ - idGenerator := self class idGenerator. - addButton := SpButtonPresenter new label: self buttonLabel; action: [ self buttonAction ]; diff --git a/src/Pyramid-Bloc/PyramidPluginTestModeTest.class.st b/src/Pyramid-Bloc/PyramidPluginTestModeTest.class.st new file mode 100644 index 00000000..640a965e --- /dev/null +++ b/src/Pyramid-Bloc/PyramidPluginTestModeTest.class.st @@ -0,0 +1,81 @@ +Class { + #name : #PyramidPluginTestModeTest, + #superclass : #TestCase, + #instVars : [ + 'plugin', + 'spacePlugin', + 'editor' + ], + #category : #'Pyramid-Bloc-plugin-testmode' +} + +{ #category : #accessing } +PyramidPluginTestModeTest >> editor [ +^ editor +] + +{ #category : #accessing } +PyramidPluginTestModeTest >> plugin [ + + ^ plugin +] + +{ #category : #running } +PyramidPluginTestModeTest >> setUp [ + + super setUp. + + plugin := PyramidPluginTestMode new. + spacePlugin := PyramidSpacePlugin new. + editor := PyramidEditorBuilder new plugins: { plugin . spacePlugin }; build. +] + +{ #category : #tests } +PyramidPluginTestModeTest >> testIsTestOnGoing [ + + self assert: self plugin isTestOnGoing not. + self plugin switchToTestMode. + self assert: self plugin isTestOnGoing. + self plugin switchToTestMode. + self assert: self plugin isTestOnGoing not. +] + +{ #category : #tests } +PyramidPluginTestModeTest >> testSwitchToTestMode [ + + | element elementThatReceiveEvent | + element := BlElement new + size: 500 asPoint; + background: Color blue; + addEventHandler: (BlEventHandler + on: BlPrimaryClickEvent + do: [ :evt | ]); + yourself. + self plugin elementAtEvents addEventHandler: (BlEventHandler + on: BlPrimaryClickEvent + do: [ :evt | ]). + self editor projectModel firstLevelElements add: element. + + self plugin elementAtMain forceLayout. + elementThatReceiveEvent := self plugin elementAtMain + findMouseEventTargetAt: + 10 asPoint + + self plugin currentTransformTranslation. + self deny: elementThatReceiveEvent equals: element. + + self plugin switchToTestMode. + self plugin elementAtMain forceLayout. + elementThatReceiveEvent := self plugin elementAtMain + findMouseEventTargetAt: + 10 asPoint + + self plugin currentTransformTranslation. + self assert: elementThatReceiveEvent equals: element. + + self plugin switchToTestMode. + self plugin elementAtMain forceLayout. + elementThatReceiveEvent := self plugin elementAtMain + findMouseEventTargetAt: + 10 asPoint + + self plugin currentTransformTranslation. + self deny: elementThatReceiveEvent equals: element +] diff --git a/src/Pyramid-Bloc/PyramidTreeBaseColumnsBuilder.class.st b/src/Pyramid-Bloc/PyramidTreeBaseColumnsBuilder.class.st new file mode 100644 index 00000000..ed894e52 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidTreeBaseColumnsBuilder.class.st @@ -0,0 +1,94 @@ +Class { + #name : #PyramidTreeBaseColumnsBuilder, + #superclass : #PyramidAbstractColumnsBuilder, + #category : #'Pyramid-Bloc-plugin-tree-library' +} + +{ #category : #'as yet unclassified' } +PyramidTreeBaseColumnsBuilder >> buildOn: aPyramidTreePlugin [ + + aPyramidTreePlugin addColumns: { self nameAndTypeColumn . self hashColumn . self zIndexColumn . self visibilityColumn } +] + +{ #category : #accessing } +PyramidTreeBaseColumnsBuilder >> hashColumn [ + + ^ SpStringTableColumn new + title: 'Hash'; + evaluated: [ :aBlElement | + aBlElement identityHash printString ]; + displayColor: [ :aBlElement | Color gray ]; + width: 60; + yourself +] + +{ #category : #accessing } +PyramidTreeBaseColumnsBuilder >> nameAndTypeColumn [ + + ^ SpCompositeTableColumn new + title: 'Elements'; + addColumn: + (SpImageTableColumn evaluated: [ :aBlElement | aBlElement asIcon ]); + addColumn: (SpStringTableColumn new + title: 'Identifier'; + evaluated: [ :aBlElement | + aBlElement elementId isNoId + ifTrue: [ '@\no name\' ] + ifFalse: [ aBlElement id asSymbol ] ]; + yourself); + addColumn: (SpStringTableColumn new + title: 'Class'; + evaluated: [ :aBlElement | aBlElement class name ]; + displayColor: [ :aBlElement | Color gray ]; + displayItalic: [ :aBlElement | true ]; + yourself); + yourself +] + +{ #category : #initialization } +PyramidTreeBaseColumnsBuilder >> setVisibility: aBlVisibility of: aBlElement onEditor: aPyramidEditor [ + + aPyramidEditor propertiesManager commandExecutor + use: PyramidVisibilityCommand new + on: { aBlElement } + with: aBlVisibility +] + +{ #category : #accessing } +PyramidTreeBaseColumnsBuilder >> visibilityColumn [ + + ^ SpCompositeTableColumn new + title: 'Visibility'; + width: 80; + addColumn: (SpImageTableColumn evaluated: [ :aBlElement | + aBlElement + allParentsDetect: [ :parent | parent isVisible not ] + ifFound: [ :parent | self iconNamed: #uncommentedClass ] + ifNone: [ self iconNamed: #blank16 ] ]); + addColumn: (SpImageTableColumn evaluated: [ :aBlElement | + aBlElement visibility asIcon ]); + addColumn: (SpLinkTableColumn new + title: 'Visible'; + url: [ :aBlElement | '' ]; + action: [ :aBlElement | + self + setVisibility: aBlElement visibility nextVisibilityForTree + of: aBlElement + onEditor: self editor ]; + evaluated: [ :aBlElement | aBlElement visibility asString ]; + yourself); + yourself +] + +{ #category : #accessing } +PyramidTreeBaseColumnsBuilder >> zIndexColumn [ + + ^ SpStringTableColumn new + title: 'z'; + evaluated: [ :aBlElement | + aBlElement elevation elevation = 0 + ifTrue: [ '' ] + ifFalse: [ aBlElement elevation elevation printString ] ]; + width: 16; + yourself +] diff --git a/src/Pyramid-Bloc/PyramidTreePlugin.class.st b/src/Pyramid-Bloc/PyramidTreePlugin.class.st index 1375c546..b6c0ee2b 100644 --- a/src/Pyramid-Bloc/PyramidTreePlugin.class.st +++ b/src/Pyramid-Bloc/PyramidTreePlugin.class.st @@ -9,89 +9,33 @@ Class { 'libraryPresenterForElement', 'libraryPresenterForRoot' ], + #classVars : [ + 'ColumnsBuildersClasses' + ], #category : #'Pyramid-Bloc-plugin-tree-library' } -{ #category : #'as yet unclassified' } -PyramidTreePlugin class >> columnHashValue: aPyramidTreePlugin [ - - ^ SpStringTableColumn new - title: 'Hash'; - evaluated: [ :aBlElement | aBlElement identityHash printString ]; - displayColor: [ :aBlElement | Color gray ]; - width: 60; - yourself -] +{ #category : #accessing } +PyramidTreePlugin class >> columnsBuildersClasses [ -{ #category : #'as yet unclassified' } -PyramidTreePlugin class >> columnNameAndType: aPyramidTreePlugin [ - - ^ SpCompositeTableColumn new - title: 'Elements'; - addColumn: - (SpImageTableColumn evaluated: [ :aBlElement | aBlElement asIcon ]); - addColumn: (SpStringTableColumn new - title: 'Identifier'; - evaluated: [ :aBlElement | - aBlElement elementId isNoId - ifTrue: [ '@\no name\' ] - ifFalse: [ aBlElement id asSymbol ] ]; - yourself); - addColumn: (SpStringTableColumn new - title: 'Class'; - evaluated: [ :aBlElement | aBlElement class name ]; - displayColor: [ :aBlElement | Color gray ]; - displayItalic: [ :aBlElement | true ]; - yourself); - yourself + ColumnsBuildersClasses ifNil: [ + ColumnsBuildersClasses := Set new ]. + ^ ColumnsBuildersClasses ] -{ #category : #'as yet unclassified' } -PyramidTreePlugin class >> columnVisibility: aPyramidTreePlugin [ - - ^ SpCompositeTableColumn new - title: 'Visibility'; - width: 80; - addColumn: (SpImageTableColumn evaluated: [ :aBlElement | - aBlElement - allParentsDetect: [ :parent | parent isVisible not ] - ifFound: [ :parent | self iconNamed: #uncommentedClass ] - ifNone: [ self iconNamed: #blank16 ] ]); - addColumn: (SpImageTableColumn evaluated: [ :aBlElement | - aBlElement visibility asIcon ]); - addColumn: (SpLinkTableColumn new - title: 'Visible'; - url: [ :aBlElement | '' ]; - action: [ :aBlElement | - self - setVisibility: aBlElement visibility nextVisibilityForTree - of: aBlElement - onEditor: aPyramidTreePlugin editor ]; - evaluated: [ :aBlElement | aBlElement visibility asString ]; - yourself); - yourself -] +{ #category : #initialization } +PyramidTreePlugin class >> install [ + "Do some stuff here when the plugin used class oriented behavior" -{ #category : #'as yet unclassified' } -PyramidTreePlugin class >> columnZIndex: aPyramidTreePlugin [ - - ^ SpStringTableColumn new - title: 'z'; - evaluated: [ :aBlElement | - aBlElement elevation elevation = 0 - ifTrue: [ '' ] - ifFalse: [ aBlElement elevation elevation printString ] ]; - width: 16; - yourself + self columnsBuildersClasses add: PyramidTreeBaseColumnsBuilder ] { #category : #initialization } -PyramidTreePlugin class >> setVisibility: aBlVisibility of: aBlElement onEditor: aPyramidEditor [ +PyramidTreePlugin >> addColumns: aCollection [ + aCollection do: [ :each | self treePresenter columns add: each ]. + self treePresenter updateTree - aPyramidEditor propertiesManager commandExecutor - use: PyramidVisibilityCommand new - on: { aBlElement } - with: aBlVisibility + ] { #category : #adding } @@ -109,13 +53,19 @@ PyramidTreePlugin >> addPanelsOn: aPyramidSimpleWindow [ addItem: [ :builder | self menuAddAndDeleteOn: builder ] ] +{ #category : #actions } +PyramidTreePlugin >> configureBuilder: aPyramidEditorBuilder [ + + self class columnsBuildersClasses do: [ :each | + each new + editor: aPyramidEditorBuilder editor; + buildOn: self ] +] + { #category : #connecting } PyramidTreePlugin >> connectOn: aPyramidEditor [ self editor: aPyramidEditor. - self treePresenter projectModel: aPyramidEditor projectModel. - self treePresenter editorMenuBuilder: - (self editor window services at: #selectionMenu) builder ] { #category : #accessing } @@ -125,11 +75,14 @@ PyramidTreePlugin >> editor [ ] { #category : #accessing } -PyramidTreePlugin >> editor: anObject [ +PyramidTreePlugin >> editor: aPyramidEditor [ - editor := anObject. - self libraryPresenterForElement editor: anObject. - self libraryPresenterForRoot editor: anObject. + editor := aPyramidEditor. + self libraryPresenterForElement editor: aPyramidEditor. + self libraryPresenterForRoot editor: aPyramidEditor. + self treePresenter projectModel: aPyramidEditor projectModel. + self treePresenter editorMenuBuilder: + (self editor window services at: #selectionMenu) builder ] { #category : #initialization } @@ -139,35 +92,25 @@ PyramidTreePlugin >> initialize [ treePresenter := PyramidTreePresenter new libraryPresenterForRoot: self libraryPresenterForRoot; - yourself. - self initializeTreeColumns. + yourself ] { #category : #initialization } PyramidTreePlugin >> initializeLibraryPresenters [ | idGenerator | - idGenerator := PyramidLibraryPresenter idGenerator. + idGenerator := PyramidLibraryPresenter makeIdGenerator. libraryPresenterForElement := PyramidLibraryPresenterForElement new editor: self editor; - idGenerator: idGenerator; + idGenerator: idGenerator; yourself. - libraryPresenterForRoot := PyramidLibraryPresenterForFirstLevelElement new + libraryPresenterForRoot := PyramidLibraryPresenterForFirstLevelElement + new editor: self editor; - idGenerator: idGenerator; + idGenerator: idGenerator; yourself ] -{ #category : #initialization } -PyramidTreePlugin >> initializeTreeColumns [ - - self treePresenter columns add: (self class columnNameAndType: self). - self treePresenter columns add: (self class columnHashValue: self). - self treePresenter columns add: (self class columnZIndex: self). - self treePresenter columns add: (self class columnVisibility: self). - self treePresenter updateTree -] - { #category : #'as yet unclassified' } PyramidTreePlugin >> libraryPresenterForElement [ diff --git a/src/Pyramid-Tests/PyramidLibraryPresenterTest.class.st b/src/Pyramid-Tests/PyramidLibraryPresenterTest.class.st new file mode 100644 index 00000000..eb97f74f --- /dev/null +++ b/src/Pyramid-Tests/PyramidLibraryPresenterTest.class.st @@ -0,0 +1,26 @@ +Class { + #name : #PyramidLibraryPresenterTest, + #superclass : #TestCase, + #category : #'Pyramid-Tests-cases-plugin-tree-library' +} + +{ #category : #tests } +PyramidLibraryPresenterTest >> testIdGenerator [ + "We generate a bunch of id and we verify that none are the same" + + | treePlugin libraryPresForElements libraryPresForFirstLevel elements | + treePlugin := PyramidTreePlugin new. + libraryPresForElements := treePlugin libraryPresenterForElement. + libraryPresForFirstLevel := treePlugin libraryPresenterForRoot. + elements := Bag new. + 1 to: 100 do: [ :i | + elements add: + libraryPresForElements list selectedItem blockMaker value id + asSymbol ]. + 1 to: 100 do: [ :i | + elements add: + libraryPresForFirstLevel list selectedItem blockMaker value id + asSymbol ]. + self assert: elements size equals: 200. + self assert: elements asSet size equals: 200 +] diff --git a/src/Pyramid/PyramidSpCodeObjectInteractionModel.class.st b/src/Pyramid-Tests/PyramidSpCodeObjectInteractionModel.class.st similarity index 95% rename from src/Pyramid/PyramidSpCodeObjectInteractionModel.class.st rename to src/Pyramid-Tests/PyramidSpCodeObjectInteractionModel.class.st index 1e6bd904..c62298b3 100644 --- a/src/Pyramid/PyramidSpCodeObjectInteractionModel.class.st +++ b/src/Pyramid-Tests/PyramidSpCodeObjectInteractionModel.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'projectModel' ], - #category : #'Pyramid-plugin-selection' + #category : #'Pyramid-Tests-cases-plugin-playground' } { #category : #accessing } diff --git a/src/Pyramid-Tests/PyramidSpCodeObjectInteractionModelTest.class.st b/src/Pyramid-Tests/PyramidSpCodeObjectInteractionModelTest.class.st new file mode 100644 index 00000000..3f33af93 --- /dev/null +++ b/src/Pyramid-Tests/PyramidSpCodeObjectInteractionModelTest.class.st @@ -0,0 +1,85 @@ +Class { + #name : #PyramidSpCodeObjectInteractionModelTest, + #superclass : #TestCase, + #instVars : [ + 'projectModel', + 'interactionModel', + 'firstLevelElements' + ], + #category : #'Pyramid-Tests-cases-plugin-playground' +} + +{ #category : #running } +PyramidSpCodeObjectInteractionModelTest >> firstLevelElements [ + + ^ firstLevelElements +] + +{ #category : #running } +PyramidSpCodeObjectInteractionModelTest >> interactionModel [ + + ^ interactionModel +] + +{ #category : #running } +PyramidSpCodeObjectInteractionModelTest >> projectModel [ + ^ projectModel +] + +{ #category : #running } +PyramidSpCodeObjectInteractionModelTest >> setUp [ + + super setUp. + + firstLevelElements := Object new. + projectModel := PyramidProjectModel new. + projectModel firstLevelElements add: firstLevelElements. + + interactionModel := PyramidSpCodeObjectInteractionModel new + projectModel: projectModel; + yourself +] + +{ #category : #tests } +PyramidSpCodeObjectInteractionModelTest >> testDoItReceiver [ + + | obj1 obj2 | + obj1 := Object new. + obj2 := Object new. + self projectModel setSelection: #( ). + self assert: (interactionModel doItReceiver isKindOf: Collection). + self assert: interactionModel doItReceiver size equals: 1. + self assert: + (interactionModel doItReceiver includes: self firstLevelElements). + + self projectModel setSelection: { obj1 }. + self assert: interactionModel doItReceiver equals: obj1. + + self projectModel setSelection: { + obj1. + obj2 }. + self assert: (interactionModel doItReceiver isKindOf: Collection). + self assert: interactionModel doItReceiver size equals: 2. + self assert: (interactionModel doItReceiver includes: obj1). + self assert: (interactionModel doItReceiver includes: obj2) +] + +{ #category : #tests } +PyramidSpCodeObjectInteractionModelTest >> testDoItReceiverString [ + + self projectModel setSelection: #( ). + self + assert: interactionModel doItReceiverString + equals: 'the collection of first level elements'. + + self projectModel setSelection: { 1 }. + self + assert: interactionModel doItReceiverString + equals: 'the selected element'. + + self projectModel setSelection: { 1. 2 }. + self assert: interactionModel doItReceiverString equals: 'an array of 2 selected elements'. + + self projectModel setSelection: { 1. 2. 3. 4. 5 }. + self assert: interactionModel doItReceiverString equals: 'an array of 5 selected elements' +] diff --git a/src/Pyramid-Tests/PyramidTreePluginTest.class.st b/src/Pyramid-Tests/PyramidTreePluginTest.class.st new file mode 100644 index 00000000..3ac7ded7 --- /dev/null +++ b/src/Pyramid-Tests/PyramidTreePluginTest.class.st @@ -0,0 +1,50 @@ +Class { + #name : #PyramidTreePluginTest, + #superclass : #TestCase, + #category : #'Pyramid-Tests-cases-plugin-tree-library' +} + +{ #category : #tests } +PyramidTreePluginTest >> testAddColumns [ + + | plugin | + plugin := PyramidTreePlugin new. + self assert: plugin treePresenter columns size equals: 0. + plugin addColumns: { SpStringTableColumn new + title: 'Test1'; + yourself. SpStringTableColumn new + title: 'Test2'; + yourself. SpStringTableColumn new + title: 'Test3'; + yourself }. + self assert: plugin treePresenter columns size equals: 3. +] + +{ #category : #tests } +PyramidTreePluginTest >> testRemoveSelectedElements [ + + | plugin editor e1 e2 e3 | + e1 := BlElement new. + e2 := BlElement new. + e3 := BlElement new. + editor := PyramidEditor new. + editor window: PyramidSimpleWindow new. + plugin := PyramidTreePlugin new. + plugin editor: editor. + editor projectModel addObserver: plugin treePresenter. + editor projectModel firstLevelElements addAll: { + e1. + e2. + e3 }. + editor projectModel setSelection: { + e1. + e2 }. + self assert: plugin treePresenter tree selectedItems size equals: 2. + self assert: (plugin treePresenter tree selectedItems includes: e1). + self assert: (plugin treePresenter tree selectedItems includes: e2). + plugin removeSelectedElements. + self assert: plugin treePresenter tree selectedItems size equals: 0. + self assert: editor projectModel selection size equals: 0. + self assert: editor projectModel firstLevelElements size equals: 1. + self assert: editor projectModel firstLevelElements first equals: e3. +] diff --git a/src/Pyramid/PyramidSelectionView.class.st b/src/Pyramid/PyramidPlaygroundView.class.st similarity index 65% rename from src/Pyramid/PyramidSelectionView.class.st rename to src/Pyramid/PyramidPlaygroundView.class.st index 380b9162..bbbb9dba 100644 --- a/src/Pyramid/PyramidSelectionView.class.st +++ b/src/Pyramid/PyramidPlaygroundView.class.st @@ -1,5 +1,5 @@ Class { - #name : #PyramidSelectionView, + #name : #PyramidPlaygroundView, #superclass : #SpPresenter, #traits : 'TPyramidProjectModelObserver', #classTraits : 'TPyramidProjectModelObserver classTrait', @@ -10,23 +10,23 @@ Class { 'codeObjectInteractionModel', 'contextLabel' ], - #category : #'Pyramid-plugin-selection' + #category : #'Pyramid-plugin-playground' } { #category : #accessing } -PyramidSelectionView >> contextLabel [ +PyramidPlaygroundView >> contextLabel [ ^ contextLabel ] { #category : #'as yet unclassified' } -PyramidSelectionView >> currentSelection [ +PyramidPlaygroundView >> currentSelection [ ^ self projectModel selection ] { #category : #layout } -PyramidSelectionView >> defaultLayout [ +PyramidPlaygroundView >> defaultLayout [ ^ SpPanedLayout newVertical add: (SpBoxLayout newVertical @@ -48,48 +48,53 @@ PyramidSelectionView >> defaultLayout [ ] { #category : #initialization } -PyramidSelectionView >> initializePresenters [ +PyramidPlaygroundView >> initializePresenters [ list := SpListPresenter new. - playground := PyramidSpCodePresenter new. + playground := SpCodePresenter new. contextLabel := SpLabelPresenter new. + + playground interactionModel: PyramidSpCodeObjectInteractionModel new. + playground announcer + when: SpCodeEvaluationSucceedAnnouncement + do: [ :ann | self projectModel informElementsChanged ] ] { #category : #accessing } -PyramidSelectionView >> list [ +PyramidPlaygroundView >> list [ ^ list ] { #category : #accessing } -PyramidSelectionView >> playground [ +PyramidPlaygroundView >> playground [ ^ playground ] { #category : #accessing } -PyramidSelectionView >> projectModel [ +PyramidPlaygroundView >> projectModel [ ^ projectModel ] { #category : #accessing } -PyramidSelectionView >> projectModel: aPyramidActiveProject [ +PyramidPlaygroundView >> projectModel: aPyramidActiveProject [ projectModel := aPyramidActiveProject. projectModel addObserver: self. - self playground projectModel: aPyramidActiveProject. + self playground interactionModel projectModel: aPyramidActiveProject. self pyramidSelectionChanged. ] { #category : #'as yet unclassified' } -PyramidSelectionView >> pyramidSelectionChanged [ +PyramidPlaygroundView >> pyramidSelectionChanged [ self list items: self currentSelection. contextLabel label: self valueOfSelf. ] { #category : #'as yet unclassified' } -PyramidSelectionView >> valueOfSelf [ +PyramidPlaygroundView >> valueOfSelf [ ^ 'self is <1s>' expandMacrosWith: self playground interactionModel doItReceiverString diff --git a/src/Pyramid/PyramidPluginSelection.class.st b/src/Pyramid/PyramidPluginPlayground.class.st similarity index 62% rename from src/Pyramid/PyramidPluginSelection.class.st rename to src/Pyramid/PyramidPluginPlayground.class.st index 4b6ad465..9518fe54 100644 --- a/src/Pyramid/PyramidPluginSelection.class.st +++ b/src/Pyramid/PyramidPluginPlayground.class.st @@ -1,5 +1,5 @@ Class { - #name : #PyramidPluginSelection, + #name : #PyramidPluginPlayground, #superclass : #Object, #traits : 'TPyramidPlugin', #classTraits : 'TPyramidPlugin classTrait', @@ -7,11 +7,11 @@ Class { 'activeProject', 'view' ], - #category : #'Pyramid-plugin-selection' + #category : #'Pyramid-plugin-playground' } { #category : #adding } -PyramidPluginSelection >> addPanelsOn: aPyramidSimpleWindow [ +PyramidPluginPlayground >> addPanelsOn: aPyramidSimpleWindow [ aPyramidSimpleWindow at: #tabRight addItem: [ :builder | builder @@ -22,19 +22,19 @@ PyramidPluginSelection >> addPanelsOn: aPyramidSimpleWindow [ ] { #category : #connecting } -PyramidPluginSelection >> connectOn: aPyramidEditor [ +PyramidPluginPlayground >> connectOn: aPyramidEditor [ self view projectModel: aPyramidEditor projectModel ] { #category : #initialization } -PyramidPluginSelection >> initialize [ +PyramidPluginPlayground >> initialize [ - view := PyramidSelectionView new + view := PyramidPlaygroundView new ] { #category : #initialization } -PyramidPluginSelection >> view [ +PyramidPluginPlayground >> view [ ^ view ] diff --git a/src/Pyramid/PyramidProjectModelObserverForTest.class.st b/src/Pyramid/PyramidProjectModelObserverForTest.class.st new file mode 100644 index 00000000..71f13b43 --- /dev/null +++ b/src/Pyramid/PyramidProjectModelObserverForTest.class.st @@ -0,0 +1,73 @@ +Class { + #name : #PyramidProjectModelObserverForTest, + #superclass : #Object, + #traits : 'TPyramidProjectModelObserver', + #classTraits : 'TPyramidProjectModelObserver classTrait', + #instVars : [ + 'pyramidElementsChangedAction', + 'pyramidFirstLevelElementsChangedAction', + 'pyramidSelectionChangedAction' + ], + #category : #'Pyramid-plugin-playground' +} + +{ #category : #initialization } +PyramidProjectModelObserverForTest >> initialize [ + + self pyramidElementsChangedAction: [ ]. + self pyramidFirstLevelElementsChangedAction: [ ].self pyramidSelectionChangedAction: [ ] +] + +{ #category : #'as yet unclassified' } +PyramidProjectModelObserverForTest >> pyramidElementsChanged [ + + self pyramidElementsChangedAction value. +] + +{ #category : #accessing } +PyramidProjectModelObserverForTest >> pyramidElementsChangedAction [ + + ^ pyramidElementsChangedAction +] + +{ #category : #accessing } +PyramidProjectModelObserverForTest >> pyramidElementsChangedAction: anObject [ + + pyramidElementsChangedAction := anObject +] + +{ #category : #'as yet unclassified' } +PyramidProjectModelObserverForTest >> pyramidFirstLevelElementsChanged [ + + self pyramidFirstLevelElementsChangedAction value +] + +{ #category : #accessing } +PyramidProjectModelObserverForTest >> pyramidFirstLevelElementsChangedAction [ + + ^ pyramidFirstLevelElementsChangedAction +] + +{ #category : #accessing } +PyramidProjectModelObserverForTest >> pyramidFirstLevelElementsChangedAction: anObject [ + + pyramidFirstLevelElementsChangedAction := anObject +] + +{ #category : #'as yet unclassified' } +PyramidProjectModelObserverForTest >> pyramidSelectionChanged [ + + self pyramidSelectionChangedAction value +] + +{ #category : #accessing } +PyramidProjectModelObserverForTest >> pyramidSelectionChangedAction [ + + ^ pyramidSelectionChangedAction +] + +{ #category : #accessing } +PyramidProjectModelObserverForTest >> pyramidSelectionChangedAction: anObject [ + + pyramidSelectionChangedAction := anObject +] diff --git a/src/Pyramid/PyramidSpCodePresenter.class.st b/src/Pyramid/PyramidSpCodePresenter.class.st deleted file mode 100644 index e41ad189..00000000 --- a/src/Pyramid/PyramidSpCodePresenter.class.st +++ /dev/null @@ -1,36 +0,0 @@ -Class { - #name : #PyramidSpCodePresenter, - #superclass : #SpCodePresenter, - #category : #'Pyramid-plugin-selection' -} - -{ #category : #'command support' } -PyramidSpCodePresenter >> evaluate: aString onCompileError: compileErrorBlock onError: errorBlock [ - - | result | - result := super - evaluate: aString - onCompileError: compileErrorBlock - onError: errorBlock. - self projectModel informElementsChanged. - ^ result -] - -{ #category : #accessing } -PyramidSpCodePresenter >> initialize [ - - super initialize. - self interactionModel: PyramidSpCodeObjectInteractionModel new. -] - -{ #category : #accessing } -PyramidSpCodePresenter >> projectModel [ - - ^ self interactionModel projectModel -] - -{ #category : #accessing } -PyramidSpCodePresenter >> projectModel: aPyramidActiveProject [ - - self interactionModel projectModel: aPyramidActiveProject -]