From f772c0730044529a27aab3d8fd65b2d6cbfb6115 Mon Sep 17 00:00:00 2001
From: Gwenael Casaccio <mrgwen@gmail.com>
Date: Tue, 29 Oct 2013 14:56:16 +0100
Subject: [PATCH] Makes the debugger/text widget non-blocking and fix the
 continue back into GTK/Event-Loop/C-code.

---
 packages/visualgst/ChangeLog               | 15 ++++++
 packages/visualgst/Debugger/GtkDebugger.st | 30 +++++++----
 packages/visualgst/Makefile.frag           |  2 +-
 packages/visualgst/Misc/TaskQueue.st       | 81 ++++++++++++++++++++++++++++++
 packages/visualgst/Text/GtkTextWidget.st   | 39 ++++++++------
 packages/visualgst/package.xml             |  4 +-
 6 files changed, 144 insertions(+), 27 deletions(-)
 create mode 100644 packages/visualgst/Misc/TaskQueue.st

diff --git a/packages/visualgst/ChangeLog b/packages/visualgst/ChangeLog
index 3b43a5f..8f34236 100644
--- a/packages/visualgst/ChangeLog
+++ b/packages/visualgst/ChangeLog
@@ -1,5 +1,20 @@
 2013-10-21  Gwenael Casaccio  <gwenael.casaccio@gmail.com>
 
+	* Debugger/GtkDebugger.st: Makes the debugger non-blocking and fix the continue back into GTK/Event-Loop/C-code.
+	* Debugger/GtkTextWidget.st: Makes the debugger non-blocking and fix the continue back into GTK/Event-Loop/C-code.
+	* Misc/TaskQueue.st : Add a queue of tasks.
+
+2013-10-21  Gwenael Casaccio  <gwenael.casaccio@gmail.com>
+
+	* Debugger/GtkDebugger.st: If stepping while the last context is not selected it finishes the execution
+	up to the selected context and does the stepping command.
+
+2013-10-21  Gwenael Casaccio  <gwenael.casaccio@gmail.com>
+
+	* Debugger/GtkDebugger.st: Code can be changed in the debugger.
+
+2013-10-21  Gwenael Casaccio  <gwenael.casaccio@gmail.com>
+
 	* Debugger/GtkDebugger.st: Eval code in the debugger.
 
 2013-10-18  Gwenael Casaccio  <gwenael.casaccio@gmail.com>
