Skip to content

Commit

Permalink
Merge pull request #47 from zweidenker/get-rid-of-beOfType
Browse files Browse the repository at this point in the history
Remove the need for beOfType: A handler is now installed whenever the…
  • Loading branch information
noha authored Mar 24, 2020
2 parents c369c32 + d4f04d7 commit 0247a85
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 41 deletions.
4 changes: 2 additions & 2 deletions source/SnapDump-Client/SnapDump.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Extension { #name : #SnapDump }
{ #category : #'*SnapDump-Client' }
SnapDump class >> client [
^ SDClient new
store: self current store;
store: self store;
yourself
]

{ #category : #'*SnapDump-Client' }
SnapDump class >> uri: aUri [
^ self current
^ self
store: (SDHTTPStore new uri: aUri asZnUrl);
yourself
]
47 changes: 20 additions & 27 deletions source/SnapDump-Core/SnapDump.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Class {
'store'
],
#classInstVars : [
'current'
'current',
'handler'
],
#category : #'SnapDump-Core-Base'
}
Expand All @@ -18,7 +19,7 @@ SnapDump class >> applyConfiguration: aConfig [

{ #category : #'as yet unclassified' }
SnapDump class >> beOfType: aSymbol [
current := (self withType: aSymbol) new
self deprecated: 'beOfType: is unnecessary now. Just remove calls to this method'
]

{ #category : #'as yet unclassified' }
Expand All @@ -31,51 +32,43 @@ SnapDump class >> configuration [

{ #category : #accessing }
SnapDump class >> current [
^ current ifNil: [
current := SDHandler new ]
^ current
]

{ #category : #'as yet unclassified' }
SnapDump class >> hackUIManager [
UIManager compile: 'logError: anError
SnapDump current handleException: anError.
super logError: anError'
{ #category : #accessing }
SnapDump class >> path: aPathString [
^ self
store: (SDFilesystemStore new path: aPathString asFileReference);
yourself
]

{ #category : #public }
SnapDump class >> handleException: exception [
^ self current handleException: exception
{ #category : #initialization }
SnapDump class >> reset [
current := nil
]

{ #category : #'as yet unclassified' }
SnapDump class >> handleSnapshot: aSnapshot [
^ self current handleSnapshot: aSnapshot
SnapDump class >> setCurrent: anObject [
current := anObject
]

{ #category : #accessing }
SnapDump class >> path: aPathString [
^ self current
store: (SDFilesystemStore new path: aPathString asFileReference);
yourself
SnapDump class >> store [
^ self current store
]

{ #category : #initialization }
SnapDump class >> reset [
current := nil
{ #category : #accessing }
SnapDump class >> store: aStore [
self current store: aStore
]

{ #category : #'as yet unclassified' }
SnapDump class >> uri: aUri username: aUsername password: aPassword [
^ self current store
^ self store
uri: aUri asZnUrl;
username: aUsername password: aPassword
]

{ #category : #'accessing structure variables' }
SnapDump class >> withType: aSymbol [
^ self allSubclasses detect: [ :each | each type = aSymbol ]
]

{ #category : #initialization }
SnapDump >> applyConfiguration: aConfig [
store := (SDStore withName: aConfig store) new.
Expand Down
29 changes: 19 additions & 10 deletions source/SnapDump-Handler/SnapDump.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@ Extension { #name : #SnapDump }

{ #category : #'*SnapDump-Handler' }
SnapDump class >> beHandler [
| handler |
handler := SDHandler new.
self setCurrent: handler.
^ handler
self deprecated: 'handlers are always present now. This call is not necessary anymore'
]

{ #category : #'*SnapDump-Handler' }
SnapDump class >> hackUIManager [
UIManager compile: 'logError: anError
SnapDump current handleException: anError.
super logError: anError'
]

{ #category : #'*SnapDump-Handler' }
SnapDump class >> handler [
^ SDHandler new
store: self current store;
yourself
SnapDump class >> handleException: exception [
^ self handler handleException: exception
]

{ #category : #'*SnapDump-Handler' }
SnapDump class >> setCurrent: anObject [
current := anObject
SnapDump class >> handleSnapshot: aSnapshot [
^ self handler handleSnapshot: aSnapshot
]

{ #category : #'*SnapDump-Handler' }
SnapDump class >> handler [
^ handler ifNil: [
handler := SDHandler new
store: self store;
yourself ]
]
2 changes: 1 addition & 1 deletion source/SnapDump-UI/SnapDump.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Extension { #name : #SnapDump }
{ #category : #'*SnapDump-UI' }
SnapDump class >> ui [
^ SnapDumpUI new
snapDump: (SDClient new store: self current store);
snapDump: self client;
openWithSpec
]
2 changes: 1 addition & 1 deletion source/SnapDump-UI/SnapDumpUI.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ SnapDumpUI >> subMenu [

^ MenuPresenter new
addGroup: [ :group |
SnapDump current projects do: [ :project |
client projects do: [ :project |
group addItem: [ :item |
item
name: project name;
Expand Down

0 comments on commit 0247a85

Please sign in to comment.