WorkspaceApplication.st
branchjv
changeset 18832 74115b507c3d
parent 18226 346376844040
child 19594 5c646fbd4742
--- a/WorkspaceApplication.st	Thu Oct 11 14:19:28 2018 +0200
+++ b/WorkspaceApplication.st	Fri Jun 21 22:35:56 2019 +0100
@@ -645,10 +645,12 @@
     ^ 
     #(FullSpec
        name: windowSpecForInfoBar
+       uuid: '7bc14bc0-940a-11e9-8e2a-606720e43e2c'
        window: 
       (WindowSpec
          label: 'Info Bar'
          name: 'Info Bar'
+         uuid: '7bc14bc1-940a-11e9-8e2a-606720e43e2c'
          bounds: (Rectangle 0 0 473 30)
        )
        component: 
@@ -657,12 +659,14 @@
           (ViewSpec
              name: 'infoView'
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+             uuid: '7bc14bc2-940a-11e9-8e2a-606720e43e2c'
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    name: 'infoLabel'
                    layout: (LayoutFrame 0 0.0 0 0.0 -220 1.0 0 1.0)
+                   uuid: '7bc14bc3-940a-11e9-8e2a-606720e43e2c'
                    level: -1
                    translateLabel: true
                    labelChannel: infoLabelHolder
@@ -673,6 +677,7 @@
                    name: 'namespaceInfoLabelHolder'
                    layout: (LayoutFrame -220 1.0 0 0.0 -136 1.0 0 1.0)
                    activeHelpKey: namespaceSelection
+                   uuid: '7bc14bc4-940a-11e9-8e2a-606720e43e2c'
                    level: -1
                    translateLabel: true
                    labelChannel: namespaceInfoLabelHolder
@@ -684,6 +689,7 @@
                    name: 'LanguageLabel'
                    layout: (LayoutFrame -136 1.0 0 0.0 -65 1.0 0 1.0)
                    activeHelpKey: languageSelection
+                   uuid: '7bc14bc5-940a-11e9-8e2a-606720e43e2c'
                    level: -1
                    translateLabel: true
                    labelChannel: languageInfoLabelHolder
@@ -695,6 +701,7 @@
                    name: 'ModeLabel'
                    layout: (LayoutFrame -65 1 0 0.0 -50 1 0 1.0)
                    activeHelpKey: modeLabel
+                   uuid: '7bc14bc6-940a-11e9-8e2a-606720e43e2c'
                    level: -1
                    translateLabel: true
                    labelChannel: modeLabelHolder
@@ -704,7 +711,9 @@
                    name: 'CursorLineAndColLabel'
                    layout: (LayoutFrame -50 1 0 0.0 0 1 0 1.0)
                    activeHelpKey: lineAndColumnLabel
+                   uuid: '7bc14bc7-940a-11e9-8e2a-606720e43e2c'
                    level: -1
+                   translateLabel: true
                    labelChannel: cursorLineAndColumnLabelHolder
                    adjust: left
                  )
@@ -716,6 +725,8 @@
         
        )
      )
+
+    "Modified: / 21-06-2019 / 11:26:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !WorkspaceApplication class methodsFor:'menu specs'!
@@ -1498,22 +1509,27 @@
         (
          (MenuItem
             label: 'File'
+            isVisible: true
             submenuChannel: fileMenu
           )
          (MenuItem
             label: 'Buffers'
+            isVisible: true
             submenuChannel: bufferMenu
           )
          (MenuItem
             label: 'Edit'
+            isVisible: true
             submenuChannel: editMenu
           )
          (MenuItem
             label: 'View'
+            isVisible: true
             submenuChannel: viewMenu
           )
          (MenuItem
             label: 'Bookmarks'
+            isVisible: true
             submenuChannel: bookmarkMenu
           )
          (MenuItem
@@ -1534,6 +1550,7 @@
           )
          (MenuItem
             label: 'MENU_Help'
+            isVisible: true
             submenuChannel: helpMenu
           )
          )
@@ -2207,7 +2224,7 @@
 
     ws := self selectedWorkspace scrolledView.
     ws isTextView ifTrue:[
-        ^ BookmarkList forWorkspace
+        ^ self bookmarksForWorkspace
     ].
     (ws isApplicationSubView) ifTrue:[
         app := ws application.
@@ -2218,11 +2235,31 @@
             ^ app bookmarkListHolder value
         ].
     ].
-    ^ BookmarkList new.
+    ^ nil.
 
     "Created: / 20-06-2011 / 22:23:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 21-06-2011 / 08:13:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 05-07-2011 / 14:21:10 / cg"
+    "Modified: / 23-06-2019 / 12:35:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+bookmarksForWorkspace
+    "Return bookmarks to use when in text workspace mode
+     (i.e., workspace is a text editor).
+
+     Subclasses may (should) override this method.
+    "
+
+    "/ By default return (smalltalk_ workspace bookmarks only
+    "/ for myself, custom subclasses may override this method
+    "/ to provide theur own bookmarks
+    self class == WorkspaceApplication ifTrue:[
+        ^ BookmarkList forWorkspace
+    ] ifFalse:[ 
+        ^ nil
+    ].
+
+    "Created: / 20-06-2019 / 21:47:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 23-06-2019 / 12:38:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 browseItMenuButtonVisibile
@@ -2363,14 +2400,16 @@
 
 namespaceInfoLabelHolder
     ^ BlockValue
