WorkspaceApplication.st
changeset 14747 f00c8f1bac55
parent 14746 02985a863ca2
child 14804 3cd896cf9959
--- a/WorkspaceApplication.st	Thu Sep 25 21:48:31 2014 +0200
+++ b/WorkspaceApplication.st	Fri Sep 26 12:24:40 2014 +0200
@@ -1795,102 +1795,7 @@
 !
 
 openSystemWorkspace
-    |wsApp path needRemove font|
-
-    needRemove := true.
-
-    wsApp := self new.
-    wsApp allButOpen.
-
-    (wsApp builder componentAt:'NoteBook')
-        destroyTabAction:[:tabIndex| wsApp removeWorkspace:tabIndex].
-
-    wsApp window extent:640@400.
-
-    path := (Smalltalk getSystemFileName:'README') ?  '../../README'.
-    path := path asFilename.
-    path isReadable ifTrue:[
-        wsApp addWindow:(self createWorkspaceView) named:'README' asFirst:false.
-        wsApp loadFile:path.
-        wsApp removeWorkspace:1.  "/ the original Workspace
-        wsApp renameWorkspace:1 to:'LICENCE README'.
-        needRemove := false.
-    ].
-
-"/    path := (Smalltalk getSystemFileName:'doc/online/english/LICENCE_STX.html') ?  '../../doc/online/english/LICENCE_STX.html'.
-"/    path asFilename exists ifTrue:[
-"/        wsApp addWindow:(licenceView := HVScrollableView for:HTMLDocumentView) named:'License' asFirst:false.
-"/        licenceView homeDocument:'../../doc/online/english/LICENCE_STX.html'.
-"/        licenceView updateLabelFlag:false.
-"/        needRemove ifTrue:[wsApp removeWorkspace:1].  "/ the original Workspace
-"/        needRemove := false.
-"/    ].
-
-    wsApp graphicsDevice platformName = 'X11' ifTrue:[
-        font := Font family:'unifont' face:'medium' style:'roman' size:16 encoding:'iso10646-1'.
-        font := font onDevice:wsApp graphicsDevice ifAbsent:nil.
-        font isNil ifTrue:[    
-            font := Font family:'arial' face:'medium' style:'roman' size:12 encoding:'iso10646-1'.
-            font := font onDevice:wsApp graphicsDevice ifAbsent:nil.
-        ].
-    ] ifFalse:[
-        "/ font := Font family:'Arial Unicode MS' face:'medium' style:'roman' size:10 encoding:'ms-ansi'.
-        font := Font family:'arial' face:'medium' style:'roman' size:10 encoding:'ms-ansi'.
-        font := font onDevice:wsApp graphicsDevice ifAbsent:nil.
-    ].
-
-    #(  "/ file                     resourceKey             title                       forcedEncoding  type
-        ('Hello_utf8.wsp'           HELLO_UTF_FILE          'Hello'                     #'utf8'         #text)
-        ('Welcome.wsp'              WELCOME_FILE            'This Release'              nil             #text)
-"/        ('Setup.wsp'                SETUP_FILE              'Setup'                     nil             #text)
-        ('Keyboard.wsp'             KEYBOARD_FILE           'Keyboard'                  nil             #text)
-"/        ('GettingStarted.wsp'       GETTING_STARTED_FILE    'Getting Started'           nil             #text)
-        ('../../doc/online/english/GettingStarted.html'   GETTING_STARTED_TML_FILE  'Getting Started'           nil             #html)
-        ('../../doc/books/JoyOfST/IntroToST.html'         INTRO_TO_ST_FILE          'Smalltalk Introduction'    nil             #html)
-    "/ if these are present, show them.
-        ('Private.wsp'              PRIVATE_FILE            'Private Workspace'         nil             #text)
-        ('MyWorkspace.wsp'          MYWORKSPACE_FILE        'My Workspace'              nil             #text)
-        ('PackageLoading.wsp'       PACKAGELOADING_FILE     'Packages'                  nil             #text)
-    ) do:[:tuple |
-        |file resKey title forcedEncoding type pane encoding htmlView|
-
-        file := tuple at:1.
-        resKey := tuple at:2.
-        file := self classResources string:resKey default:file.
-
-        title := tuple at:3.
-        forcedEncoding := tuple at:4.
-        type := tuple at:5.
-
-        path := Smalltalk getSystemFileName:file.
-        (path notNil and:[path asFilename isReadable]) ifTrue:[
-            type == #html ifTrue:[
-                wsApp addWindow:(htmlView := HVScrollableView for:HTMLDocumentView) named:title asFirst:false.
-                htmlView homeDocument:path.
-                htmlView infoHolder:wsApp infoLabelHolder.
-                htmlView updateTopViewsTitleFlag:false.
-            ] ifFalse:[
-                wsApp addWindow:(pane := self createWorkspaceView) named:title asFirst:false.
-                forcedEncoding notNil ifTrue:[
-                    encoding := forcedEncoding.
-                    font notNil ifTrue:[
-                        pane font:font.
-                    ]
-                ] ifFalse:[
-                    encoding := CharacterEncoder guessEncodingOfFile:path.
-                    (encoding == #'iso8859-1' or:[encoding == #'ascii']) ifTrue:[
-                        encoding := nil
-                    ].
-                ].
-                wsApp loadFile:path encoding:encoding label:title.
-            ].
-            needRemove ifTrue:[wsApp removeWorkspace:1].  "/ the original Workspace
-            needRemove := false.
-        ].
-    ].
-    wsApp openWindow.
-    wsApp selectedWorkspaceIndexHolder value:2.
-    ^ wsApp
+    ^ self new openSystemWorkspace.
 
     "
      |ws b|
@@ -4269,6 +4174,124 @@
     ]
 ! !
 
+!WorkspaceApplication methodsFor:'special startup'!
+
+openSystemWorkspace
+    |path needRemove font|
+
+    needRemove := true.
+
+    self allButOpen.
+
+    (self builder componentAt:'NoteBook')
+        destroyTabAction:[:tabIndex| self removeWorkspace:tabIndex].
+
+    self window extent:640@400.
+
+    path := (Smalltalk getSystemFileName:'README') ?  '../../README'.
+    path := path asFilename.
+    path isReadable ifTrue:[
+        self addWindow:(self createWorkspaceView) named:'README' asFirst:false.
+        self loadFile:path.
+        self removeWorkspace:1.  "/ the original Workspace
+        self renameWorkspace:1 to:'LICENCE README'.
+        needRemove := false.
+    ].
+
+"/    path := (Smalltalk getSystemFileName:'doc/online/english/LICENCE_STX.html') ?  '../../doc/online/english/LICENCE_STX.html'.
+"/    path asFilename exists ifTrue:[
+"/        self addWindow:(licenceView := HVScrollableView for:HTMLDocumentView) named:'License' asFirst:false.
+"/        licenceView homeDocument:'../../doc/online/english/LICENCE_STX.html'.
+"/        licenceView updateLabelFlag:false.
+"/        needRemove ifTrue:[self removeWorkspace:1].  "/ the original Workspace
+"/        needRemove := false.
+"/    ].
+
+    self graphicsDevice platformName = 'X11' ifTrue:[
+        font := Font family:'unifont' face:'medium' style:'roman' size:16 encoding:'iso10646-1'.
+        font := font onDevice:self graphicsDevice ifAbsent:nil.
+        font isNil ifTrue:[    
+            font := Font family:'arial' face:'medium' style:'roman' size:12 encoding:'iso10646-1'.
+            font := font onDevice:self graphicsDevice ifAbsent:nil.
+        ].
+    ] ifFalse:[
+        "/ font := Font family:'Arial Unicode MS' face:'medium' style:'roman' size:10 encoding:'ms-ansi'.
+        font := Font family:'arial' face:'medium' style:'roman' size:10 encoding:'ms-ansi'.
+        font := font onDevice:self graphicsDevice ifAbsent:nil.
+    ].
+
+    #(  "/ file                     resourceKey             title                       forcedEncoding  type
+        ('Hello_utf8.wsp'           HELLO_UTF_FILE          'Hello'                     #'utf8'         #text)
+        ('Welcome.wsp'              WELCOME_FILE            'This Release'              nil             #text)
+"/        ('Setup.wsp'                SETUP_FILE              'Setup'                     nil             #text)
+        ('Keyboard.wsp'             KEYBOARD_FILE           'Keyboard'                  nil             #text)
+"/        ('GettingStarted.wsp'       GETTING_STARTED_FILE    'Getting Started'           nil             #text)
+        ('../../doc/online/english/GettingStarted.html'   GETTING_STARTED_TML_FILE  'Getting Started'           nil             #html)
+        ('../../doc/books/JoyOfST/IntroToST.html'         INTRO_TO_ST_FILE          'Smalltalk Introduction'    nil             #html)
+    "/ if these are present, show them.
+        ('Private.wsp'              PRIVATE_FILE            'Private Workspace'         nil             #text)
+        ('MyWorkspace.wsp'          MYWORKSPACE_FILE        'My Workspace'              nil             #text)
+        ('PackageLoading.wsp'       PACKAGELOADING_FILE     'Packages'                  nil             #text)
+    ) do:[:tuple |
+        |file resKey title forcedEncoding type pane encoding htmlView|
+
+        file := tuple at:1.
+        resKey := tuple at:2.
+        file := self resources string:resKey default:file.
+
+        title := tuple at:3.
+        forcedEncoding := tuple at:4.
+        type := tuple at:5.
+
+        path := Smalltalk getSystemFileName:file.
+        (path notNil and:[path asFilename isReadable]) ifTrue:[
+            type == #html ifTrue:[
+                self addWindow:(htmlView := HVScrollableView for:HTMLDocumentView) named:title asFirst:false.
+                htmlView homeDocument:path.
+                htmlView infoHolder:self infoLabelHolder.
+                htmlView updateTopViewsTitleFlag:false.
+            ] ifFalse:[
+                self addWindow:(pane := self createWorkspaceView) named:title asFirst:false.
+                forcedEncoding notNil ifTrue:[
+                    encoding := forcedEncoding.
+                    font notNil ifTrue:[
+                        pane font:font.
+                    ]
+                ] ifFalse:[
+                    encoding := CharacterEncoder guessEncodingOfFile:path.
+                    (encoding == #'iso8859-1' or:[encoding == #'ascii']) ifTrue:[
+                        encoding := nil
+                    ].
+                ].
+                self loadFile:path encoding:encoding label:title.
+            ].
+            needRemove ifTrue:[self removeWorkspace:1].  "/ the original Workspace
+            needRemove := false.
+        ].
+    ].
+    self openWindow.
+    self selectedWorkspaceIndexHolder value:2.
+
+    "
+     |ws b|
+     ws := self openSystemWorkspace.
+     ws addMyWorkspace.
+     ws selectedWorkspaceIndexHolder value:(ws workspaces size).
+     ws selectedWorkspace contents:'Tools::NewSystemBrowser open'; selectAll.
+     ws selectedWorkspace 
+        add:(b := Button label:'DoIt' action:[ws doIt. b destroy])
+    "
+    "
+     |ws b|
+     ws := self new.
+     ws open. 
+     ws selectedWorkspace contents:'Tools::NewSystemBrowser open'; selectAll.
+    "
+
+    "Modified: / 14-02-2010 / 23:02:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 05-07-2011 / 15:34:40 / cg"
+! !
+
 !WorkspaceApplication methodsFor:'user actions'!
 
 infoVisibilityChanged
@@ -4302,14 +4325,14 @@
 !WorkspaceApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.272 2014-09-25 19:48:31 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.273 2014-09-26 10:24:40 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.272 2014-09-25 19:48:31 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.273 2014-09-26 10:24:40 stefan Exp $'
 !
 
 version_SVN
-    ^ '$Id: WorkspaceApplication.st,v 1.272 2014-09-25 19:48:31 stefan Exp $'
+    ^ '$Id: WorkspaceApplication.st,v 1.273 2014-09-26 10:24:40 stefan Exp $'
 ! !