SmallSense__MethodPO.st
changeset 229 c82a22d2153d
parent 192 f27ce6dac101
child 230 2c12395f8108
--- a/SmallSense__MethodPO.st	Thu May 15 17:58:25 2014 +0100
+++ b/SmallSense__MethodPO.st	Tue May 20 11:01:39 2014 +0100
@@ -3,41 +3,15 @@
 "{ NameSpace: SmallSense }"
 
 PO subclass:#MethodPO
-	instanceVariableNames:'class'
+	instanceVariableNames:'selector classes'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'SmallSense-Core-Interface-PO'
 !
 
 
-!MethodPO class methodsFor:'Instance creation'!
-
-name:nm class:class 
-    ^ (self new)
-        name:nm;
-        class:class.
-
-    "Created: / 17-10-2013 / 01:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-name:nm class:class stripOff: prefix
-    ^ prefix notNil ifTrue:[ 
-        MethodKeywordRestPO name: nm class: class stripOff: prefix.
-    ] ifFalse:[ 
-        self name: nm class: class.
-    ].
-
-    "Created: / 08-04-2014 / 21:20:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !MethodPO methodsFor:'accessing'!
 
-class:something
-    class := something.
-
-    "Created: / 06-04-2011 / 16:51:42 / Jakub <zelenja7@fel.cvut.cz>"
-!
-
 cursorColumnAfterComplete
 
     | idx |
@@ -72,39 +46,39 @@
     label isNil ifTrue:[
         | someClass |
 
-        someClass := class isBehavior ifTrue:[class] ifFalse:[class anElement].
-        label := name.
+        someClass := classes anElement.
+        label := selector.
         someClass programmingLanguage isSmalltalk ifFalse:[
-            label := (someClass compiledMethodAt: name) printStringForBrowserWithSelector: name.
+            label := (someClass compiledMethodAt: selector) printStringForBrowserWithSelector: selector.
         ]
     ].
     ^ label
 
     "Created: / 07-04-2011 / 09:56:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-10-2013 / 02:28:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-05-2014 / 10:28:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 stringToCompleteForLanguage: language
     | someClass |
 
-    someClass := class isBehavior ifTrue:[class] ifFalse:[class anElement].
+    someClass := classes anElement.
     someClass isJavaClass ifTrue:[
         | method |
 
-        method := someClass compiledMethodAt: name.
+        method := someClass compiledMethodAt: selector.
         language isSmalltalk  ifTrue:[          
-            ^  method selector upTo: $(
+            ^ selector upTo: $(
         ].
         ((language askFor: #isJava) or:[language askFor: #isGroovy]) ifTrue:[
-            ^ (method selector upTo: $() , (method numArgs == 0 ifTrue:['()'] ifFalse:['(  )']).
+            ^ (selector upTo: $() , (method numArgs == 0 ifTrue:['()'] ifFalse:['(  )']).
         ].
     ].
     ^ String 
-        fromStringCollection: (name tokensBasedOn: $:)
+        fromStringCollection: (selector tokensBasedOn: $:)
         separatedBy: ':  '.
 
     "Created: / 02-10-2013 / 02:33:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 31-03-2014 / 23:08:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-05-2014 / 10:29:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !MethodPO methodsFor:'displaying'!
@@ -115,13 +89,10 @@
     super displayLabel:aLabel h:lH on:aGC x:x y:y h:h.
 
     lw :=  x + IconWidth + (self label widthOn: aGC).
-    class isCollection ifTrue:[
-        cn := (class collect:[:each | each nameWithoutPrefix ]) asArray asStringWith:' , '.
-    ] ifFalse:[
-        cn := class nameWithoutPrefix.
-    ].
+    cn := (classes collect:[:each | each nameWithoutPrefix ]) asArray asStringWith:' , '.
+
     cnw := aGC widthOfString: cn.
-    y0 := y - (lH + 1 - h // 2).
+    y0 := y - ((lH + 1 - h) // 2).
     y0 := y0 + (cn ascentOn:aGC).  
 
     (aGC width > (lw + cnw + 5)) ifTrue:
@@ -132,26 +103,23 @@
     ]
 
     "Created: / 18-09-2013 / 00:19:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-10-2013 / 02:17:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 20-05-2014 / 10:54:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!MethodPO methodsFor:'initialization'!
+
+initializeWithClass: aClass selector: aSymbol
+    ^ self initializeWithClasses: (Array with: aClass) selector: aSymbol
+
+    "Created: / 20-05-2014 / 10:32:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-displayOn:aGC x:x y:y opaque:opaque
-
-    | lw cn cnw fg |
-
-    super displayOn:aGC x:x y:y opaque:opaque.
-    lw :=  x + 16 + (self label widthOn: aGC).
-    cn := class nameWithoutPrefix.
-    cnw := aGC widthOfString: cn.
+initializeWithClasses: anArray"Of Classes" selector: aSymbol 
+    selector := aSymbol.
+    name := aSymbol.
+    classes := anArray
 
-    (aGC width > (lw + cnw + 5)) ifTrue:
-        [fg := aGC paint.
-        aGC paint: Color gray .
-        aGC displayString: cn x: aGC width - cnw - 5 y: y.
-        aGC paint: fg.
-        ]
-
-    "Created: / 21-05-2011 / 11:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 20-05-2014 / 10:32:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !MethodPO methodsFor:'testing'!