Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues 0019 #37

Merged
merged 4 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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