-        with:[:ns | 
-                ns notNil ifTrue:[
-                    ns name
-                ] ifFalse:[
-                    ''
-                ]
-             ]
-        argument:self namespaceHolder
+        with:[:ns :syntax | 
+            (ns notNil and:[syntax value == SmalltalkLanguage instance]) ifTrue:[
+                ns name
+            ] ifFalse:[
+                ''
+            ]
+         ]
+        arguments:(Array with: self namespaceHolder with: self syntaxHolder)
+
+    "Modified: / 23-06-2019 / 12:14:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 printItMenuButtonVisibile
@@ -2462,6 +2501,15 @@
     "Created: / 20-06-2011 / 22:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+hasBookmarksAspect
+
+    ^ BlockValue
+        with:[ :ignored | self bookmarks notNil ]
+        argument: self selectedWorkspaceIndexHolder
+
+    "Created: / 23-06-2019 / 12:41:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 isSQLWorkspaceAvailable
 
     ^(Smalltalk at:#'SQL::WorkspacePage') notNil
@@ -2788,8 +2836,10 @@
     autoDefine := autoDefineVariables value.
     UserPreferences current autoDefineWorkspaceVariables:(autoDefine == #workspace).
     workspaces do:[:each |
-        each autoDefineVariables:autoDefine
+        MessageNotUnderstood catch:[ each autoDefineVariables:autoDefine ]
     ].
+
+    "Modified: / 20-06-2019 / 18:01:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 basicInspectIt
@@ -3054,18 +3104,19 @@
 !
 
 menuSave
-    |ws file|
-
-    ws := self selectedWorkspace scrolledView.
+    | selectedWorkspace ws file|
+
+    selectedWorkspace := self selectedWorkspace scrolledView.
+    selectedWorkspace isNil ifTrue:[ ^ self ].
+    ws := self workspaceViewOfView: selectedWorkspace.  
     ws isTextView ifFalse:[
         self shouldImplement:'Functionality not yet implemented'.
     ].
     file := ws defaultFileNameForFileDialog.
-    file 
-        ifNil:[
-            self menuSaveAs.
-            ^ self
-        ].
+    file isNil ifTrue:[
+        self menuSaveAs.
+        ^ self
+    ].
     ws saveAs:file doAppend:false.
     ws isCodeView2 ifTrue:[
         ws beUnmodified
@@ -3073,7 +3124,7 @@
 
     "Created: / 21-06-2011 / 11:42:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 05-07-2011 / 15:44:27 / cg"
-    "Modified: / 08-10-2011 / 12:51:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-06-2019 / 11:59:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 newEvaluationWorkspace
@@ -4016,8 +4067,12 @@
 bookmarkMenu
     <resource: #programMenu >
 
-    | menu item |
-
+    | bookmarks menu item |
+
+    bookmarks := self bookmarks.
+    bookmarks isNil ifTrue:[ 
+        ^ nil
+    ].
     menu := self bookmarks asMenuUsingBuilder: (BookmarkMenuBuilder new resources:resources).
     menu hasItems ifTrue:[menu addSeparator].
 
@@ -4036,8 +4091,8 @@
     ^menu
 
     "Created: / 20-06-2011 / 22:21:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 21-06-2011 / 08:05:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 09-09-2012 / 13:25:48 / cg"
+    "Modified: / 23-06-2019 / 12:36:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 editModeInfoLabelMenu
@@ -4233,13 +4288,13 @@
 !
 
 compilerClassOf:aWorkspace
-    |compilerClass|
-
-    [    
-        "/ catch, because it could be a non-edit view there (VT100, TeaTimer etc.)
-        compilerClass := aWorkspace compilerClass. 
-    ] on:MessageNotUnderstood do:[].
+    | compilerClass |
+
+    "/ catch, because it could be a non-edit view there (VT100, TeaTimer etc.)
+    MessageNotUnderstood catch:[ compilerClass := aWorkspace compilerClass ].
     ^ compilerClass
+
+    "Modified: / 21-06-2019 / 11:11:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 createEvaluationWorkspace
@@ -4355,7 +4410,7 @@
 "/    (ws respondsTo:#languageHolder:) ifTrue:[
 "/        ws languageHolder:self syntaxHolder
 "/    ].
-    language := self syntaxHolder value ? Smalltalk programmingLanguage.
+    language := self syntaxHolder value ? self defaultEvaluatorSyntax.
     language notNil ifTrue:[
         ws compilerClass:(language evaluatorClass).
         ws editedLanguage:language.
@@ -4363,7 +4418,7 @@
     ^ ws
 
     "Modified: / 19-07-2012 / 16:39:15 / cg"
-    "Modified: / 21-08-2012 / 17:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-06-2019 / 11:15:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 createWorkspaceViewForText
@@ -4446,7 +4501,10 @@
         selectedWorkspace := selectedWorkspace scrolledView
     ].
 
-    compilerClass := self compilerClassOf: selectedWorkspaceApp ? selectedWorkspace.
+    compilerClass := self compilerClassOf: (selectedWorkspaceApp notNil 
+                                                ifTrue:[selectedWorkspaceApp]
+                                                ifFalse:[selectedWorkspace isNil ifTrue:[nil] ifFalse:[self workspaceViewOfView: selectedWorkspace]]).
+
     self canChangeLanguageHolder value:
         (selectedWorkspaceApp ? selectedWorkspace respondsTo: #compilerClass:).
 
@@ -4473,6 +4531,8 @@
         "/ I provide it
         self toolBarView client: self spec: #toolBarSpec builder: builder.
     ]
+
+    "Modified: / 21-06-2019 / 12:06:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !WorkspaceApplication methodsFor:'special startup'!