Skip to content

Commit

Permalink
Merge pull request #37 from OpenSmock/Issues_0019
Browse files Browse the repository at this point in the history
Issues 0019
  • Loading branch information
Nyan11 authored Jul 27, 2023
2 parents 91e8a46 + 70fbb61 commit c5efb80
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 125 deletions.
2 changes: 1 addition & 1 deletion src/Pyramid-Tests/PyramidSaveModelVerifierTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PyramidSaveModelVerifierTest >> testModelNilError [
| verifier |
verifier := PyramidSaveModelVerifier modelNotNil.
verifier verify: nil. "Send a nil model"
verifier showOn: PyramidSaveInputsView new.
verifier showOn: PyramidSaveProjectConfigurationView new.
]

{ #category : #test }
Expand Down
84 changes: 0 additions & 84 deletions src/Pyramid/PyramidSaveInputsController.class.st

This file was deleted.

19 changes: 9 additions & 10 deletions src/Pyramid/PyramidSavePlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Class {
'inputsButton',
'savingService',
'saveButton',
'inputsPopover',
'projectModel'
],
#category : #'Pyramid-plugin-save'
Expand Down Expand Up @@ -59,29 +58,27 @@ PyramidSavePlugin >> connectOn: aPyramidEditor [
{ #category : #initialization }
PyramidSavePlugin >> initialize [

inputsController := PyramidSaveInputsController new.
inputsController := PyramidSaveProjectConfigurationController new.
inputsView := inputsController view.
saveModel := inputsController model.

savingService := PyramidSavingService new
savingModel: saveModel;

methodBuilder: PyramidSavingMethodBuilder ston;
yourself.

inputsButton := SpButtonPresenter new
icon: (self iconNamed: #smallRemoteOpen);
help: 'Project configuration';
action: [ inputsPopover popup ];
yourself.
inputsPopover := PyramidPopoverFactory
help: 'Project configuration';
action: [( PyramidPopoverFactory
makeWithPresenter: inputsView
relativeTo: inputsButton
position: SpPopoverPosition right.
position: SpPopoverPosition right) popup. ];
yourself.

saveButton := SpButtonPresenter new
icon: (self iconNamed: #smallSave);
help: 'Save project';
help: 'Save project';
action: [ self saveAction ];
yourself
]
Expand Down Expand Up @@ -109,7 +106,9 @@ PyramidSavePlugin >> openOn: aSaveModel [

self inputsView inputClass text: aSaveModel savingClassName.
self inputsView inputMethod text: aSaveModel savingMethodName.
self inputsView inputPackage text: aSaveModel savingPackageName
self inputsView inputPackage text: aSaveModel savingPackageName.
aSaveModel isClassSide ifTrue: [ self inputsView buttonClass click ] ifFalse: [ self inputsView buttonInstance click ]

]

{ #category : #accessing }
Expand Down
105 changes: 105 additions & 0 deletions src/Pyramid/PyramidSaveProjectConfigurationController.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
Class {
#name : #PyramidSaveProjectConfigurationController,
#superclass : #Object,
#instVars : [
'view',
'model',
'verifier'
],
#category : #'Pyramid-plugin-save'
}

{ #category : #tests }
PyramidSaveProjectConfigurationController >> browseProjectClass [

| class |
class := self class environment classNamed:
self model savingClassName.
class ifNil: [
UIManager default inform: 'Class do not exist yet. It will be created the first time you saved it.'.
^ self ].
self model isClassSide
ifTrue: [
Smalltalk tools browser
openOnClass: class class
selector: self model savingMethodName ]
ifFalse: [
Smalltalk tools browser
openOnClass: class
selector: self model savingMethodName ]
]

{ #category : #accessing }
PyramidSaveProjectConfigurationController >> model [

model ifNil: [ model := PyramidSaveModel new ].
^ model
]

{ #category : #accessing }
PyramidSaveProjectConfigurationController >> model: aPyramidSaveModel [

model := aPyramidSaveModel.
self view model: aPyramidSaveModel
]

{ #category : #'as yet unclassified' }
PyramidSaveProjectConfigurationController >> radioUpdatedOnClassSide: aBoolean [

aBoolean
ifTrue: [ self model onClass ]
ifFalse: [ self model onInstance ]. self updateView
]

{ #category : #'as yet unclassified' }
PyramidSaveProjectConfigurationController >> textUpdatedFromClass: aString [

self model savingClassName: aString.
self updateView
]

{ #category : #'as yet unclassified' }
PyramidSaveProjectConfigurationController >> textUpdatedFromMethod: aString [

self model savingMethodName: aString.
self updateView
]

{ #category : #'as yet unclassified' }
PyramidSaveProjectConfigurationController >> textUpdatedFromPackage: aString [

self model savingPackageName: aString.
self updateView
]

{ #category : #'as yet unclassified' }
PyramidSaveProjectConfigurationController >> updateView [

| errors |
errors := self verifier allErrors: self model.
self view hideLabels.
self view buttonBrowse enabled: errors isEmpty.
errors do: [ :each | each showOn: self view ]
]

{ #category : #accessing }
PyramidSaveProjectConfigurationController >> verifier [

verifier ifNil: [
verifier := PyramidSaveModelVerifier verifierNoErrorForInputsView ].
^ verifier
]

{ #category : #accessing }
PyramidSaveProjectConfigurationController >> view [

view ifNil: [ view := PyramidSaveProjectConfigurationView new.
view controller: self; model: self model ].
^ view
]

{ #category : #accessing }
PyramidSaveProjectConfigurationController >> view: anObject [

view := anObject
]
Loading

0 comments on commit c5efb80

Please sign in to comment.