]> gitweb.factorcode.org Git - factor.git/commitdiff
Working on error list change notification
authorSlava Pestov <slava@shill.local>
Mon, 13 Apr 2009 04:01:08 +0000 (23:01 -0500)
committerSlava Pestov <slava@shill.local>
Mon, 13 Apr 2009 04:01:08 +0000 (23:01 -0500)
basis/ui/tools/error-list/error-list-docs.factor
basis/ui/tools/error-list/error-list.factor
core/source-files/errors/errors.factor

index e4d15a0ea9a88a5374aba225780e263b3c11edf6..514812ed48eed33c74f9ec4620d9bbcd32ccceda 100644 (file)
@@ -1,8 +1,8 @@
 IN: ui.tools.error-list
-USING: help.markup help.syntax ;
+USING: help.markup help.syntax ui.tools.common ui.commands ;
 
 ARTICLE: "ui.tools.error-list" "UI error list tool"
-"The error list tool displays messages generated by tools which process source files and definitions."
+"The error list tool displays messages generated by tools which process source files and definitions. To display the error list, press " { $command tool "common" show-error-list } " in any UI tool window."
 $nl
 "The " { $vocab-link "source-files.errors" } " vocabulary contains backend code used by this tool."
 { $heading "Message icons" }
index 019538d31c1f767fb96311f3c9be6c240963d9ec..ceb5ff092129a7c9f1944084c826f097a7b2bdb5 100644 (file)
@@ -4,14 +4,14 @@ USING: accessors arrays sequences sorting assocs colors.constants fry
 combinators combinators.smart combinators.short-circuit editors make
 memoize compiler.units fonts kernel io.pathnames prettyprint
 source-files.errors math.parser init math.order models models.arrow
-models.arrow.smart models.search models.mapping debugger namespaces
+models.arrow.smart models.search models.mapping models.delay debugger namespaces
 summary locals ui ui.commands ui.gadgets ui.gadgets.panes
 ui.gadgets.tables ui.gadgets.labeled ui.gadgets.tracks ui.gestures
 ui.operations ui.tools.browser ui.tools.common ui.gadgets.scrollers
 ui.tools.inspector ui.gadgets.status-bar ui.operations
 ui.gadgets.buttons ui.gadgets.borders ui.gadgets.packs
 ui.gadgets.labels ui.baseline-alignment ui.images
-compiler.errors ;
+compiler.errors calendar ;
 IN: ui.tools.error-list
 
 CONSTANT: source-file-icon
@@ -173,26 +173,23 @@ error-list-gadget "toolbar" f {
     { T{ key-down f f "F1" } error-list-help }
 } define-command-map
 
-SYMBOL: compiler-error-model
+SYMBOL: error-list-model
 
-compiler-error-model [ f <model> ] initialize
+error-list-model [ f <model> ] initialize
 
 SINGLETON: updater
 
-M: updater definitions-changed
-    2drop
-    all-errors
-    compiler-error-model get-global
-    set-model ;
+M: updater errors-changed
+    drop f error-list-model get-global set-model ;
 
-[
-    updater remove-definition-observer
-    updater add-definition-observer
-] "ui.tools.error-list" add-init-hook
+[ updater add-error-observer ] "ui.tools.error-list" add-init-hook
+
+: <error-list-model> ( -- model )
+    error-list-model get-global
+    1/2 seconds <delay> [ drop all-errors ] <arrow> ;
 
 : error-list-window ( -- )
-    compiler-error-model get-global <error-list-gadget>
-    "Errors" open-status-window ;
+    <error-list-model> <error-list-gadget> "Errors" open-status-window ;
 
 : show-error-list ( -- )
     [ error-list-gadget? ] find-window
index 385ca7a496938825c65d83084c5b59e518e2708f..880472bc0a4173748ad74ccbb0e7eeb5b63417bb 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs kernel math.order sorting sequences definitions
-namespaces arrays splitting io math.parser math ;
+namespaces arrays splitting io math.parser math init ;
 IN: source-files.errors
 
 TUPLE: source-file-error error asset file line# ;
@@ -55,4 +55,16 @@ error-types [ V{ } clone ] initialize
 : all-errors ( -- errors )
     error-types get values
     [ quot>> call( -- seq ) ] map
-    concat ;
\ No newline at end of file
+    concat ;
+
+GENERIC: errors-changed ( observer -- )
+
+SYMBOL: error-observers
+
+[ V{ } clone error-observers set-global ] "source-files.errors" add-init-hook
+
+: add-error-observer ( observer -- ) error-observers get push ;
+
+: remove-error-observer ( observer -- ) error-observers get delq ;
+
+: notify-error-observers ( -- ) error-observers get [ errors-changed ] each ;
\ No newline at end of file