diff --git a/packages/visualgst/Debugger/GtkDebugger.st b/packages/visualgst/Debugger/GtkDebugger.st
index f0fb969..29a3f22 100644
--- a/packages/visualgst/Debugger/GtkDebugger.st
+++ b/packages/visualgst/Debugger/GtkDebugger.st
@@ -285,22 +285,28 @@ GtkBrowsingTool subclass: GtkDebugger [
     stepInto [
         <category: 'execute events'>
 
-        debugger step.
-        self updateContextWidget
+        self debugWith: [ debugger step ]
     ]
 
     stepOver [
         <category: 'execute events'>
 
-        debugger next.
-        self updateContextWidget
+        self debugWith: [ debugger next ]
     ]
 
     stepOut [
         <category: 'execute events'>
 
-        debugger finish.
-        self updateContextWidget
+        self debugWith: [ debugger finish ]
+    ]
+
+    debugWith: aBlock [
+        <category: 'execute events'>
+
+        TaskQueue uniqueInstance add: [
+            self isLastContextSelected ifFalse: [ self stepToSelectedContext ].
+            aBlock value.
+            self updateContextWidget ]
     ]
 
     continue [
@@ -375,7 +381,7 @@ GtkBrowsingTool subclass: GtkDebugger [
 
         codeWidget hasFocus ifFalse: [ ^ self focusedWidget doIt: object ].
         codeWidget hasSelection ifFalse: [ ^ self ].
-        debugger eval: codeWidget selectedText.
+        TaskQueue uniqueInstance add: [ debugger eval: codeWidget selectedText ].
     ]
 
     debugIt: object [
@@ -391,7 +397,7 @@ GtkBrowsingTool subclass: GtkDebugger [
 
         codeWidget hasFocus ifFalse: [ ^ self focusedWidget inspectIt: object ].
         codeWidget hasSelection ifFalse: [ ^ self ].
-        (debugger eval: codeWidget selectedText) gtkInspect.
+        TaskQueue uniqueInstance add: [ (debugger eval: codeWidget selectedText) gtkInspect ].
     ]
 
     printIt: object [
@@ -399,7 +405,7 @@ GtkBrowsingTool subclass: GtkDebugger [
 
         codeWidget hasFocus ifFalse: [ ^ self focusedWidget printIt: object ].
         codeWidget hasSelection ifFalse: [ ^ self ].
-        codeWidget printString: (debugger eval: codeWidget selectedText).
+        TaskQueue uniqueInstance add: [ codeWidget printString: (debugger eval: codeWidget selectedText) ].
     ]
 
     state [
@@ -438,6 +444,12 @@ GtkBrowsingTool subclass: GtkDebugger [
         PrintItCommand executeOn: self
     ]
 
+    isLastContextSelected [
+        <category: 'testing'>
+
+        ^ contextWidget selectedContext == debugger suspendedContext
+    ]
+
     hasChanged [
 	<category: 'testing'>
 
diff --git a/packages/visualgst/Makefile.frag b/packages/visualgst/Makefile.frag
index 7436df7..3a744bc 100644
--- a/packages/visualgst/Makefile.frag
+++ b/packages/visualgst/Makefile.frag
@@ -1,5 +1,5 @@
 VisualGST_FILES = \
-packages/visualgst/AbstractFinder.st packages/visualgst/Category/AbstractNamespace.st packages/visualgst/Category/ClassCategory.st packages/visualgst/Category/Class.st packages/visualgst/ClassFinder.st packages/visualgst/Clock/GtkClock.st packages/visualgst/Commands/CategoryMenus/AddCategoryCommand.st packages/visualgst/Commands/CategoryMenus/CategoryCommand.st packages/visualgst/Commands/CategoryMenus/FileoutCategoryCommand.st packages/visualgst/Commands/CategoryMenus/RenameCategoryCommand.st packages/visualgst/Commands/ClassMenus/AddClassCommand.st packages/visualgst/Commands/ClassMenus/ClassCommand.st packages/visualgst/Commands/ClassMenus/DeleteClassCommand.st packages/visualgst/Commands/ClassMenus/FileoutClassCommand.st packages/visualgst/Commands/ClassMenus/InspectClassCommand.st packages/visualgst/Commands/ClassMenus/RenameClassCommand.st packages/visualgst/Commands/Command.st packages/visualgst/Commands/DebugMenus/ContinueDebugCommand.st packages/visualgst/Commands/DebugMenus/DebugCommand.st packages/visualgst/Commands/DebugMenus/StepIntoDebugCommand.st packages/visualgst/Commands/DebugMenus/StepOverDebugCommand.st packages/visualgst/Commands/EditMenus/CancelEditCommand.st packages/visualgst/Commands/EditMenus/CopyEditCommand.st packages/visualgst/Commands/EditMenus/CutEditCommand.st packages/visualgst/Commands/EditMenus/FindEditCommand.st packages/visualgst/Commands/EditMenus/PasteEditCommand.st packages/visualgst/Commands/EditMenus/RedoEditCommand.st packages/visualgst/Commands/EditMenus/ReplaceEditCommand.st packages/visualgst/Commands/EditMenus/SelectAllEditCommand.st packages/visualgst/Commands/EditMenus/UndoEditCommand.st packages/visualgst/Commands/HistoryCommands/HistoryBackCommand.st packages/visualgst/Commands/HistoryCommands/HistoryDisplayCommand.st packages/visualgst/Commands/HistoryCommands/HistoryForwardCommand.st packages/visualgst/Commands/InspectorMenus/InspectorBackCommand.st packages/visualgst/Commands/InspectorMenus/InspectorDiveCommand.st packages/visualgst/Commands/MethodMenus/DebugTestCommand.st packages/visualgst/Commands/MethodMenus/DeleteMethodCommand.st packages/visualgst/Commands/MethodMenus/FileoutMethodCommand.st packages/visualgst/Commands/MethodMenus/InspectMethodCommand.st packages/visualgst/Commands/MethodMenus/MethodCommand.st packages/visualgst/Commands/NamespaceMenus/AddNamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/DeleteNamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/FileoutNamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/InspectNamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/NamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/RenameNamespaceCommand.st packages/visualgst/Commands/OpenBrowserCommand.st packages/visualgst/Commands/OpenTabbedBrowserCommand.st packages/visualgst/Commands/OpenWorkspaceCommand.st packages/visualgst/Commands/SaveImageAsCommand.st packages/visualgst/Commands/SaveImageCommand.st packages/visualgst/Commands/SmalltalkMenus/AcceptItCommand.st packages/visualgst/Commands/SmalltalkMenus/CancelCommand.st packages/visualgst/Commands/SmalltalkMenus/DebugItCommand.st packages/visualgst/Commands/SmalltalkMenus/DoItCommand.st packages/visualgst/Commands/SmalltalkMenus/InspectItCommand.st packages/visualgst/Commands/SmalltalkMenus/PrintItCommand.st packages/visualgst/Commands/System/AddClassCommand.st packages/visualgst/Commands/System/AddMethodCommand.st packages/visualgst/Commands/System/AddNamespaceCommand.st packages/visualgst/Commands/System/DeleteClassCommand.st packages/visualgst/Commands/System/DeleteMethodCommand.st packages/visualgst/Commands/System/DeleteNamespaceCommand.st packages/visualgst/Commands/System/RenameCategoryCommand.st packages/visualgst/Commands/System/RenameClassCommand.st packages/visualgst/Commands/System/RenameNamespaceCommand.st packages/visualgst/Commands/TabsMenus/CloseTabCommand.st packages/visualgst/Commands/TabsMenus/NextTabCommand.st packages/visualgst/Commands/TabsMenus/PreviousTabCommand.st packages/visualgst/Commands/ToolsMenus/OpenAssistantCommand.st packages/visualgst/Commands/ToolsMenus/OpenBottomPaneCommand.st packages/visualgst/Commands/ToolsMenus/OpenImplementorCommand.st packages/visualgst/Commands/ToolsMenus/OpenPackageBuilderCommand.st packages/visualgst/Commands/ToolsMenus/OpenSenderCommand.st packages/visualgst/Commands/ToolsMenus/OpenSUnitCommand.st packages/visualgst/Commands/ToolsMenus/OpenWebBrowserCommand.st packages/visualgst/Commands/WorkspaceMenus/DeleteItemCommand.st packages/visualgst/Commands/WorkspaceMenus/InspectItemCommand.st packages/visualgst/Commands/WorkspaceMenus/WorkspaceVariableCommand.st packages/visualgst/Debugger/Extensions.st packages/visualgst/Debugger/GtkContextWidget.st packages/visualgst/Debugger/GtkDebugger.st packages/visualgst/Debugger/GtkStackInspector.st packages/visualgst/Debugger/GtkStackInspectorView.st packages/visualgst/Extensions.st packages/visualgst/FakeNamespace.st packages/visualgst/GtkAbstractConcreteWidget.st packages/visualgst/GtkAnnouncer.st packages/visualgst/GtkAssistant.st packages/visualgst/GtkBrowsingTool.st packages/visualgst/GtkClassSelectionChanged.st packages/visualgst/GtkClassSUnitWidget.st packages/visualgst/GtkConcreteWidget.st packages/visualgst/GtkEntryDialog.st packages/visualgst/GtkEntryWidget.st packages/visualgst/Gtk/GtkEntryBuffer.st packages/visualgst/Gtk/GtkEntry.st packages/visualgst/GtkHistoryWidget.st packages/visualgst/GtkHSidebarWidget.st packages/visualgst/GtkLauncher.st packages/visualgst/GtkListModel.st packages/visualgst/GtkMainWindow.st packages/visualgst/GtkMethodSUnitWidget.st packages/visualgst/GtkNamespaceSelectionChanged.st packages/visualgst/GtkNotebookWidget.st packages/visualgst/GtkPackageBuilderWidget.st packages/visualgst/GtkScrollTreeWidget.st packages/visualgst/GtkSidebarWidget.st packages/visualgst/GtkSimpleListWidget.st packages/visualgst/GtkTranscriptWidget.st packages/visualgst/GtkTreeModel.st packages/visualgst/GtkVariableTrackerWidget.st packages/visualgst/GtkVisualGSTTool.st packages/visualgst/GtkVSidebarWidget.st packages/visualgst/GtkWebBrowser.st packages/visualgst/GtkWebView.st packages/visualgst/GtkWorkspaceWidget.st packages/visualgst/HistoryStack.st packages/visualgst/Icons/category.gif packages/visualgst/Icons/extension.png packages/visualgst/Icons/go-bottom.png packages/visualgst/Icons/go-down.png packages/visualgst/Icons/go-first.png packages/visualgst/Icons/go-home.png packages/visualgst/Icons/go-jump.png packages/visualgst/Icons/go-last.png packages/visualgst/Icons/go-next.png packages/visualgst/Icons/go-previous.png packages/visualgst/Icons/go-run.png packages/visualgst/Icons/go-top.png packages/visualgst/Icons/go-up.png packages/visualgst/Icons/namespace.gif packages/visualgst/Icons/NUnit.Failed.png packages/visualgst/Icons/NUnit.Loading.png packages/visualgst/Icons/NUnit.None.png packages/visualgst/Icons/NUnit.NotRun.png packages/visualgst/Icons/NUnit.Running.png packages/visualgst/Icons/NUnit.SuccessAndFailed.png packages/visualgst/Icons/NUnit.Success.png packages/visualgst/Icons/overridden.png packages/visualgst/Icons/override.png packages/visualgst/Icons/visualgst.png packages/visualgst/Image/GtkImageModel.st packages/visualgst/Image/GtkImageWidget.st packages/visualgst/Implementors/GtkImageResultsWidget.st packages/visualgst/Implementors/GtkImplementorResultsWidget.st packages/visualgst/Implementors/GtkSenderResultsWidget.st packages/visualgst/Inspector/Extensions.st packages/visualgst/Inspector/GtkCharacterInspectorView.st packages/visualgst/Inspector/GtkCompiledBlockInspectorView.st packages/visualgst/Inspector/GtkCompiledMethodInspectorView.st packages/visualgst/Inspector/GtkContextInspectorView.st packages/visualgst/Inspector/GtkDictionaryInspectorView.st packages/visualgst/Inspector/GtkFloatInspectorView.st packages/visualgst/Inspector/GtkInspectorBrowserWidget.st packages/visualgst/Inspector/GtkInspectorSourceWidget.st packages/visualgst/Inspector/GtkInspector.st packages/visualgst/Inspector/GtkInspectorWidget.st packages/visualgst/Inspector/GtkIntegerInspectorView.st packages/visualgst/Inspector/GtkObjectInspectorView.st packages/visualgst/Inspector/GtkSequenceableCollectionInspectorView.st packages/visualgst/Inspector/GtkSetInspectorView.st packages/visualgst/Menus/CategoryMenus.st packages/visualgst/Menus/ClassMenus.st packages/visualgst/Menus/ContextMenus.st packages/visualgst/Menus/DebuggerToolbar.st packages/visualgst/Menus/EditMenus.st packages/visualgst/Menus/HistoryMenus.st packages/visualgst/Menus/InspectorMenus.st packages/visualgst/Menus/LauncherToolbar.st packages/visualgst/Menus/MenuBuilder.st packages/visualgst/Menus/MenuSeparator.st packages/visualgst/Menus/MethodMenus.st packages/visualgst/Menus/NamespaceMenus.st packages/visualgst/Menus/SimpleWorkspaceMenus.st packages/visualgst/Menus/SmalltalkMenus.st packages/visualgst/Menus/TabsMenus.st packages/visualgst/Menus/TextMenus.st packages/visualgst/Menus/ToolbarSeparator.st packages/visualgst/Menus/ToolsMenus.st packages/visualgst/Menus/WorkspaceMenus.st packages/visualgst/Menus/WorkspaceVariableMenus.st packages/visualgst/MethodFinder.st packages/visualgst/Model/GtkColumnOOPType.st packages/visualgst/Model/GtkColumnPixbufType.st packages/visualgst/Model/GtkColumnTextType.st packages/visualgst/Model/GtkColumnType.st packages/visualgst/NamespaceFinder.st packages/visualgst/Notification/AbstractEvent.st packages/visualgst/Notification/AddedEvent.st packages/visualgst/Notification/CommentedEvent.st packages/visualgst/Notification/DoItEvent.st packages/visualgst/Notification/EventDispatcher.st packages/visualgst/Notification/EventMultiplexer.st packages/visualgst/Notification/Kernel/AbstractNamespace.st packages/visualgst/Notification/Kernel/Class.st packages/visualgst/Notification/Kernel/Metaclass.st packages/visualgst/Notification/Kernel/MethodDictionary.st packages/visualgst/Notification/ModifiedClassDefinitionEvent.st packages/visualgst/Notification/ModifiedEvent.st packages/visualgst/Notification/RecategorizedEvent.st packages/visualgst/Notification/RemovedEvent.st packages/visualgst/Notification/RenamedEvent.st packages/visualgst/Notification/ReorganizedEvent.st packages/visualgst/Notification/SystemChangeNotifier.st packages/visualgst/Notification/SystemEventManager.st packages/visualgst/Source/BrowserMethodSource.st packages/visualgst/Source/CategorySource.st packages/visualgst/Source/ClassHeaderSource.st packages/visualgst/Source/ClassSource.st packages/visualgst/Source/MethodSource.st packages/visualgst/Source/NamespaceHeaderSource.st packages/visualgst/Source/NamespaceSource.st packages/visualgst/Source/PackageSource.st packages/visualgst/Source/SourceFormatter.st packages/visualgst/State/BrowserState.st packages/visualgst/State/CategoryState.st packages/visualgst/State/ClassState.st packages/visualgst/State/MethodState.st packages/visualgst/State/NamespaceState.st packages/visualgst/StBrowser/GtkCategorizedClassWidget.st packages/visualgst/StBrowser/GtkCategorizedNamespaceWidget.st packages/visualgst/StBrowser/GtkCategoryWidget.st packages/visualgst/StBrowser/GtkClassBrowserWidget.st packages/visualgst/StBrowser/GtkClassHierarchyWidget.st packages/visualgst/StBrowser/GtkMethodWidget.st packages/visualgst/SUnit/GtkSUnitResultWidget.st packages/visualgst/SUnit/GtkSUnit.st packages/visualgst/SUnit/TestBacktraceLog.st packages/visualgst/SyntaxHighlighter.st packages/visualgst/Tests/AddClassUndoCommandTest.st packages/visualgst/Tests/AddNamespaceUndoCommandTest.st packages/visualgst/Tests/CategoryTest.st packages/visualgst/Tests/CompiledMethodTest.st packages/visualgst/Tests/EmptyTest.st packages/visualgst/Tests/ExtractLiteralsTest.st packages/visualgst/Tests/FinderTest.st packages/visualgst/Tests/GtkAssistantTest.st packages/visualgst/Tests/GtkCategorizedClassWidgetTest.st packages/visualgst/Tests/GtkCategorizedNamespaceWidgetTest.st packages/visualgst/Tests/GtkCategoryWidgetTest.st packages/visualgst/Tests/GtkConcreteWidgetTest.st packages/visualgst/Tests/GtkMethodWidgetTest.st packages/visualgst/Tests/GtkScrollTreeWidgetTest.st packages/visualgst/Tests/GtkSimpleListWidgetTest.st packages/visualgst/Tests/MenuBuilderTest.st packages/visualgst/Tests/PragmaTest.st packages/visualgst/Tests/StateTest.st packages/visualgst/Tetris/BlockWidget.st packages/visualgst/Tetris/HighScores.st packages/visualgst/Tetris/Score.st packages/visualgst/Tetris/TetrisField.st packages/visualgst/Tetris/TetrisPieceI.st packages/visualgst/Tetris/TetrisPieceJ.st packages/visualgst/Tetris/TetrisPieceL.st packages/visualgst/Tetris/TetrisPieceO.st packages/visualgst/Tetris/TetrisPieceS.st packages/visualgst/Tetris/TetrisPiece.st packages/visualgst/Tetris/TetrisPieceT.st packages/visualgst/Tetris/TetrisPieceWidget.st packages/visualgst/Tetris/TetrisPieceZ.st packages/visualgst/Tetris/Tetris.st packages/visualgst/Text/GtkFindWidget.st packages/visualgst/Text/GtkReplaceWidget.st packages/visualgst/Text/GtkSaveTextWidget.st packages/visualgst/Text/GtkSourceCodeWidget.st packages/visualgst/Text/GtkTextPluginWidget.st packages/visualgst/Text/GtkTextWidget.st packages/visualgst/Undo/Text/DeleteTextCommand.st packages/visualgst/Undo/Text/InsertTextCommand.st packages/visualgst/Undo/Text/ReplaceTextCommand.st packages/visualgst/Undo/UndoCommand.st packages/visualgst/Undo/UndoStack.st packages/visualgst/WorkspaceVariableTracker.st 
+packages/visualgst/AbstractFinder.st packages/visualgst/Category/AbstractNamespace.st packages/visualgst/Category/ClassCategory.st packages/visualgst/Category/Class.st packages/visualgst/ClassFinder.st packages/visualgst/Clock/GtkClock.st packages/visualgst/Commands/CategoryMenus/AddCategoryCommand.st packages/visualgst/Commands/CategoryMenus/CategoryCommand.st packages/visualgst/Commands/CategoryMenus/FileoutCategoryCommand.st packages/visualgst/Commands/CategoryMenus/RenameCategoryCommand.st packages/visualgst/Commands/ClassMenus/AddClassCommand.st packages/visualgst/Commands/ClassMenus/ClassCommand.st packages/visualgst/Commands/ClassMenus/DeleteClassCommand.st packages/visualgst/Commands/ClassMenus/FileoutClassCommand.st packages/visualgst/Commands/ClassMenus/InspectClassCommand.st packages/visualgst/Commands/ClassMenus/RenameClassCommand.st packages/visualgst/Commands/Command.st packages/visualgst/Commands/DebugMenus/ContinueDebugCommand.st packages/visualgst/Commands/DebugMenus/DebugCommand.st packages/visualgst/Commands/DebugMenus/StepIntoDebugCommand.st packages/visualgst/Commands/DebugMenus/StepOverDebugCommand.st packages/visualgst/Commands/EditMenus/CancelEditCommand.st packages/visualgst/Commands/EditMenus/CopyEditCommand.st packages/visualgst/Commands/EditMenus/CutEditCommand.st packages/visualgst/Commands/EditMenus/FindEditCommand.st packages/visualgst/Commands/EditMenus/PasteEditCommand.st packages/visualgst/Commands/EditMenus/RedoEditCommand.st packages/visualgst/Commands/EditMenus/ReplaceEditCommand.st packages/visualgst/Commands/EditMenus/SelectAllEditCommand.st packages/visualgst/Commands/EditMenus/UndoEditCommand.st packages/visualgst/Commands/HistoryCommands/HistoryBackCommand.st packages/visualgst/Commands/HistoryCommands/HistoryDisplayCommand.st packages/visualgst/Commands/HistoryCommands/HistoryForwardCommand.st packages/visualgst/Commands/InspectorMenus/InspectorBackCommand.st packages/visualgst/Commands/InspectorMenus/InspectorDiveCommand.st packages/visualgst/Commands/MethodMenus/DebugTestCommand.st packages/visualgst/Commands/MethodMenus/DeleteMethodCommand.st packages/visualgst/Commands/MethodMenus/FileoutMethodCommand.st packages/visualgst/Commands/MethodMenus/InspectMethodCommand.st packages/visualgst/Commands/MethodMenus/MethodCommand.st packages/visualgst/Commands/NamespaceMenus/AddNamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/DeleteNamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/FileoutNamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/InspectNamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/NamespaceCommand.st packages/visualgst/Commands/NamespaceMenus/RenameNamespaceCommand.st packages/visualgst/Commands/OpenBrowserCommand.st packages/visualgst/Commands/OpenTabbedBrowserCommand.st packages/visualgst/Commands/OpenWorkspaceCommand.st packages/visualgst/Commands/SaveImageAsCommand.st packages/visualgst/Commands/SaveImageCommand.st packages/visualgst/Commands/SmalltalkMenus/AcceptItCommand.st packages/visualgst/Commands/SmalltalkMenus/CancelCommand.st packages/visualgst/Commands/SmalltalkMenus/DebugItCommand.st packages/visualgst/Commands/SmalltalkMenus/DoItCommand.st packages/visualgst/Commands/SmalltalkMenus/InspectItCommand.st packages/visualgst/Commands/SmalltalkMenus/PrintItCommand.st packages/visualgst/Commands/System/AddClassCommand.st packages/visualgst/Commands/System/AddMethodCommand.st packages/visualgst/Commands/System/AddNamespaceCommand.st packages/visualgst/Commands/System/DeleteClassCommand.st packages/visualgst/Commands/System/DeleteMethodCommand.st packages/visualgst/Commands/System/DeleteNamespaceCommand.st packages/visualgst/Commands/System/RenameCategoryCommand.st packages/visualgst/Commands/System/RenameClassCommand.st packages/visualgst/Commands/System/RenameNamespaceCommand.st packages/visualgst/Commands/TabsMenus/CloseTabCommand.st packages/visualgst/Commands/TabsMenus/NextTabCommand.st packages/visualgst/Commands/TabsMenus/PreviousTabCommand.st packages/visualgst/Commands/ToolsMenus/OpenAssistantCommand.st packages/visualgst/Commands/ToolsMenus/OpenBottomPaneCommand.st packages/visualgst/Commands/ToolsMenus/OpenImplementorCommand.st packages/visualgst/Commands/ToolsMenus/OpenPackageBuilderCommand.st packages/visualgst/Commands/ToolsMenus/OpenSenderCommand.st packages/visualgst/Commands/ToolsMenus/OpenSUnitCommand.st packages/visualgst/Commands/ToolsMenus/OpenWebBrowserCommand.st packages/visualgst/Commands/WorkspaceMenus/DeleteItemCommand.st packages/visualgst/Commands/WorkspaceMenus/InspectItemCommand.st packages/visualgst/Commands/WorkspaceMenus/WorkspaceVariableCommand.st packages/visualgst/Debugger/Extensions.st packages/visualgst/Debugger/GtkContextWidget.st packages/visualgst/Debugger/GtkDebugger.st packages/visualgst/Debugger/GtkStackInspector.st packages/visualgst/Debugger/GtkStackInspectorView.st packages/visualgst/Extensions.st packages/visualgst/FakeNamespace.st packages/visualgst/GtkAbstractConcreteWidget.st packages/visualgst/GtkAnnouncer.st packages/visualgst/GtkAssistant.st packages/visualgst/GtkBrowsingTool.st packages/visualgst/GtkClassSelectionChanged.st packages/visualgst/GtkClassSUnitWidget.st packages/visualgst/GtkConcreteWidget.st packages/visualgst/GtkEntryDialog.st packages/visualgst/GtkEntryWidget.st packages/visualgst/Gtk/GtkEntryBuffer.st packages/visualgst/Gtk/GtkEntry.st packages/visualgst/GtkHistoryWidget.st packages/visualgst/GtkHSidebarWidget.st packages/visualgst/GtkLauncher.st packages/visualgst/GtkListModel.st packages/visualgst/GtkMainWindow.st packages/visualgst/GtkMethodSUnitWidget.st packages/visualgst/GtkNamespaceSelectionChanged.st packages/visualgst/GtkNotebookWidget.st packages/visualgst/GtkPackageBuilderWidget.st packages/visualgst/GtkScrollTreeWidget.st packages/visualgst/GtkSidebarWidget.st packages/visualgst/GtkSimpleListWidget.st packages/visualgst/GtkTranscriptWidget.st packages/visualgst/GtkTreeModel.st packages/visualgst/GtkVariableTrackerWidget.st packages/visualgst/GtkVisualGSTTool.st packages/visualgst/GtkVSidebarWidget.st packages/visualgst/GtkWebBrowser.st packages/visualgst/GtkWebView.st packages/visualgst/GtkWorkspaceWidget.st packages/visualgst/HistoryStack.st packages/visualgst/Icons/category.gif packages/visualgst/Icons/extension.png packages/visualgst/Icons/go-bottom.png packages/visualgst/Icons/go-down.png packages/visualgst/Icons/go-first.png packages/visualgst/Icons/go-home.png packages/visualgst/Icons/go-jump.png packages/visualgst/Icons/go-last.png packages/visualgst/Icons/go-next.png packages/visualgst/Icons/go-previous.png packages/visualgst/Icons/go-run.png packages/visualgst/Icons/go-top.png packages/visualgst/Icons/go-up.png packages/visualgst/Icons/namespace.gif packages/visualgst/Icons/NUnit.Failed.png packages/visualgst/Icons/NUnit.Loading.png packages/visualgst/Icons/NUnit.None.png packages/visualgst/Icons/NUnit.NotRun.png packages/visualgst/Icons/NUnit.Running.png packages/visualgst/Icons/NUnit.SuccessAndFailed.png packages/visualgst/Icons/NUnit.Success.png packages/visualgst/Icons/overridden.png packages/visualgst/Icons/override.png packages/visualgst/Icons/visualgst.png packages/visualgst/Image/GtkImageModel.st packages/visualgst/Image/GtkImageWidget.st packages/visualgst/Implementors/GtkImageResultsWidget.st packages/visualgst/Implementors/GtkImplementorResultsWidget.st packages/visualgst/Implementors/GtkSenderResultsWidget.st packages/visualgst/Inspector/Extensions.st packages/visualgst/Inspector/GtkCharacterInspectorView.st packages/visualgst/Inspector/GtkCompiledBlockInspectorView.st packages/visualgst/Inspector/GtkCompiledMethodInspectorView.st packages/visualgst/Inspector/GtkContextInspectorView.st packages/visualgst/Inspector/GtkDictionaryInspectorView.st packages/visualgst/Inspector/GtkFloatInspectorView.st packages/visualgst/Inspector/GtkInspectorBrowserWidget.st packages/visualgst/Inspector/GtkInspectorSourceWidget.st packages/visualgst/Inspector/GtkInspector.st packages/visualgst/Inspector/GtkInspectorWidget.st packages/visualgst/Inspector/GtkIntegerInspectorView.st packages/visualgst/Inspector/GtkObjectInspectorView.st packages/visualgst/Inspector/GtkSequenceableCollectionInspectorView.st packages/visualgst/Inspector/GtkSetInspectorView.st packages/visualgst/Menus/CategoryMenus.st packages/visualgst/Menus/ClassMenus.st packages/visualgst/Menus/ContextMenus.st packages/visualgst/Menus/DebuggerToolbar.st packages/visualgst/Menus/EditMenus.st packages/visualgst/Menus/HistoryMenus.st packages/visualgst/Menus/InspectorMenus.st packages/visualgst/Menus/LauncherToolbar.st packages/visualgst/Menus/MenuBuilder.st packages/visualgst/Menus/MenuSeparator.st packages/visualgst/Menus/MethodMenus.st packages/visualgst/Menus/NamespaceMenus.st packages/visualgst/Menus/SimpleWorkspaceMenus.st packages/visualgst/Menus/SmalltalkMenus.st packages/visualgst/Menus/TabsMenus.st packages/visualgst/Menus/TextMenus.st packages/visualgst/Menus/ToolbarSeparator.st packages/visualgst/Menus/ToolsMenus.st packages/visualgst/Menus/WorkspaceMenus.st packages/visualgst/Menus/WorkspaceVariableMenus.st packages/visualgst/MethodFinder.st packages/visualgst/Misc/TaskQueue.st packages/visualgst/Model/GtkColumnOOPType.st packages/visualgst/Model/GtkColumnPixbufType.st packages/visualgst/Model/GtkColumnTextType.st packages/visualgst/Model/GtkColumnType.st packages/visualgst/NamespaceFinder.st packages/visualgst/Notification/AbstractEvent.st packages/visualgst/Notification/AddedEvent.st packages/visualgst/Notification/CommentedEvent.st packages/visualgst/Notification/DoItEvent.st packages/visualgst/Notification/EventDispatcher.st packages/visualgst/Notification/EventMultiplexer.st packages/visualgst/Notification/Kernel/AbstractNamespace.st packages/visualgst/Notification/Kernel/Class.st packages/visualgst/Notification/Kernel/Metaclass.st packages/visualgst/Notification/Kernel/MethodDictionary.st packages/visualgst/Notification/ModifiedClassDefinitionEvent.st packages/visualgst/Notification/ModifiedEvent.st packages/visualgst/Notification/RecategorizedEvent.st packages/visualgst/Notification/RemovedEvent.st packages/visualgst/Notification/RenamedEvent.st packages/visualgst/Notification/ReorganizedEvent.st packages/visualgst/Notification/SystemChangeNotifier.st packages/visualgst/Notification/SystemEventManager.st packages/visualgst/Source/BrowserMethodSource.st packages/visualgst/Source/CategorySource.st packages/visualgst/Source/ClassHeaderSource.st packages/visualgst/Source/ClassSource.st packages/visualgst/Source/MethodSource.st packages/visualgst/Source/NamespaceHeaderSource.st packages/visualgst/Source/NamespaceSource.st packages/visualgst/Source/PackageSource.st packages/visualgst/Source/SourceFormatter.st packages/visualgst/State/BrowserState.st packages/visualgst/State/CategoryState.st packages/visualgst/State/ClassState.st packages/visualgst/State/MethodState.st packages/visualgst/State/NamespaceState.st packages/visualgst/StBrowser/GtkCategorizedClassWidget.st packages/visualgst/StBrowser/GtkCategorizedNamespaceWidget.st packages/visualgst/StBrowser/GtkCategoryWidget.st packages/visualgst/StBrowser/GtkClassBrowserWidget.st packages/visualgst/StBrowser/GtkClassHierarchyWidget.st packages/visualgst/StBrowser/GtkMethodWidget.st packages/visualgst/SUnit/GtkSUnitResultWidget.st packages/visualgst/SUnit/GtkSUnit.st packages/visualgst/SUnit/TestBacktraceLog.st packages/visualgst/SyntaxHighlighter.st packages/visualgst/Tests/AddClassUndoCommandTest.st packages/visualgst/Tests/AddNamespaceUndoCommandTest.st packages/visualgst/Tests/CategoryTest.st packages/visualgst/Tests/CompiledMethodTest.st packages/visualgst/Tests/EmptyTest.st packages/visualgst/Tests/ExtractLiteralsTest.st packages/visualgst/Tests/FinderTest.st packages/visualgst/Tests/GtkAssistantTest.st packages/visualgst/Tests/GtkCategorizedClassWidgetTest.st packages/visualgst/Tests/GtkCategorizedNamespaceWidgetTest.st packages/visualgst/Tests/GtkCategoryWidgetTest.st packages/visualgst/Tests/GtkConcreteWidgetTest.st packages/visualgst/Tests/GtkMethodWidgetTest.st packages/visualgst/Tests/GtkScrollTreeWidgetTest.st packages/visualgst/Tests/GtkSimpleListWidgetTest.st packages/visualgst/Tests/MenuBuilderTest.st packages/visualgst/Tests/PragmaTest.st packages/visualgst/Tests/StateTest.st packages/visualgst/Tetris/BlockWidget.st packages/visualgst/Tetris/HighScores.st packages/visualgst/Tetris/Score.st packages/visualgst/Tetris/TetrisField.st packages/visualgst/Tetris/TetrisPieceI.st packages/visualgst/Tetris/TetrisPieceJ.st packages/visualgst/Tetris/TetrisPieceL.st packages/visualgst/Tetris/TetrisPieceO.st packages/visualgst/Tetris/TetrisPieceS.st packages/visualgst/Tetris/TetrisPiece.st packages/visualgst/Tetris/TetrisPieceT.st packages/visualgst/Tetris/TetrisPieceWidget.st packages/visualgst/Tetris/TetrisPieceZ.st packages/visualgst/Tetris/Tetris.st packages/visualgst/Text/GtkFindWidget.st packages/visualgst/Text/GtkReplaceWidget.st packages/visualgst/Text/GtkSaveTextWidget.st packages/visualgst/Text/GtkSourceCodeWidget.st packages/visualgst/Text/GtkTextPluginWidget.st packages/visualgst/Text/GtkTextWidget.st packages/visualgst/Undo/Text/DeleteTextCommand.st packages/visualgst/Undo/Text/InsertTextCommand.st packages/visualgst/Undo/Text/ReplaceTextCommand.st packages/visualgst/Undo/UndoCommand.st packages/visualgst/Undo/UndoStack.st packages/visualgst/WorkspaceVariableTracker.st 
 $(VisualGST_FILES):
 $(srcdir)/packages/visualgst/stamp-classes: $(VisualGST_FILES)
 	touch $(srcdir)/packages/visualgst/stamp-classes
diff --git a/packages/visualgst/Misc/TaskQueue.st b/packages/visualgst/Misc/TaskQueue.st
new file mode 100644
index 0000000..5922309
--- /dev/null
+++ b/packages/visualgst/Misc/TaskQueue.st
@@ -0,0 +1,81 @@
+"======================================================================
+| 
+| TaskQueue class definition
+| 
+======================================================================"
+  
+"======================================================================
+| 
+| Copyright (c) 2013
+| Gwenael Casaccio <gwenael.casaccio@gmail.com>,
+| 
+| 
+| This file is part of VisualGST.
+| 
+| Permission is hereby granted, free of charge, to any person obtaining
+| a copy of this software and associated documentation files (the
+| 'Software'), to deal in the Software without restriction, including
+| without limitation the rights to use, copy, modify, merge, publish,
+| distribute, sublicense, and/or sell copies of the Software, and to
+| permit persons to whom the Software is furnished to do so, subject to
+| the following conditions:
+| 
+| The above copyright notice and this permission notice shall be
+| included in all copies or substantial portions of the Software.
+| 
+| THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+| 
+======================================================================"
+
+Object subclass: TaskQueue [
+
+    TaskQueue class [ | uniqueInstance | ]
+
+    | queue queueHandler currentProcess |
+
+    TaskQueue class >> new [
+        <category: 'instance creation'>
+
+        ^ super new
+            initialize;
+            yourself
+    ]
+
+    TaskQueue class >> uniqueInstance [
+        <category: 'accessing'>
+
+        ^ uniqueInstance ifNil: [ uniqueInstance := self new ]
+    ]
+
+    initialize [
+        <category: 'initialization'>
+
+        queue := SharedQueue new
+    ]
+
+    add: aBlock [
+        <category: 'accessing'>
+
+        queue nextPut: aBlock
+    ]
+
+    run [
+        <category: 'accessing'>
+
+        queueHandler := [ | task sem |
+          sem := Semaphore new.
+          [ task := queue next.
+            currentProcess := [ [ task value.
+                                  sem signal ] on: Exception do: [ :ex | [ sem signal ] fork.
+                                                                         ex pass ] ] fork.
+            sem wait.
+            currentProcess := nil ] repeat ] fork
+    ]
+]
+
diff --git a/packages/visualgst/Text/GtkTextWidget.st b/packages/visualgst/Text/GtkTextWidget.st
index 0036562..0008237 100644
--- a/packages/visualgst/Text/GtkTextWidget.st
+++ b/packages/visualgst/Text/GtkTextWidget.st
@@ -381,17 +381,23 @@ GtkConcreteWidget subclass: GtkTextWidget [
         <category: 'smalltalk event'>
     ]
 
-    doIt: object [
+    doWithoutForkIt: object [
         <category: 'smalltalk event'>
 
-	| result |
+        | result |
         self beforeEvaluation.
         result := Behavior
-		    evaluate: self buffer selectedText
-		    to: object
-		    ifError: [ :fname :lineNo :errorString | self error: errorString ].
-	self afterEvaluation.
-	^ result
+                    evaluate: self buffer selectedText
+                    to: object
+                    ifError: [ :fname :lineNo :errorString | self error: errorString ].
+        self afterEvaluation.
+        ^ result
+    ]
+
+    doIt: object [
+        <category: 'smalltalk event'>
+
+	TaskQueue uniqueInstance add: [ self doWithoutForkIt: object ]
     ]
 
     debugIt: object [
@@ -409,19 +415,20 @@ GtkConcreteWidget subclass: GtkTextWidget [
     inspectIt: object [
         <category: 'smalltalk event'>
 
-        GtkInspector openOn: (self doIt: object)
+        TaskQueue uniqueInstance add: [ GtkInspector openOn: (self doWithoutForkIt: object) ]
     ]
 
     printIt: object [
         <category: 'smalltalk event'>
 
-        | iter start end result |
-        iter := self buffer iterOfSelectedText second.
-        result := ' ', ((self doIt: object) displayString), ' '.
-        self buffer insertInteractive: iter text: result len: result size defaultEditable: true.
-        start := self buffer getIterAtOffset: (iter getOffset - result size).
-        end := self buffer getIterAtOffset: (iter getOffset).
-        self buffer selectRange: start bound: end
+        TaskQueue uniqueInstance add:
+            [ | iter start end result |
+              iter := self buffer iterOfSelectedText second.
+              result := ' ', ((self doWithoutForkIt: object) displayString), ' '.
+              self buffer insertInteractive: iter text: result len: result size defaultEditable: true.
+              start := self buffer getIterAtOffset: (iter getOffset - result size).
+              end := self buffer getIterAtOffset: (iter getOffset).
+              self buffer selectRange: start bound: end ]
     ]
-
 ]
+
diff --git a/packages/visualgst/package.xml b/packages/visualgst/package.xml
index d21c5e3..52e7a31 100644
--- a/packages/visualgst/package.xml
+++ b/packages/visualgst/package.xml
@@ -71,6 +71,7 @@
   <filein>Gtk/GtkEntry.st</filein>
   <filein>Gtk/GtkEntryBuffer.st</filein>
   <filein>Extensions.st</filein>
+  <filein>Misc/TaskQueue.st</filein>
   <filein>Notification/AbstractEvent.st</filein>
   <filein>Notification/AddedEvent.st</filein>
   <filein>Notification/CommentedEvent.st</filein>
@@ -556,5 +557,6 @@
   <file>Icons/override.png</file>
   <file>Icons/visualgst.png</file>
   <start>VisualGST.GtkLauncher open.
-    GTK.Gtk main</start>
+         VisualGST.TaskQueue uniqueInstance run.
+         GTK.Gtk main.</start>
 </package>
-- 
1.8.3.2

