--- a/FileApplicationNoteBook.st Sun Jan 29 12:56:58 2012 +0000
+++ b/FileApplicationNoteBook.st Sun Jan 29 15:33:37 2012 +0000
@@ -82,7 +82,7 @@
textEditorModificationTime checkModifiedBlock fileEncodingHolder
doNotShowFontDialog lockFileEncodingHolder enableSelectInBrowser
tagsBrowserVisibleHolder tagsBrowser'
- classVariableNames:''
+ classVariableNames:'DefaultTagsBrowserVisible'
poolDictionaries:''
privateIn:FileApplicationNoteBook
!
@@ -228,7 +228,7 @@
menu: tabList
useIndex: true
accessTabMenuAction: tabMenuAt:
- "/ destroyTabAction: destroyTab:
+ destroyTabAction: destroyTabAt:
canvas: canvasHolder
keepCanvasAlive: true
)
@@ -236,8 +236,6 @@
)
)
-
- "Modified: / 01-03-2007 / 21:30:13 / cg"
! !
!FileApplicationNoteBook class methodsFor:'menu specs'!
@@ -335,11 +333,13 @@
!FileApplicationNoteBook methodsFor:'accessing-applications'!
getAllApplicationsByClass:aClass andType:aType
-
- ^ self listOfApplications select:[ : appl |
- ((appl class = aClass)
- "and:[appl type = aType]")
- ].
+ ^ self listOfApplications
+ select:[ : appl |
+ ((appl class = aClass)
+ "and:[appl type = aType]")
+ ].
+
+ "Modified (format): / 29-11-2011 / 19:08:20 / cg"
!
getApplicationByType:aType
@@ -510,8 +510,7 @@
!
openApplByFileItem:anItem
-
-" use the default class list for open of applications by item "
+ " use the default class list for open of applications by item "
| applList applItem itemClass itemType appl|
@@ -520,43 +519,52 @@
self warn:'No Application to open for directory:', anItem fileName asString, ' found'.
^ nil.
].
- applList := self applicationList.
- self openAlwaysInTextEditor value ifTrue:[
- ^ self openDefaultApplicationByItem:anItem.
- ].
- applItem := applList
- detect:[: aApplItem|
- itemClass := self class classFor:aApplItem.
- (itemClass canOpenItem:anItem).
- ] ifNone:[nil].
- applItem isNil ifTrue:[
- ^ self openDefaultApplicationByItem:anItem
- ].
- itemType := self class typeFor:applItem.
- itemClass := self class classFor:applItem.
- Error handle:[:ex |
- "/ catching the error, so we can still show text
- ] do:[
- appl := self openApplicationClass:itemClass withItem:anItem withType:itemType.
- appl notNil ifTrue:[ ^ appl].
- ].
+
+ self openAlwaysInTextEditor value ifFalse:[
+ applList := self applicationList.
+ applItem := applList
+ detect:[: aApplItem|
+ itemClass := self class classFor:aApplItem.
+ (itemClass canOpenItem:anItem).
+ ] ifNone:[nil].
+
+ applItem notNil ifTrue:[
+ itemType := self class typeFor:applItem.
+ itemClass := self class classFor:applItem.
+ Error handle:[:ex |
+ "/ catching the error, so we can still show text
+ ] do:[
+ appl := self openApplicationClass:itemClass withItem:anItem withType:itemType.
+ appl notNil ifTrue:[ ^ appl].
+ ].
+ ].
+ ].
+
^ self openDefaultApplicationByItem:anItem.
- "Modified: / 17-02-2011 / 17:37:38 / cg"
+ "Modified: / 16-09-2011 / 16:17:58 / cg"
!
openApplicationClass:aClass withItem:anItem withType:aType
- ^ self openApplicationClass:aClass withItem:anItem withType:aType checkExisting:true
-!
-
-openApplicationClass:aClass withItem:anItem withType:aType checkExisting:checkExisting
-
- ^ self openApplicationClass:aClass
- withItem:anItem
- withType:aType
- checkExisting:checkExisting
- preSetItem:nil
+ ^ self
+ openApplicationClass:aClass
+ withItem:anItem
+ withType:aType
+ checkExisting:true
+
+ "Modified (format): / 12-01-2012 / 01:10:50 / cg"
+!
+
+openApplicationClass:aClass withItem:anItem withType:aType checkExisting:checkExisting
+ ^ self
+ openApplicationClass:aClass
+ withItem:anItem
+ withType:aType
+ checkExisting:checkExisting
+ preSetItem:nil
+
+ "Modified (format): / 29-11-2011 / 19:06:27 / cg"
!
openApplicationClass:aClass withItem:anItem withType:aType checkExisting:checkExisting preSetItem:aBlock
@@ -574,6 +582,7 @@
^ existingAppl
].
].
+
newAppl := aClass new.
newAppl masterApplication:self.
aBlock notNil ifTrue:[
@@ -593,6 +602,8 @@
self setSameFileIndexFor:newAppl.
self startApplication:newAppl.
^ newAppl
+
+ "Modified (format): / 29-11-2011 / 19:06:47 / cg"
!
openDefaultApplicationByItem:anItem
@@ -686,8 +697,6 @@
!
tryToGetExistingApplFor:aClass withItem:anItem withType:aType preSetItem:aBlock
-
-
| sameAppls changeAppl selAppl|
aClass wantNewApplicationAnyway ifTrue:[^ nil].
@@ -703,15 +712,11 @@
^ nil
] ifFalse:[
"/ if item already changed select the application
- selAppl := sameAppls detect:[ : appl |
- (appl item = anItem)
- ] ifNone:[nil].
+ selAppl := sameAppls detect:[:appl | (appl item = anItem) ] ifNone:[nil].
].
] ifFalse:[
"/ keep in same application change the first application of the same class and type - if item not changed otherwise open new
- sameAppls := sameAppls select:[ : appl |
- (appl isModified not)
- ].
+ sameAppls := sameAppls select:[:appl | appl isModified not ].
].
].
sameAppls size ~~ 0 ifTrue:[
@@ -720,6 +725,7 @@
third the first
"
| nilItemAppls |
+
nilItemAppls := sameAppls select:[:appl| appl item == nil ].
nilItemAppls notEmpty ifTrue:[sameAppls := nilItemAppls].
(sameAppls includes:self selectedApplication) ifTrue:[
@@ -735,6 +741,8 @@
selAppl := changeAppl.
].
^ selAppl.
+
+ "Modified (format): / 29-11-2011 / 19:07:57 / cg"
! !
!FileApplicationNoteBook methodsFor:'actions-app-spec'!
@@ -769,19 +777,30 @@
].
!
+doAddArchiverOn:aFilename
+ |item|
+
+ item := DirectoryContentsBrowser itemClass fileName:aFilename.
+ self openArchiveViewApplication:item.
+
+ "Created: / 29-11-2011 / 19:05:49 / cg"
+!
+
newTextEditor
^ self openApplicationClass:TextEditor withItem:nil withType:#file checkExisting:false
!
openArchiveViewApplication:anItem
-
| result |
+
result := self openApplicationClass:ArchiveViewApplication withItem:anItem withType:nil.
result isNil ifTrue:[
Dialog warn:'file type of ', anItem fileName baseName, ' not yet supported'.
^ self.
].
+
+ "Modified (format): / 29-11-2011 / 18:57:21 / cg"
!
openCommandResultApplication
@@ -790,6 +809,20 @@
^ self openApplicationClass:CommandResult withItem:nil withType:#commandResult
!
+openCompareDirectory:directory1 with:directory2
+ |newAppl|
+
+ newAppl := DirectoryDifferenceViewApplication new.
+ newAppl masterApplication:self.
+ newAppl directory1:directory1 directory2:directory2.
+
+ self setSameFileIndexFor:newAppl.
+ self startApplication:newAppl.
+ ^ newAppl
+
+ "Created: / 12-01-2012 / 01:10:05 / cg"
+!
+
openDirectoryDescription
| appl aInfoItem|
@@ -807,7 +840,13 @@
openSearchFileOn:anItem
- ^ self openApplicationClass:FindFileApplication withItem:anItem withType:nil checkExisting:false
+ ^ self
+ openApplicationClass:FindFileApplication
+ withItem:anItem
+ withType:nil
+ checkExisting:false
+
+ "Modified (format): / 12-01-2012 / 01:02:30 / cg"
!
openTerminalApplication:anItem
@@ -885,6 +924,26 @@
]
!
+inputTabColumnConversionHolder
+ ^ self
+ aspectFor:#inputTabColumnConversionHolder
+ ifAbsent:[
+ IndirectValue for:(8 asValue)
+ ]
+
+ "Created: / 06-01-2012 / 15:26:32 / cg"
+!
+
+lineEndConventionHolder
+ ^ self
+ aspectFor:#lineEndConventionHolder
+ ifAbsent:[
+ IndirectValue for:('nl' asValue)
+ ]
+
+ "Created: / 06-01-2012 / 13:03:24 / cg"
+!
+
lockFileEncodingHolder
^ self
aspectFor:#lockFileEncodingHolder
@@ -1044,6 +1103,16 @@
!FileApplicationNoteBook methodsFor:'menu & actions'!
+destroyTabAt:idx
+ |app|
+
+ app := listOfApplications at:idx.
+ self closeSubCanvas:app.
+ app release.
+
+ "Created: / 11-01-2012 / 23:46:09 / cg"
+!
+
tabMenuAt:aTab
|menu|
@@ -1472,12 +1541,14 @@
#label: 'Show Contents'
#itemValue: #viewFile
#translateLabel: true
- #isVisible: #isEmbeddedApplication
+ #isVisible: #closeButtonShown
)
)
nil
nil
)
+
+ "Modified: / 12-01-2012 / 00:34:13 / cg"
!
menu
@@ -1532,7 +1603,7 @@
#translateLabel: true
#isButton: true
#startGroup: #right
- #isVisible: #isEmbeddedApplication
+ #isVisible: #closeButtonShown
#hideMenuOnActivated: false
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #removeTabIcon)
)
@@ -1540,6 +1611,8 @@
nil
nil
)
+
+ "Modified: / 12-01-2012 / 00:34:06 / cg"
! !
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'queries'!
@@ -1547,20 +1620,24 @@
canOpenItem:anItem
|suffix mimeType|
- "avoid autoloading the archiver if its definitely not an archive"
- OperatingSystem isUNIXlike ifFalse:[
- "until Archiver supports windows archives..."
- ^ false.
- ].
+"/ "avoid autoloading the archiver if its definitely not an archive"
+"/ OperatingSystem isUNIXlike ifFalse:[
+"/ "until Archiver supports windows archives..."
+"/ ^ false.
+"/ ].
suffix := anItem fileName suffix asLowercase.
( #('c' 'h' 'bat' 'sh') includes:suffix) ifTrue:[^ false].
+ ( #('xlsx' 'ets') includes:suffix) ifTrue:[^ true].
+
mimeType := anItem mimeType.
( #('application/x-make') includes:mimeType) ifTrue:[^ false].
Archiver isNil ifTrue:[^ false].
^ (Archiver classForMimeType:mimeType fileName:anItem fileName) notNil
+
+ "Modified: / 29-11-2011 / 18:59:35 / cg"
!
wantNewApplicationAnyway
@@ -1810,8 +1887,6 @@
!
copyFilesToClipboard
-
-
|sel list stream|
sel := self selectionHolder value.
@@ -1825,6 +1900,8 @@
self window setClipboardText:stream contents.
stream close.
].
+
+ "Modified (format): / 29-11-2011 / 18:57:40 / cg"
!
dblClick
@@ -1833,14 +1910,16 @@
!
doStopProcess
-
| archiver |
+
self stopProcess.
archiver := self archiver.
archiver notNil ifTrue:[
self archiver stopProcess.
].
self enableStopButton value:false.
+
+ "Modified (format): / 29-11-2011 / 18:57:50 / cg"
!
removeErrorOutput
@@ -2258,7 +2337,6 @@
!
extractSelectionTo:aDirectory askForExtractOptions:askForExtractOptionsBoolean
-
| sel index extractWithDirectoryPart extractAllFilesInSelectedDirectories extractFiles|
extractWithDirectoryPart := true.
@@ -2289,10 +2367,11 @@
self extractWithOutDirectoryPartTo:aDirectory with:extractFiles.
].
^ true
+
+ "Modified (format): / 29-11-2011 / 18:57:54 / cg"
!
extractWithDirectoryPartTo:aDirectory with:extractFiles
-
self archiver
outStream:nil
errorStream:(self getErrorStream)
@@ -2301,10 +2380,11 @@
makeProcessFor:[ self archiver extractFiles:extractFiles to:aDirectory ]
with:('Extracting files to %1' bindWith:aDirectory asString).
^ true.
+
+ "Modified (format): / 29-11-2011 / 18:57:58 / cg"
!
extractWithOutDirectoryPartTo:aDirectory with:extractFiles
-
self archiver
outStream:nil
errorStream:(self getErrorStream)
@@ -2317,6 +2397,8 @@
]
with:('Extracting files to %1' bindWith:aDirectory asString).
^ true.
+
+ "Modified (format): / 29-11-2011 / 18:58:01 / cg"
! !
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands list'!
@@ -3002,7 +3084,7 @@
#translateLabel: true
#isButton: true
#nameKey: #Close
- #isVisible: #isEmbeddedApplication
+ #isVisible: #closeButtonShown
#startGroup: #right
#value: #doClose
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #removeTabIcon)
@@ -3011,6 +3093,8 @@
nil
nil
)
+
+ "Modified: / 12-01-2012 / 00:33:56 / cg"
! !
!FileApplicationNoteBook::CommandResult methodsFor:'accessing'!
@@ -4176,6 +4260,29 @@
"Modified: / 01-03-2007 / 21:43:38 / cg"
! !
+!FileApplicationNoteBook::Terminal class methodsFor:'help specs'!
+
+helpSpec
+ "This resource specification was automatically generated
+ by the UIHelpTool of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIHelpTool may not be able to read the specification."
+
+ "
+ UIHelpTool openOnClass:FileApplicationNoteBook::Terminal
+ "
+
+ <resource: #help>
+
+ ^ super helpSpec addPairsFrom:#(
+
+#closeTabButton
+''
+
+)
+! !
+
!FileApplicationNoteBook::Terminal class methodsFor:'interface specs'!
windowSpec
@@ -4240,6 +4347,7 @@
"Do not manually edit this!! If it is corrupted,
the MenuEditor may not be able to read the specification."
+
"
MenuEditor new openOnClass:FileApplicationNoteBook::Terminal andSelector:#menu
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::Terminal menu)) startUp
@@ -4248,26 +4356,26 @@
<resource: #menu>
^
- #(#Menu
- #(
- #(#MenuItem
- #label: 'Save As...'
- #translateLabel: true
- #isButton: true
- #nameKey: #Save
- #value: #saveAs
- #labelImage: #(#ResourceRetriever #ToolbarIconLibrary saveToFileAsIcon)
+ #(Menu
+ (
+ (MenuItem
+ label: 'Save As...'
+ itemValue: saveAs
+ nameKey: Save
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary saveToFileAsIcon)
)
- #(#MenuItem
- #activeHelpKey: #closeTabButton
- #label: 'Close'
- #translateLabel: true
- #isButton: true
- #hideMenuOnActivated: false
- #isVisible: #isEmbeddedApplication
- #startGroup: #right
- #value: #doClose
- #labelImage: #(#ResourceRetriever #ToolbarIconLibrary #removeTabIcon)
+ (MenuItem
+ activeHelpKey: closeTabButton
+ label: 'Close'
+ itemValue: doClose
+ translateLabel: true
+ isButton: true
+ startGroup: right
+ isVisible: closeButtonShown
+ hideMenuOnActivated: false
+ labelImage: (ResourceRetriever ToolbarIconLibrary removeTabIcon)
)
)
nil
@@ -4360,6 +4468,12 @@
^ 30 "seconds"
!
+defaultTagsBrowserVisible
+ ^ DefaultTagsBrowserVisible ? true
+
+ "Created: / 06-10-2011 / 12:45:58 / cg"
+!
+
tabStringFor:aApplicationType
"the formatString shown in a tab (language translated)"
@@ -4385,6 +4499,29 @@
"
! !
+!FileApplicationNoteBook::TextEditor class methodsFor:'help specs'!
+
+helpSpec
+ "This resource specification was automatically generated
+ by the UIHelpTool of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIHelpTool may not be able to read the specification."
+
+ "
+ UIHelpTool openOnClass:FileApplicationNoteBook::TextEditor
+ "
+
+ <resource: #help>
+
+ ^ super helpSpec addPairsFrom:#(
+
+#closeTabButton
+''
+
+)
+! !
+
!FileApplicationNoteBook::TextEditor class methodsFor:'interface specs'!
windowSpec
@@ -4443,6 +4580,7 @@
acceptCallBack: accept
allowDoIt: true
hasKeyboardFocusInitially: false
+ viewClassName: 'getEditorClass'
postBuildCallback: postBuildTextEditor:
)
)
@@ -4522,6 +4660,7 @@
"Do not manually edit this!! If it is corrupted,
the MenuEditor may not be able to read the specification."
+
"
MenuEditor new openOnClass:FileApplicationNoteBook::TextEditor andSelector:#menu
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::TextEditor menu)) startUp
@@ -4535,45 +4674,45 @@
(MenuItem
activeHelpKey: saveFile
enabled: enableSave
- isVisible: saveButtonVisible
label: 'Save'
itemValue: accept
nameKey: Save
translateLabel: true
isButton: true
+ isVisible: saveButtonVisible
labelImage: (ResourceRetriever ToolbarIconLibrary saveTextToFileIcon)
)
(MenuItem
activeHelpKey: saveFileAs
enabled: enableSaveAs
- isVisible: saveAsButtonVisible
label: 'Save As...'
itemValue: saveFileAs
nameKey: SaveAs
translateLabel: true
isButton: true
+ isVisible: saveAsButtonVisible
labelImage: (ResourceRetriever ToolbarIconLibrary saveToFileAsIcon)
)
(MenuItem
activeHelpKey: reloadFile
- isVisible: reloadButtonVisible
enabled: enableReload
label: 'Reload'
itemValue: reload
nameKey: Reload
translateLabel: true
isButton: true
+ isVisible: reloadButtonVisible
labelImage: (ResourceRetriever ToolbarIconLibrary reloadTextFromFileIcon)
)
(MenuItem
activeHelpKey: findInBrowser
- isVisible: selectInBrowserButtonVisible
enabled: enableSelectInBrowser
label: 'Select in Browser'
itemValue: selectInBrowser
nameKey: SelectInBrowser
translateLabel: true
isButton: true
+ isVisible: selectInBrowserButtonVisible
labelImage: (ResourceRetriever ToolbarIconLibrary searchFileIcon)
)
(MenuItem
@@ -4607,11 +4746,11 @@
)
(MenuItem
activeHelpKey: showDifferences
- isVisible: diffTextButtonVisible
label: 'Diff to Current'
itemValue: openDiffView
translateLabel: true
isButton: true
+ isVisible: diffTextButtonVisible
labelImage: (ResourceRetriever ToolbarIconLibrary diffIcon)
)
(MenuItem
@@ -4621,7 +4760,7 @@
translateLabel: true
isButton: true
startGroup: right
- isVisible: isEmbeddedApplication
+ isVisible: closeButtonShown
hideMenuOnActivated: false
labelImage: (ResourceRetriever ToolbarIconLibrary removeTabIcon)
)
@@ -5190,6 +5329,7 @@
!
tagSelected:aTag
+ editView deselect. "/ otherwise, it might jump back to show the selection
editView cursorLine:(aTag lineNumber) col:1.
"Created: / 23-06-2011 / 16:38:07 / cg"
@@ -5419,6 +5559,13 @@
!FileApplicationNoteBook::TextEditor methodsFor:'aspects-visibility'!
+closeButtonShown
+ ^ false.
+"/ ^ self isEmbeddedApplication.
+
+ "Created: / 12-01-2012 / 00:32:15 / cg"
+!
+
diffTextButtonVisible
^ self fileName notNil "/ true
!
@@ -5444,14 +5591,14 @@
masterApplication notNil ifTrue:[
tagsBrowserVisibleHolder := masterApplication tagsBrowserVisibleHolder.
] ifFalse:[
- tagsBrowserVisibleHolder := true asValue.
+ tagsBrowserVisibleHolder := self class defaultTagsBrowserVisible asValue.
].
tagsBrowserVisibleHolder addDependent:self.
].
^ tagsBrowserVisibleHolder
"Created: / 23-06-2011 / 09:19:18 / cg"
- "Modified: / 27-06-2011 / 16:04:45 / cg"
+ "Modified: / 06-10-2011 / 12:46:41 / cg"
! !
!FileApplicationNoteBook::TextEditor methodsFor:'change & update'!
@@ -5508,13 +5655,13 @@
!
tagsBrowserVisibilityChanged
- |tagsBrowserCanvas|
+ |visible tagsBrowserCanvas|
tagsBrowser notNil ifTrue:[
tagsBrowserCanvas := tagsBrowser window.
].
- self tagsBrowserVisibleHolder value ifTrue:[
+ (visible := self tagsBrowserVisibleHolder value) ifTrue:[
tagsBrowser isNil ifTrue:[
tagsBrowserCanvas := ApplicationSubView new.
@@ -5540,9 +5687,10 @@
(self builder componentAt:#Panel) relativeCorners:#(1.0 1.0).
].
].
+ DefaultTagsBrowserVisible := visible
"Created: / 27-06-2011 / 16:06:00 / cg"
- "Modified: / 29-06-2011 / 09:32:09 / cg"
+ "Modified: / 06-10-2011 / 12:45:20 / cg"
!
update:something with:aParameter from:changedObject
@@ -5735,8 +5883,22 @@
].
!
+getEditorClass
+ UserPreferences current useCodeView2InTools ifTrue:[
+ ^ Tools::CodeView2 ? CodeView
+ ].
+ ^ CodeView
+
+ "Created: / 06-10-2011 / 11:21:43 / cg"
+!
+
postBuildTextEditor:aWidget
- editView := aWidget scrolledView.
+ editView := aWidget scrolledView.
+ "/ I do not want any non-smalltalk code to be syntaxhighlighted!!
+ editView isCodeView2 ifTrue:[
+ editView languageHolder value:nil.
+ editView services:#().
+ ].
editView saveAction:[ self doSaveAs ].
editView cursorLineHolder addDependent:self.
@@ -5745,7 +5907,8 @@
editView externalEncoding:self fileEncoding.
"/ editView characterEncoding:'unicode'. - thats the default anyway
- "Modified: / 23-06-2011 / 17:30:58 / cg"
+ "Modified: / 06-10-2011 / 11:43:40 / cg"
+ "Modified (comment): / 03-12-2011 / 10:27:47 / cg"
!
postOpenWith:aBuilder
@@ -6543,6 +6706,10 @@
!FileApplicationNoteBook class methodsFor:'documentation'!
+version
+ ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.264 2012/01/12 01:22:36 cg Exp $'
+!
+
version_CVS
- ^ '§Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.255 2011/08/10 23:45:21 vrany Exp §'
-! !
\ No newline at end of file
+ ^ '§Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.264 2012/01/12 01:22:36 cg Exp §'
+! !