SmallSense__ClassPO.st
changeset 354 cbffe76c9b5a
parent 353 b1170c3a4585
parent 272 6232908637cf
child 355 c5b093508242
--- a/SmallSense__ClassPO.st	Wed Jul 09 12:23:50 2014 +0100
+++ b/SmallSense__ClassPO.st	Wed Oct 01 23:44:32 2014 +0100
@@ -1,3 +1,21 @@
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License. 
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
 "{ Package: 'stx:goodies/smallsense' }"
 
 "{ NameSpace: SmallSense }"
@@ -9,6 +27,28 @@
 	category:'SmallSense-Core-Interface-PO'
 !
 
+!ClassPO class methodsFor:'documentation'!
+
+copyright
+"
+stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
+Copyright (C) 2013-2014 Jan Vrany
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License. 
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+! !
 
 !ClassPO methodsFor:'accessing'!
 
@@ -17,16 +57,17 @@
 
     namespace := nil.
     showPrefix ifFalse:[
-	namespace := klass isJavaClass
-			ifTrue:[klass javaPackage]
-			ifFalse:[klass nameSpace name].
-	(namespace notNil and:[namespace ~~ #Smalltalk]) ifTrue:[
-	    ^ 'in ', namespace.
-	].
+        namespace := klass isJavaClass
+                        ifTrue:[klass javaPackage]
+                        ifFalse:[ | ns | ns := klass nameSpace. [ ns isNameSpace ] whileFalse:[ ns := ns nameSpace ]. ns name].
+        (namespace notNil and:[namespace ~~ #Smalltalk]) ifTrue:[
+            ^ 'in ', namespace.
+        ].
     ].
     ^ nil
 
     "Created: / 20-05-2014 / 12:21:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-07-2014 / 17:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 icon
@@ -52,25 +93,31 @@
 
 label
     label isNil ifTrue:[
-	showPrefix ifTrue:[
-	    label := klass name.
-	    (context notNil and:[klass isJavaClass]) ifTrue:[
-		context language isJava ifTrue:[
-		    label := klass javaName
-		] ifFalse:[
-		    context language isSmalltalk ifTrue:[
-		       label := 'JAVA ' , (klass  binaryName copyReplaceAll: $/ with: Character space)
-		     ]
-		]
-	    ].
-	] ifFalse:[
-	    label := klass nameWithoutPrefix.
-	].
+        showPrefix ifTrue:[
+            label := klass name.
+            (context notNil and:[klass isJavaClass]) ifTrue:[
+                | lang |
+
+                lang := context language.
+                (lang notNil and:[lang isJava]) ifTrue:[
+                    label := klass javaName
+                ] ifFalse:[
+                    (lang notNil and:[lang isSmalltalk]) ifTrue:[
+                       label := 'JAVA ' , (klass  binaryName copyReplaceAll: $/ with: Character space)
+                     ] ifFalse:[ 
+                        label := klass nameWithoutNameSpacePrefix.
+                     ].
+                ]
+            ].
+        ] ifFalse:[
+            label := klass nameWithoutNameSpacePrefix.
+        ].
     ].
 
     ^label
 
     "Created: / 20-05-2014 / 11:29:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-08-2014 / 16:19:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 showPrefix
@@ -85,25 +132,25 @@
     "Answers a string already written in the textview"
 
     klass isJavaClass ifTrue:[
-	context language isSmalltalk ifTrue:[
-	    | rec |
+        context language isSmalltalk ifTrue:[
+            | rec |
 
-	    rec := context node .
-	    [ rec isUnaryMessage ] whileTrue:[
-		rec := rec receiver.
-	    ].
-	    (rec isVariableNode and:['JAVA' startsWith: rec name]) ifTrue:[
-		^ context codeView contents asString copyFrom: rec startPosition to: context node endPosition
-	    ].
-	] ifFalse:[
-	context language isJavaLike ifTrue:[
-	     ^ context wordBeforeCursorConsisitingOfCharactersMatching:[:c | c isAlphaNumeric or:['$_.' includes: c] ]
-	]].
+            rec := context node .
+            [ rec isUnaryMessage ] whileTrue:[
+                rec := rec receiver.
+            ].
+            (rec isVariableNode and:['JAVA' startsWith: rec name]) ifTrue:[
+                ^ context codeView contents string copyFrom: rec startPosition to: context node endPosition
+            ].
+        ] ifFalse:[
+        context language isJavaLike ifTrue:[
+             ^ context wordBeforeCursorConsisitingOfCharactersMatching:[:c | c isAlphaNumeric or:['$_.' includes: c] ]
+        ]].
     ].
     ^ super stringAlreadyWritten
 
     "Created: / 20-10-2013 / 02:46:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 15-05-2014 / 07:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-08-2014 / 16:23:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 stringToCompleteForLanguage: language
@@ -117,17 +164,6 @@
     "Modified: / 20-05-2014 / 11:41:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!ClassPO methodsFor:'accessing-private'!
-
-subject
-    "Return the real object for which the receiver
-     is a presentor."
-
-    ^ klass
-
-    "Created: / 20-06-2014 / 11:10:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !ClassPO methodsFor:'converting'!
 
 asString