File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ Class {
2020 #tag : ' Plugin'
2121}
2222
23+ { #category : ' testing' }
24+ OPPlugin class >> isTestingOnly [
25+
26+ ^ false
27+ ]
28+
2329{ #category : ' accessing' }
2430OPPlugin >> diagramClass [
2531 self
@@ -55,7 +61,7 @@ OPPlugin >> layouterClass [
5561 ^ self subclassResponsibility
5662]
5763
58- { #category : ' as yet unclassified ' }
64+ { #category : ' model updates ' }
5965OPPlugin >> mergeModels: aModelsCollection [
6066
6167 self notYetImplemented
Original file line number Diff line number Diff line change @@ -26,16 +26,26 @@ OPPluginRegistry class >> default [
2626
2727{ #category : ' singleton' }
2828OPPluginRegistry class >> resetDefault [
29+
2930 < script>
30- ^ Default := nil
31+ ^ self setDefault: nil
3132]
3233
3334{ #category : ' singleton' }
3435OPPluginRegistry class >> setDefault: aDefault [
35- < script >
36+
3637 ^ Default := aDefault
3738]
3839
40+ { #category : ' singleton' }
41+ OPPluginRegistry class >> setDefaultForTesting [
42+
43+ < script>
44+ ^ self setDefault: (self new
45+ add: OPTestPlugin new ;
46+ yourself )
47+ ]
48+
3949{ #category : ' instance creation' }
4050OPPluginRegistry class >> withAll [
4151 ^ self new
@@ -50,12 +60,11 @@ OPPluginRegistry >> add: aPlugin [
5060
5161{ #category : ' adding' }
5262OPPluginRegistry >> addAll [
53- plugins := OrderedCollection new .
54- OPPlugin
55- allSubclassesWithLevelDo: [ :each :level |
56- level > 0
57- ifTrue: [ plugins add: each new ] ]
58- startingLevel: 0
63+
64+ plugins := OPPlugin allSubclasses
65+ reject: [ :each |
66+ each isAbstract or : [ each isTestingOnly ] ]
67+ thenCollect: [ :each | each new ]
5968]
6069
6170{ #category : ' accessing' }
Original file line number Diff line number Diff line change @@ -12,10 +12,11 @@ Class {
1212
1313{ #category : ' running' }
1414OPProjectControllerTest >> setUp [
15+
1516 controller := OPProjectController new .
1617 project := OPProject new .
1718 controller project: project.
18- OPPluginRegistry setDefault: ( OPPluginRegistry new add: OPTestPlugin new )
19+ OPPluginRegistry setDefaultForTesting
1920]
2021
2122{ #category : ' running' }
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ Class {
1414
1515{ #category : ' running' }
1616OPProjectDirectoryMaterializerTest >> setUp [
17+
1718 super setUp.
18- OPPluginRegistry setDefault: ( OPPluginRegistry new add: OPTestPlugin new ) .
19+ OPPluginRegistry setDefaultForTesting .
1920 reader := OPProjectDirectoryMaterializer new .
2021 self setUpBasicProject
2122]
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ Class {
1111
1212{ #category : ' running' }
1313OPProjectDirectorySerializerTest >> setUp [
14+
1415 super setUp.
1516 persistence := OPProjectDirectorySerializer new .
16- OPPluginRegistry setDefault: ( OPPluginRegistry new add: OPTestPlugin new )
17+ OPPluginRegistry setDefaultForTesting
1718]
1819
1920{ #category : ' running' }
Original file line number Diff line number Diff line change @@ -6,12 +6,18 @@ Instead set & reset the default of DCPluginRegistry.
66"
77Class {
88 #name : ' OPTestPlugin' ,
9- #superclass : ' Object ' ,
9+ #superclass : ' OPPlugin ' ,
1010 #category : ' OpenPonk-Core-Tests' ,
1111 #package : ' OpenPonk-Core' ,
1212 #tag : ' Tests'
1313}
1414
15+ { #category : ' testing' }
16+ OPTestPlugin class >> isTestingOnly [
17+
18+ ^ true
19+ ]
20+
1521{ #category : ' accessing' }
1622OPTestPlugin >> diagramControllerClass [
1723 ^ OPTestDiagramController
@@ -27,6 +33,13 @@ OPTestPlugin >> isPluginFor: aModel [
2733 ^ self modelClass = aModel class
2834]
2935
36+ { #category : ' accessing' }
37+ OPTestPlugin >> layouterClass [
38+ " Create your own subclass of OPLayouter or use OPNoLayouter which does nothing"
39+
40+ ^ OPNoLayouter
41+ ]
42+
3043{ #category : ' accessing' }
3144OPTestPlugin >> modelClass [
3245 ^ OPTestContainerModel
Original file line number Diff line number Diff line change @@ -64,7 +64,6 @@ OPModelTreeWidget >> doubleClick [
6464 OPPluginRegistry default plugins
6565 detect: [ :each | each modelClass = element class ]
6666 ifFound: [ self openCommand: element ]
67- ifNone: [ ]
6867]
6968
7069{ #category : ' menu commands' }
Original file line number Diff line number Diff line change @@ -26,26 +26,6 @@ OPRoassalShapeCommand class >> contextMenuActivation [
2626 ^ CmdContextMenuActivation byRootGroupItemFor: OPCanvasPresenter
2727]
2828
29- { #category : ' example' }
30- OPRoassalShapeCommand class >> example [
31- | proj model |
32- proj := OPProject new .
33- model := OPTestContainerModel new .
34- model entities add: OPTestEntityModel new .
35- proj addModel: model.
36- proj open
37- ]
38-
39- { #category : ' example' }
40- OPRoassalShapeCommand class >> example2 [
41- | c a |
42- c := OPCanvasPresenter new .
43- a := CmdContextMenuActivation
44- buildContextMenuFor: c
45- inContext: (OPRoassalShapeContext for: c).
46- a openInWindow
47- ]
48-
4929{ #category : ' testing' }
5030OPRoassalShapeCommand class >> isAbstract [
5131 ^ self = OPRoassalShapeCommand
You can’t perform that action at this time.
0 commit comments