Working on error list change notification
parent
7a33780bc2
commit
cdd372314b
|
@ -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" }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ;
|
||||
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 ;
|
Loading…
Reference in New Issue