AbstractFileApplicationNoteBookComponent.st
author penk
Mon, 04 Nov 2002 11:59:56 +0100
changeset 4147 e00eefe3f8fd
parent 3954 78e29a3ea4c1
child 4523 ae3d65269e21
permissions -rw-r--r--
querie for isTextEditor added

"{ Package: 'stx:libtool' }"

ApplicationModel subclass:#AbstractFileApplicationNoteBookComponent
	instanceVariableNames:'sameFileIndex item type notifyChannel'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Tools-File'
!


!AbstractFileApplicationNoteBookComponent class methodsFor:'defaults'!

tabStringFor:aApplicationType

    ^ nil
! !

!AbstractFileApplicationNoteBookComponent class methodsFor:'queries'!

canOpenItem:aItem

"
    example:
    ^ (aItem suffix == 'cc')
"
    ^ false
!

wantNewApplicationAnyway

    ^ true
! !

!AbstractFileApplicationNoteBookComponent methodsFor:'accessing'!

notifyChannel

    notifyChannel isNil ifTrue:[
        self masterApplication notNil ifTrue:[
            notifyChannel := masterApplication notifyChannel.
        ] ifFalse:[
            notifyChannel := ValueHolder with:''.
        ].
    ].
    ^ notifyChannel
!

sameFileIndex

    ^ sameFileIndex
!

sameFileIndex:something

    sameFileIndex := something.
! !

!AbstractFileApplicationNoteBookComponent methodsFor:'actions'!

changeItem:aItem

    ^ self item:aItem.
!

doClose
    |master|

    "/ tell the NoteBookApplication to close me
    (master := self masterApplication) notNil ifTrue:[
        master closeSubCanvas:self.
        self release.
    ] ifFalse:[
        self closeRequest.
    ].
    ^ true
! !

!AbstractFileApplicationNoteBookComponent methodsFor:'queries'!

fileName

    item notNil ifTrue:[
        ^ item fileName.
    ].
    ^ nil
!

getDirWithoutFileName:aFileName

    | dir |
    aFileName isNil ifTrue:[
        ^ aFileName.    
    ].
    dir := aFileName asFilename.
    dir isDirectory ifFalse:[
        dir := dir directory.
    ].
    ^ dir.
!

getTabString

" get the tab string from the application list on the class side "

    | stream string firstString endString|

    stream := WriteStream on:''.
    firstString := self class tabStringFor:type.
    firstString isNil ifTrue:[
        "/ default take the class name
        firstString := self className.
    ].
    stream nextPutAll:firstString.
    endString := self getTabStringEnd.
    endString notNil ifTrue:[
        stream space.
        stream nextPutAll:endString.
    ].
    string := stream contents.
    stream close.
    ^ string.
!

getTabStringEnd

" get the tab string from the application list on the class side "

    | stream string|

    self item notNil ifTrue:[
        stream := WriteStream on:''.
        stream nextPutAll:self fileName baseName.
        stream space.
        self sameFileIndex notNil ifTrue:[
            stream nextPutAll:self sameFileIndex asString.
        ].
        string := stream contents.
        stream close.
        ^ string.
    ].
    ^ nil
!

isEmbeddedApplication

     ^ self masterApplication notNil
!

isModified

    ^ false
!

isTextEditor

    ^ false
!

item

    ^ item
!

item:aItem

    item := aItem.
    ^ true
!

presentation

    ^ nil
!

type

    ^ type
!

type:aType

    type := aType
!

wantChangeAnyWay

    ^ (self type == #directoryDescription)
! !

!AbstractFileApplicationNoteBookComponent class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileApplicationNoteBookComponent.st,v 1.4 2002-11-04 10:59:56 penk Exp $'
! !