WorkspaceApplication.st
changeset 11481 d0a2a73ed69d
parent 11480 2297d5c64763
child 11483 5f545a7d153a
--- a/WorkspaceApplication.st	Sat Apr 21 19:12:44 2012 +0200
+++ b/WorkspaceApplication.st	Sat Apr 21 20:37:45 2012 +0200
@@ -677,6 +677,7 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
      MenuEditor new openOnClass:WorkspaceApplication andSelector:#editMenu
      (Menu new fromLiteralArrayEncoding:(WorkspaceApplication editMenu)) startUp
@@ -716,16 +717,19 @@
             label: '-'
           )
          (MenuItem
+            enabled: hasSelectionInActiveWorkspace
             label: 'Copy as Sniplet...'
             itemValue: addSelectionToSniplets
             translateLabel: true
           )
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Paste Sniplet...'
             itemValue: pasteSniplet
             translateLabel: true
           )
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Manage Sniplets...'
             itemValue: manageSniplets
             translateLabel: true
@@ -743,12 +747,14 @@
             isVisible: thisIsASmalltalkWorkspace
           )
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Filter Text...'
             itemValue: filterText
             translateLabel: true
             isVisible: thisIsASmalltalkWorkspace
           )
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Process Text...'
             itemValue: processText
             translateLabel: true
@@ -786,6 +792,7 @@
                   isVisible: thisIsASmalltalkWorkspace
                 )
                (MenuItem
+                  enabled: hasSelectionInActiveWorkspace
                   label: 'Translate (babelFish)'
                   translateLabel: true
                   isVisible: thisIsASmalltalkWorkspace
@@ -1363,6 +1370,7 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
      MenuEditor new openOnClass:WorkspaceApplication andSelector:#smalltalkMenu
      (Menu new fromLiteralArrayEncoding:(WorkspaceApplication smalltalkMenu)) startUp
@@ -1374,11 +1382,13 @@
      #(Menu
         (
          (MenuItem
+            enabled: hasSelectionInActiveWorkspace
             label: 'FileIn Text'
             itemValue: fileInText
             translateLabel: true
           )
          (MenuItem
+            enabled: hasSelectionInActiveWorkspace
             label: 'ChangeList on Text'
             itemValue: changesBrowserOnText
             translateLabel: true
@@ -1387,11 +1397,13 @@
             label: '-'
           )
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Add Global Variable...'
             itemValue: addGlobalVariable
             translateLabel: true
           )
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Remove Global Variable...'
             itemValue: removeGlobalVariable
             translateLabel: true
@@ -1400,11 +1412,13 @@
             label: '-'
           )
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Add SharedPool...'
             itemValue: addSharedPool
             translateLabel: true
           )
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Remove SharedPool...'
             itemValue: removeSharedPool
             translateLabel: true
@@ -1527,6 +1541,7 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
      MenuEditor new openOnClass:WorkspaceApplication andSelector:#workspaceMenu
      (Menu new fromLiteralArrayEncoding:(WorkspaceApplication workspaceMenu)) startUp
@@ -1538,6 +1553,7 @@
      #(Menu
         (
          (MenuItem
+            enabled: selectedWorkspaceIsTextView
             label: 'Add Workspace Variable...'
             itemValue: addWorkspaceVariable
             translateLabel: true
@@ -2030,7 +2046,7 @@
 !
 
 hasHistory
-    ^ Workspace doItHistory size > 0.
+    ^ Workspace doItHistory notEmptyOrNil.
 !
 
 hasInfoLabel
@@ -2126,6 +2142,10 @@
     ^(Smalltalk at:#WebKitView) notNil
 
     "Created: / 11-06-2011 / 00:30:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selectedWorkspaceIsTextView
+    ^ self selectedWorkspacesTextView notNil
 ! !
 
 !WorkspaceApplication methodsFor:'autofetch selection'!
@@ -2421,7 +2441,12 @@
 !
 
 browseIt
-    self selectedWorkspacesTextView browseIt
+    |ws|
+
+    ws := self selectedWorkspacesTextView.
+    ws notNil ifTrue:[
+        ws browseIt
+    ]
 !
 
 browseReferencesToIt
@@ -2433,7 +2458,12 @@
 !
 
 doIt
-    self selectedWorkspacesTextView doIt
+    |ws|
+
+    ws := self selectedWorkspacesTextView.
+    ws notNil ifTrue:[
+        ws doIt
+    ]
 !
 
 inspectIt
@@ -2444,6 +2474,10 @@
     |ws|
 
     ws := self selectedWorkspacesTextView.
+    ws isNil ifTrue:[
+        "there is none - i.e. it is a HTMLDocumentView"
+        ^ self.
+    ].
     ws
         do:(ws selection) 
         withValueDo:[:result | 
@@ -2624,7 +2658,12 @@
 !
 
 printIt
-    self selectedWorkspacesTextView printIt
+    |ws|
+
+    ws := self selectedWorkspacesTextView.
+    ws notNil ifTrue:[
+        ws printIt
+    ]
 !
 
 processText
@@ -2767,8 +2806,12 @@
         ^ self
     ].
     poolsConsideredInDoIts remove:poolToRemove.
-    workspaces do:[:ws |
-        ws poolsConsideredInDoits:poolsConsideredInDoIts.
+    workspaces do:[:eachWs |    
+        |ws|
+        ws := self workspaceViewOfView:eachWs.
+        ws notNil ifTrue:[
+            ws poolsConsideredInDoIts:poolsConsideredInDoIts.
+        ].
     ].
 
     "Modified: / 24-11-2006 / 12:44:16 / cg"
@@ -3078,8 +3121,12 @@
         poolsConsideredInDoIts := (Set new).
     ].
     poolsConsideredInDoIts add:poolToAdd.
-    workspaces do:[:ws |
-        ws poolsConsideredInDoIts:poolsConsideredInDoIts.
+    workspaces do:[:eachWs |    
+        |ws|
+        ws := self workspaceViewOfView:eachWs.
+        ws notNil ifTrue:[
+            ws poolsConsideredInDoIts:poolsConsideredInDoIts.
+        ].
     ].
 
     "Modified: / 24-11-2006 / 12:44:16 / cg"
@@ -3810,11 +3857,11 @@
 !WorkspaceApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.217 2012-04-21 17:12:44 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.218 2012-04-21 18:37:45 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.217 2012-04-21 17:12:44 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.218 2012-04-21 18:37:45 stefan Exp $'
 !
 
 version_SVN