ProcessMonitorV2.st
changeset 15297 59dbcd4b2bb2
parent 14416 020eb4c3034d
child 15298 a676e57b5fca
--- a/ProcessMonitorV2.st	Sat Feb 14 18:11:13 2015 +0100
+++ b/ProcessMonitorV2.st	Sun Feb 15 13:36:56 2015 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libtool' }"
 
+"{ NameSpace: Smalltalk }"
+
 ApplicationModel subclass:#ProcessMonitorV2
 	instanceVariableNames:'processList tableColumns selectedProcesses updateSema showDetail
 		hasSelectionHolder showProcessId showGroup showState showPrio
@@ -153,22 +155,25 @@
     ^ super flyByHelpSpec addPairsFrom:#(
 
 #Debug
-'Debug'
+'Debug the selected process'
 
 #Details
-'Details'
+'Details - select columns to display'
 
 #Inspect
-'Inspect'
+'Inspect the selected process'
+
+#findProcessByView
+'Pick a view and select the associated window group process'
 
 #'Lower Prio'
-'Lower Prio'
+'Lower the priority of the selected process'
 
 #'Raise Prio'
-'Raise Prio'
+'Raise the priority of the selected process'
 
 #RaiseWindow
-'Raise Application''s Window'
+'Raise the application''s window'
 
 #Restart
 'Restart'
@@ -1405,6 +1410,13 @@
             label: 'Set Prio Range...'
             itemValue: setPrioRange
           )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            label: 'Find by View'
+            itemValue: findProcessByView
+          )
          )
         nil
         nil
@@ -1536,6 +1548,7 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
      MenuEditor new openOnClass:ProcessMonitorV2 andSelector:#toolBarMainMenu
      (Menu new fromLiteralArrayEncoding:(ProcessMonitorV2 toolBarMainMenu)) startUp
@@ -1551,7 +1564,6 @@
             enabled: hasSelectionHolder
             label: 'Inspect'
             itemValue: inspectSelection
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processInspect22x22Icon)
@@ -1561,7 +1573,6 @@
             enabled: hasSelectionHolder
             label: 'Debug'
             itemValue: debugProcess
-            translateLabel: true
             isButton: true
             isVisible: allowModificationsAndHasDebugger
             labelImage: (ResourceRetriever ProcessMonitorV2 processDebug22x22Icon)
@@ -1571,11 +1582,17 @@
             enabled: hasSelectionWithApplicationProcessHolder
             label: 'Raise Applications Window'
             itemValue: raiseApplicationWindow
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever ProcessMonitorV2 raiseWindow22x22Icon)
           )
          (MenuItem
+            enabled: hasSelectionWithApplicationProcessHolder
+            label: 'Find Process by View'
+            itemValue: findProcessByView
+            isButton: true
+            labelImage: (ResourceRetriever ToolbarIconLibrary pickWindowIcon)
+          )
+         (MenuItem
             label: '-'
             isVisible: allowModifications
           )
@@ -1584,7 +1601,6 @@
             enabled: hasSelectionWithStoppedProcessHolder
             label: 'Resume'
             itemValue: resumeProcess
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processResume22x22Icon)
@@ -1594,7 +1610,6 @@
             enabled: hasSelectionHolder
             label: 'Stop'
             itemValue: stopProcess
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processStop22x22Icon)
@@ -1604,7 +1619,6 @@
             enabled: hasSelectionHolder
             label: 'Abort'
             itemValue: abortProcess
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processAbort22x22Icon)
@@ -1618,7 +1632,6 @@
             enabled: hasSelectionHolder
             label: 'Terminate'
             itemValue: terminateProcess
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processTerminate22x22Icon)
@@ -1628,7 +1641,6 @@
             enabled: hasSelectionHolder
             label: 'Terminate Group'
             itemValue: terminateProcessGroup
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processTerminateGroup22x22Icon)
@@ -1638,7 +1650,6 @@
             enabled: selectionRestartable
             label: 'Restart'
             itemValue: restartProcess
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processRestart22x22Icon)
@@ -1652,7 +1663,6 @@
             enabled: hasSelectionHolder
             label: 'Lower Prio'
             itemValue: lowerPrio
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processLowerPrio22x22Icon)
@@ -1662,7 +1672,6 @@
             enabled: hasSelectionHolder
             label: 'Raise Prio'
             itemValue: raisePrio
-            translateLabel: true
             isButton: true
             isVisible: allowModifications
             labelImage: (ResourceRetriever ProcessMonitorV2 processRaisePrio22x22Icon)
@@ -1675,7 +1684,6 @@
             activeHelpKey: #'Update Process List'
             label: 'Update'
             itemValue: updateList
-            translateLabel: true
             isButton: true
             startGroup: right
             labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
@@ -1683,7 +1691,6 @@
          (MenuItem
             activeHelpKey: Details
             label: 'View Details'
-            translateLabel: true
             isButton: true
             startGroup: right
             submenuChannel: viewDetailsMenuSpec
@@ -2782,6 +2789,24 @@
     "Modified: / 07-06-2007 / 12:38:42 / cg"
 !
 
+findProcessByView
+    "let user click on a window. then select the corresponding process"
+
+    |v wg p item|
+
+    v := Screen current viewFromUser.
+    v notNil ifTrue:[
+        (wg := v windowGroup) notNil ifTrue:[
+            (p := wg process) notNil ifTrue:[
+                item := processList detect:[:i | i processId = p id] ifNone:nil.
+                item notNil ifTrue:[
+                    self selectedProcesses value:(Array with:item)
+                ]
+            ].
+        ]
+    ].
+!
+
 hardTerminateProcess
     "hard terminate the selected process"
 
@@ -4054,10 +4079,10 @@
 !ProcessMonitorV2 class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/ProcessMonitorV2.st,v 1.70 2014-05-23 09:32:28 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/ProcessMonitorV2.st,v 1.71 2015-02-15 12:36:56 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/ProcessMonitorV2.st,v 1.70 2014-05-23 09:32:28 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/ProcessMonitorV2.st,v 1.71 2015-02-15 12:36:56 cg Exp $'
 ! !