Tools_NamespaceList.st
changeset 8631 0178be4a8c65
parent 7706 92e3017d36b3
child 8696 2947b40f0218
equal deleted inserted replaced
8630:79c4f1e5da08 8631:0178be4a8c65
    95 
    95 
    96     <resource: #canvas>
    96     <resource: #canvas>
    97 
    97 
    98     ^ 
    98     ^ 
    99      #(#FullSpec
    99      #(#FullSpec
   100 	#name: #windowSpec
   100         #name: #windowSpec
   101 	#window: 
   101         #window: 
   102        #(#WindowSpec
   102        #(#WindowSpec
   103 	  #label: 'NamespaceList'
   103           #label: 'NamespaceList'
   104 	  #name: 'NamespaceList'
   104           #name: 'NamespaceList'
   105 	  #min: #(#Point 0 0)
   105           #min: #(#Point 0 0)
   106 	  #max: #(#Point 1024 721)
   106           #max: #(#Point 1024 721)
   107 	  #bounds: #(#Rectangle 13 23 313 323)
   107           #bounds: #(#Rectangle 13 23 313 323)
   108 	)
   108         )
   109 	#component: 
   109         #component: 
   110        #(#SpecCollection
   110        #(#SpecCollection
   111 	  #collection: #(
   111           #collection: #(
   112 	   #(#SequenceViewSpec
   112            #(#SequenceViewSpec
   113 	      #name: 'List'
   113               #name: 'List'
   114 	      #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   114               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   115 	      #tabable: true
   115               #tabable: true
   116 	      #model: #selectedNamespaces
   116               #model: #selectedNamespaces
   117 	      #menu: #menuHolder
   117               #menu: #menuHolder
   118 	      #hasHorizontalScrollBar: true
   118               #hasHorizontalScrollBar: true
   119 	      #hasVerticalScrollBar: true
   119               #hasVerticalScrollBar: true
   120 	      #miniScrollerHorizontal: true
   120               #miniScrollerHorizontal: true
   121 	      #isMultiSelect: true
   121               #isMultiSelect: true
   122 	      #valueChangeSelector: #selectionChangedByClick
   122               #valueChangeSelector: #selectionChangedByClick
   123 	      #useIndex: false
   123               #useIndex: false
   124 	      #sequenceList: #nameSpaceList
   124               #sequenceList: #nameSpaceList
   125 	      #doubleClickChannel: #doubleClickChannel
   125               #doubleClickChannel: #doubleClickChannel
   126 	    )
   126               #properties: 
   127 	   )
   127              #(#PropertyListDictionary
   128 
   128                 #dragArgument: nil
   129 	)
   129                 #dropArgument: nil
       
   130                 #canDropSelector: #canDropContext:
       
   131                 #dropSelector: #doDropContext:
       
   132               )
       
   133             )
       
   134            )
       
   135 
       
   136         )
   130       )
   137       )
   131 
   138 
   132     "Created: / 18.2.2000 / 01:06:05 / cg"
   139     "Created: / 18.2.2000 / 01:06:05 / cg"
   133     "Modified: / 18.2.2000 / 01:24:50 / cg"
   140     "Modified: / 18.2.2000 / 01:24:50 / cg"
   134 ! !
   141 ! !
   156     "Modified: / 05-03-2007 / 16:47:45 / cg"
   163     "Modified: / 05-03-2007 / 16:47:45 / cg"
   157 ! !
   164 ! !
   158 
   165 
   159 !NamespaceList methodsFor:'aspects'!
   166 !NamespaceList methodsFor:'aspects'!
   160 
   167 
       
   168 itemList
       
   169     ^ self nameSpaceList value
       
   170 !
       
   171 
   161 nameSpaceLabelHolder
   172 nameSpaceLabelHolder
   162     ^ self pseudoListLabelHolder
   173     ^ self pseudoListLabelHolder
   163 !
   174 !
   164 
   175 
   165 nameSpaceList
   176 nameSpaceList
   257 	something == #methodInClassRemoved ifTrue:[
   268 	something == #methodInClassRemoved ifTrue:[
   258 	    ^ self.
   269 	    ^ self.
   259 	].
   270 	].
   260     ].
   271     ].
   261     super update:something with:aParameter from:changedObject
   272     super update:something with:aParameter from:changedObject
       
   273 ! !
       
   274 
       
   275 !NamespaceList methodsFor:'drag & drop'!
       
   276 
       
   277 canDropContext:aDropContext
       
   278     |objects nameSpace|
       
   279 
       
   280     objects := aDropContext dropObjects collect:[:obj | obj theObject].
       
   281     (objects conform:[:aMethodOrClass | aMethodOrClass isClass ]) ifFalse:[^ false].
       
   282 
       
   283     nameSpace := self nameSpaceAtTargetPointOf:aDropContext.
       
   284     nameSpace isNil ifTrue:[^ false].
       
   285     nameSpace = self class nameListEntryForALL ifTrue:[^ false].
       
   286 
       
   287     ^ (objects contains:[:aClass | aClass nameSpace name ~= nameSpace]) 
       
   288 !
       
   289 
       
   290 doDropContext:aDropContext
       
   291     |nameSpaceName nameSpace objects|
       
   292 
       
   293     objects := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject].
       
   294     (objects conform:[:something | something isClass]) ifTrue:[
       
   295         nameSpaceName := self nameSpaceAtTargetPointOf:aDropContext.
       
   296         (nameSpaceName notNil
       
   297         and:[ nameSpaceName ~= self class nameListEntryForALL]) ifTrue:[
       
   298             nameSpace := NameSpace name:nameSpaceName.
       
   299             objects do:[:eachClassToMove |
       
   300                 |className|
       
   301 
       
   302                 className := eachClassToMove nameWithoutPrefix.
       
   303                 nameSpace == Smalltalk ifTrue:[
       
   304                     Smalltalk renameClass:eachClassToMove to:className asSymbol.
       
   305                 ] ifFalse:[
       
   306                     Smalltalk renameClass:eachClassToMove to:(nameSpace name , '::' , className) asSymbol.
       
   307                     nameSpace changed.
       
   308                 ].
       
   309             ].
       
   310             Smalltalk changed.
       
   311         ].
       
   312         ^ self
       
   313     ].
       
   314 !
       
   315 
       
   316 nameSpaceAtTargetPointOf:aDropContext
       
   317     |p targetView lineNr item|
       
   318 
       
   319     p := aDropContext targetPoint.
       
   320 
       
   321     targetView := aDropContext targetWidget.
       
   322 
       
   323     lineNr := targetView yVisibleToLineNr:p y.
       
   324     lineNr isNil ifTrue:[^ nil].
       
   325 
       
   326     item := self itemList at:lineNr.
       
   327     item isNil ifTrue:[^ nil].
       
   328 
       
   329     ^ item
   262 ! !
   330 ! !
   263 
   331 
   264 !NamespaceList methodsFor:'generators'!
   332 !NamespaceList methodsFor:'generators'!
   265 
   333 
   266 makeGenerator
   334 makeGenerator
   456 ! !
   524 ! !
   457 
   525 
   458 !NamespaceList class methodsFor:'documentation'!
   526 !NamespaceList class methodsFor:'documentation'!
   459 
   527 
   460 version
   528 version
   461     ^ '$Header: /cvs/stx/stx/libtool/Tools_NamespaceList.st,v 1.10 2007-03-06 11:48:47 cg Exp $'
   529     ^ '$Header: /cvs/stx/stx/libtool/Tools_NamespaceList.st,v 1.11 2009-05-18 14:12:29 cg Exp $'
   462 ! !
   530 ! !