SmallSense__PO.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 18 Sep 2013 00:59:55 +0100
changeset 90 4035038db277
parent 67 020b7461b15e
child 115 254c4f5dc963
permissions -rw-r--r--
Fixes in PO rendering. Make class/method/variable POs render its class/namespace if there's enough space in the list.

"{ Package: 'jv:smallsense' }"

"{ NameSpace: SmallSense }"

HierarchicalItem subclass:#PO
	instanceVariableNames:'subject icon label name description'
	classVariableNames:'IconWidth'
	poolDictionaries:''
	category:'SmallSense-Core-Interface-PO'
!


!PO class methodsFor:'initialization'!

initialize
    "Invoked at system start or when the class is dynamically loaded."

    "/ please change as required (and remove this comment)

    IconWidth := 16.

    "Modified: / 18-09-2013 / 00:13:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PO class methodsFor:'Instance Creation'!

name: name description:description

    ^ self new name:name; description:description.

    "Created: / 04-04-2011 / 13:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PO class methodsFor:'Instance creation'!

subject: anObject

    ^self new subject: anObject

    "Created: / 06-04-2011 / 21:01:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PO methodsFor:'accessing'!

cursorColumnAfterComplete

    "Answers a cursor column after completion. The number returned
     is relative to the start of the text being replaced"

    ^name size + 1

    "Created: / 05-04-2011 / 17:05:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

description
    ^ description
!

description:something
    description := something.
!

icon

    ^nil

    "Created: / 04-04-2011 / 17:25:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

label

    label ifNil:[label := name].
    ^label

    "Created: / 07-04-2011 / 09:55:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

name
    ^ name
!

name:something
    name := something.
!

stringToComplete

    "Answers a string to complete"

    ^name

    "Created: / 05-04-2011 / 16:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

subject
    ^ subject
!

subject:something
    subject := something.
! !

!PO methodsFor:'displaying'!

displayLabel:aLabel h:lH on:aGC x:x y:y h:h
    | cx iconOrNil |

    cx := x.

    iconOrNil := self icon.
    iconOrNil notNil ifTrue:[
        iconOrNil displayOn: aGC x: cx y: y + (h / 2) - (iconOrNil height / 2).
    ].

    cx := cx + IconWidth.

    super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h

    "Created: / 24-07-2013 / 00:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 18-09-2013 / 00:13:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PO methodsFor:'new'!

name:nam description:desc 
    name := nam.
    description := desc.

    "Created: / 16-03-2011 / 16:31:13 / Jakub <zelenja7@fel.cvut.cz>"
! !

!PO methodsFor:'printing & storing'!

printOn:aStream
    "append a printed representation if the receiver to the argument, aStream"

    super printOn:aStream.
    aStream nextPut:$(.
    name printOn:aStream.
    aStream nextPut:$).

    "Modified: / 04-04-2011 / 12:02:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PO methodsFor:'queries'!

startsWith: prefix

    ^self stringToComplete startsWith: prefix

    "Created: / 26-11-2011 / 19:25:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PO methodsFor:'testing'!

isSmallSenseClassPO
    ^ false
!

isSmallSenseConstantPO
    ^ false
!

isSmallSenseMethodPO
    ^ false
!

isSmallSenseSnippetPO
    ^ false
!

isSmallSenseVariablePO
    ^ false
! !

!PO class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$Id: SmallSenseResultItem.st 7825 2011-11-26 18:32:31Z vranyj1 $'
! !


PO initialize!