AbstractFileApplicationNoteBookComponent.st
author Claus Gittinger <cg@exept.de>
Fri, 29 Aug 2003 21:29:24 +0200
changeset 5140 36c7da05d814
parent 5120 e4c15c9d82ba
child 5460 305f441da48a
permissions -rw-r--r--
*** empty log message ***

"
 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
    ^ ''
!

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

    item := anItem.
    ^ 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.9 2003-08-29 19:28:08 cg Exp $'
! !