Skip to content

Commit

Permalink
Renames package. Scopes creation with names is working
Browse files Browse the repository at this point in the history
  • Loading branch information
carolahp committed Oct 9, 2023
1 parent 65d46ed commit 988ce83
Show file tree
Hide file tree
Showing 17 changed files with 862 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/NewTools-Scopes-Browser/RPackage.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Extension { #name : 'RPackage' }

{ #category : '*NewTools-Scopes-Browser' }
RPackage >> scopesIconName [
^ #package
]
26 changes: 26 additions & 0 deletions src/NewTools-Scopes-Browser/ScopeAbstractPresenter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Class {
#name : 'ScopeAbstractPresenter',
#superclass : 'SpPresenter',
#instVars : [
'model'
],
#category : 'NewTools-Scopes-Browser-GUI',
#package : 'NewTools-Scopes-Browser',
#tag : 'GUI'
}

{ #category : 'accessing' }
ScopeAbstractPresenter >> announcer [
^ model announcer
]

{ #category : 'private - presenters' }
ScopeAbstractPresenter >> newScopeTree [
^ self instantiate: ScopeTreePresenter
]

{ #category : 'accessing - model' }
ScopeAbstractPresenter >> setModelBeforeInitialization: aDomainObject [

model := aDomainObject
]
23 changes: 23 additions & 0 deletions src/NewTools-Scopes-Browser/ScopeClassNode.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Class {
#name : 'ScopeClassNode',
#superclass : 'ScopeNode',
#category : 'NewTools-Scopes-Browser-Nodes',
#package : 'NewTools-Scopes-Browser',
#tag : 'Nodes'
}

{ #category : 'accessing' }
ScopeClassNode >> children [

^ #( )
]

{ #category : 'accessing' }
ScopeClassNode >> isClassOrTraitNode [
^ true
]

{ #category : 'accessing' }
ScopeClassNode >> scopesIconName [
^ #class
]
71 changes: 71 additions & 0 deletions src/NewTools-Scopes-Browser/ScopeNamePresenter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Class {
#name : 'ScopeNamePresenter',
#superclass : 'ScopeAbstractPresenter',
#instVars : [
'textInput'
],
#category : 'NewTools-Scopes-Browser-GUI',
#package : 'NewTools-Scopes-Browser',
#tag : 'GUI'
}

{ #category : 'layout' }
ScopeNamePresenter class >> defaultLayout [

^ SpBoxLayout newTopToBottom
add: (SpBoxLayout newLeftToRight
add: 'Nombre';
add: #textInput
expand: true
fill: true
padding: 0;
yourself)
expand: false
]

{ #category : 'layout' }
ScopeNamePresenter class >> title [
^ 'Scope name?'
]

{ #category : 'announcements' }
ScopeNamePresenter >> announceNewScope [

self announcer announce: (NewScopeAnnouncement new)
]

{ #category : 'initialize-release' }
ScopeNamePresenter >> close [
self window close
]

{ #category : 'initialization' }
ScopeNamePresenter >> initializePresenters [

textInput := self newTextInput.
self initializeTextInput
]

{ #category : 'initialization' }
ScopeNamePresenter >> initializeTextInput [
textInput
placeholder: 'Enter the name of the scope';
autoAccept: false;
whenSubmitDo: [ :text |
self validate.
model newScope label: text.
self announceNewScope.
self close ]
]

{ #category : 'initialization' }
ScopeNamePresenter >> validate [

self assert: textInput text isNotEmpty
]

{ #category : 'enumerating' }
ScopeNamePresenter >> whenSubmitDo: aBlock [

textInput whenSubmitDo: aBlock
]
101 changes: 101 additions & 0 deletions src/NewTools-Scopes-Browser/ScopeNode.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
"
I am wrapper for classes, packages and class hierarchies to be used in the ScopeNodesTree
"
Class {
#name : 'ScopeNode',
#superclass : 'Object',
#instVars : [
'value',
'packages'
],
#category : 'NewTools-Scopes-Browser-Nodes',
#package : 'NewTools-Scopes-Browser',
#tag : 'Nodes'
}

{ #category : 'instance creation' }
ScopeNode class >> on: aPackageOrClass [

self class == ScopeNode ifTrue: [
self error: 'I am ab abstract class' ].

^ self new
value: aPackageOrClass;
yourself
]

{ #category : 'accessing' }
ScopeNode >> <= aNode [
^ self label <= aNode label
]

{ #category : 'accessing' }
ScopeNode >> = anotherNode [

^ (self class = anotherNode class)
and: [ self label = anotherNode label ]
]

{ #category : 'accessing' }
ScopeNode >> basicEqualsTo: aNode [

^ self value = aNode value
]

{ #category : 'accessing' }
ScopeNode >> children [
self subclassResponsibility
]

{ #category : 'accessing' }
ScopeNode >> definedClasses [
^#()
]

{ #category : 'testing' }
ScopeNode >> isClassOrTraitNode [
^ false
]

{ #category : 'testing' }
ScopeNode >> isPackageNode [
^ false
]

{ #category : 'accessing' }
ScopeNode >> label [
^ self value name
]

{ #category : 'accessing' }
ScopeNode >> name [
^ value name
]

{ #category : 'accessing' }
ScopeNode >> package [
^ value package
]

{ #category : 'accessing' }
ScopeNode >> printOn: aStream [

aStream
nextPutAll: self class name , '(' , self label;
nextPutAll: ')'
]

{ #category : 'accessing' }
ScopeNode >> scopesIconName [
self subclassResponsibility
]

{ #category : 'accessing' }
ScopeNode >> value [
^ value
]

{ #category : 'accessing' }
ScopeNode >> value: aPackageOrClass [
value := aPackageOrClass
]
Loading

0 comments on commit 988ce83

Please sign in to comment.