AbstractFileApplicationNoteBookComponent.st
author Claus Gittinger <cg@exept.de>
Tue, 16 Mar 2004 15:53:32 +0100
changeset 5737 c5a659e2c4c7
parent 5604 1c2e0582bcd9
child 5967 ff5e8356fcb7
permissions -rw-r--r--
added lockFileEncoding

"
 COPYRIGHT (c) 2002 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

"{ Package: 'stx:libtool' }"

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

!AbstractFileApplicationNoteBookComponent class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2002 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
! !

!AbstractFileApplicationNoteBookComponent class methodsFor:'defaults'!

tabStringFor:aApplicationType

    ^ nil
! !

!AbstractFileApplicationNoteBookComponent class methodsFor:'queries'!

canOpenItem:anItem

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

wantNewApplicationAnyway

    ^ true
! !

!AbstractFileApplicationNoteBookComponent methodsFor:'accessing'!

notify:msg
    self notifyChannel value:msg
!

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:anItem

    ^ self item:anItem.
!

doClose
    |master|

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

!AbstractFileApplicationNoteBookComponent methodsFor:'aspects'!

cursorColLabelHolder
    ^ ''
!

cursorLineLabelHolder
    ^ ''
!

fileEncodingHolder
    ^ #'iso8859-1'
!

lockFileEncodingHolder
    ^ true
!

modeLabelHolder
    ^ ''
! !

!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|

    self item notNil ifTrue:[
        stream := WriteStream on:''.
        self type = #directoryDescription ifTrue:[
            stream nextPutAll:self fileName directory baseName.
            stream space.
            stream nextPut:$[.
            stream nextPutAll:self fileName baseName.
            stream nextPut:$].
        ] ifFalse:[
            stream nextPutAll:self fileName baseName.
            stream space.
            self sameFileIndex notNil ifTrue:[
                stream nextPutAll:self sameFileIndex asString.
            ].
        ].
        ^ stream contents.
    ].
    ^ nil
!

isEmbeddedApplication

     ^ self masterApplication notNil
!

isModified

    ^ false
!

isTextEditor

    ^ false
!

item

    ^ item
!

item:anItem

    item := anItem.
    ^ true
!

presentation

    ^ nil
!

type

    ^ type
!

type:aType

    type := aType
!

wantChangeAnyWay

    ^ (self type == #directoryDescription)
! !

!AbstractFileApplicationNoteBookComponent methodsFor:'resources'!

resources
    masterApplication notNil ifTrue:[
        ^ masterApplication resources
    ].
    ^ super resources
! !

!AbstractFileApplicationNoteBookComponent class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileApplicationNoteBookComponent.st,v 1.14 2004-03-16 14:53:27 cg Exp $'
! !