Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 46e67e1

Browse files
BerndNlivecodeali
authored andcommitted
[21834] - Project browser fix display errors for missing behaviors, add alert (#2035)
unresolvable behaviors are now flagged with red, tooltip indicates "missing" clicking on graphic triggers alert
1 parent a3aed54 commit 46e67e1

File tree

4 files changed

+196
-34
lines changed

4 files changed

+196
-34
lines changed

Toolset/palettes/project browser/behaviors/revideprojectbrowsercontainerrowbehavior.livecodescript

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on FillInData pDataA, pRow
2222
end if
2323

2424
-- Behaviors
25-
if pDataA["behavior scriptlines"] is empty then
25+
if pDataA["behavior"] is empty then
2626
repeat with i = 1 to 10
2727
hide grc ("behaviorScriptLines" & i) of me
2828
end repeat
@@ -31,18 +31,41 @@ on FillInData pDataA, pRow
3131
# check parent behaviors
3232
local tTargetBehavior
3333
local tBehaviorList
34+
local tMissingBehaviorList
35+
local tSkipRepeat
3436

3537
put pDataA["behavior"] into tTargetBehavior
36-
put tTargetBehavior & cr into tBehaviorList
37-
repeat
38-
put the behavior of tTargetBehavior into tTargetBehavior
39-
if tTargetBehavior <> "" then
40-
put tTargetBehavior & cr after tBehaviorList
41-
else
42-
exit repeat
38+
39+
if tTargetBehavior <> empty then
40+
if exists(tTargetBehavior) then
41+
put tTargetBehavior & cr into tBehaviorList
42+
put false into tSkipRepeat
43+
else --##
44+
put tTargetBehavior & cr into tBehaviorList
45+
put tTargetBehavior & cr after tMissingBehaviorList
46+
put true into tSkipRepeat
4347
end if
44-
end repeat
45-
delete char - 1 of tBehaviorList -- return
48+
end if
49+
50+
if not tSkipRepeat then
51+
repeat
52+
put the behavior of tTargetBehavior into tTargetBehavior
53+
54+
if tTargetBehavior = empty then
55+
exit repeat
56+
end if
57+
58+
if not (exists(tTargetBehavior)) then --##
59+
put tTargetBehavior & cr after tBehaviorList
60+
put tTargetBehavior & cr after tMissingBehaviorList
61+
exit repeat
62+
else
63+
put tTargetBehavior & cr after tBehaviorList
64+
end if
65+
end repeat
66+
end if
67+
delete char -1 of tBehaviorList -- return
68+
delete char -1 of tMissingBehaviorList -- return
4669

4770
local tNoOfLInes
4871
local tCounter
@@ -51,6 +74,9 @@ on FillInData pDataA, pRow
5174
put min(the number of lines of tBehaviorList, 10) into tNoOfLines
5275
repeat with i = 1 to tNoOfLines
5376
set the toolTip of grc ("behaviorScriptLines" & i) of me to line i of tBehaviorList
77+
if line i of tBehaviorList is among the lines of tMissingBehaviorList then
78+
set the toolTip of grc ("behaviorScriptLines" & i) of me to ("Missing: " & line i of tBehaviorList)
79+
end if
5480
show grc ("behaviorScriptLines" & i) of me
5581
put ("cBehaviorLongID" & i) into tCPName
5682
set the tCPName of me to line i of tBehaviorList
@@ -234,6 +260,7 @@ end dvRowControl
234260

235261
setProp dvHilite[pHiliteColor] pBoolean
236262
# Override basic hilite feature...
263+
local tCPName
237264

238265
if pBoolean then
239266
set the foregroundColor of field "type" of me to revIDEColor("dataView_TextHiliteColor")
@@ -242,7 +269,12 @@ setProp dvHilite[pHiliteColor] pBoolean
242269
set the backgroundColor of field "scriptLines" of me to revIDEColor("dataView_TextHiliteColor")
243270
repeat with i = 1 to 10
244271
set the foregroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("text_1")
245-
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_TextHiliteColor")
272+
put ("cBehaviorLongID" & i) into tCPName
273+
if exists(the tCPName of me) then
274+
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_TextHiliteColor")
275+
else
276+
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_scriptErrorBackgroundColor")
277+
end if
246278
end repeat
247279
set the colorOverlay["color"] of button "typeIcon" of me to revIDEColor("dataView_TextHiliteColor")
248280
set the foregroundColor of me to revIDEColor("dataView_disclosureIconHiliteColor")
@@ -262,11 +294,12 @@ setProp dvHilite[pHiliteColor] pBoolean
262294
set the backgroundColor of field "scriptLines" of me to revIDEColor("dataView_hiliteColor")
263295
end if
264296

265-
local tCPName
266297
repeat with i = 1 to 10
267298
put ("cBehaviorLongID" & i) into tCPName
268299
if exists(the tCPName of me) and the scriptStatus of the tCPName of me is "error" then
269300
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_scriptErrorBackgroundColor")
301+
else if not (exists(the tCPName of me)) then
302+
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_scriptErrorBackgroundColor")
270303
else
271304
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_hiliteColor")
272305
end if
@@ -284,33 +317,43 @@ on mouseUp
284317
edit the script of the cObjectLongID of me
285318
break
286319
case "behaviorScriptLines1"
320+
checkExistence (the cBehaviorLongID1 of me), 1
287321
edit the script of the cBehaviorLongID1 of me
288322
break
289323
case "behaviorScriptLines2"
324+
checkExistence (the cBehaviorLongID2 of me), 2
290325
edit the script of the cBehaviorLongID2 of me
291326
break
292327
case "behaviorScriptLines3"
328+
checkExistence (the cBehaviorLongID3 of me), 3
293329
edit the script of the cBehaviorLongID3 of me
294330
break
295331
case "behaviorScriptLines4"
332+
checkExistence (the cBehaviorLongID4 of me), 4
296333
edit the script of the cBehaviorLongID4 of me
297334
break
298335
case "behaviorScriptLines5"
336+
checkExistence (the cBehaviorLongID5 of me), 5
299337
edit the script of the cBehaviorLongID5 of me
300338
break
301339
case "behaviorScriptLines6"
340+
checkExistence (the cBehaviorLongID6 of me), 6
302341
edit the script of the cBehaviorLongID6 of me
303342
break
304343
case "behaviorScriptLines7"
344+
checkExistence (the cBehaviorLongID7 of me), 7
305345
edit the script of the cBehaviorLongID7 of me
306346
break
307347
case "behaviorScriptLines8"
348+
checkExistence (the cBehaviorLongID8 of me), 8
308349
edit the script of the cBehaviorLongID8 of me
309350
break
310351
case "behaviorScriptLines9"
352+
checkExistence (the cBehaviorLongID9 of me), 9
311353
edit the script of the cBehaviorLongID9 of me
312354
break
313355
case "behaviorScriptLines10"
356+
checkExistence (the cBehaviorLongID10 of me), 10
314357
edit the script of the cBehaviorLongID10 of me
315358
break
316359
case "icon"
@@ -332,6 +375,17 @@ on mouseDoubleUp
332375
goToObject the cObjectLongID of me
333376
end mouseDoubleUp
334377

378+
command checkExistence pLongID, pOrdinal
379+
local tGraphic
380+
if exists(pLongID) then
381+
return empty
382+
else
383+
put ("behaviorScriptLines" & pOrdinal) into tGraphic
384+
answer the toolTip of grc tGraphic of me
385+
exit to top
386+
end if
387+
end checkExistence
388+
335389
on CloseFieldEditor pFieldEditor, pRow, pKey, pClosingTriggeredBy
336390
# The text the user entered is different than the current value of the target field.
337391
if word 1 of the cObjectLongID of me is "stack" and \

Toolset/palettes/project browser/behaviors/revideprojectbrowsercontrolrowbehavior.livecodescript

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on FillInData pDataA, pRow
2929
end if
3030

3131
-- Behaviors
32-
if pDataA["behavior scriptlines"] is empty then
32+
if pDataA["behavior"] is empty then
3333
repeat with i = 1 to 10
3434
hide grc ("behaviorScriptLines" & i) of me
3535
end repeat
@@ -38,18 +38,38 @@ on FillInData pDataA, pRow
3838
# check parent behaviors
3939
local tTargetBehavior
4040
local tBehaviorList
41+
local tMissingBehaviorList
42+
local tSkipRepeat
4143

4244
put pDataA["behavior"] into tTargetBehavior
43-
put tTargetBehavior & cr into tBehaviorList
44-
repeat
45-
put the behavior of tTargetBehavior into tTargetBehavior
46-
if tTargetBehavior <> "" then
47-
put tTargetBehavior & cr after tBehaviorList
45+
46+
if tTargetBehavior <> empty then
47+
if exists(tTargetBehavior) then
48+
put tTargetBehavior & cr into tBehaviorList
49+
put false into tSkipRepeat
4850
else
49-
exit repeat
51+
put tTargetBehavior & cr into tBehaviorList
52+
put tTargetBehavior & cr after tMissingBehaviorList
53+
put true into tSkipRepeat
5054
end if
51-
end repeat
55+
end if
56+
57+
if not tSkipRepeat then
58+
repeat
59+
put the behavior of tTargetBehavior into tTargetBehavior
60+
if tTargetBehavior = empty then exit repeat
61+
62+
if not (exists(tTargetBehavior)) then
63+
put tTargetBehavior & cr after tBehaviorList
64+
put tTargetBehavior & cr after tMissingBehaviorList
65+
exit repeat
66+
else
67+
put tTargetBehavior & cr after tBehaviorList
68+
end if
69+
end repeat
70+
end if
5271
delete char - 1 of tBehaviorList -- return
72+
delete char -1 of tMissingBehaviorList -- return
5373

5474
local tNoOfLInes
5575
local tCounter
@@ -58,6 +78,9 @@ on FillInData pDataA, pRow
5878
put min(the number of lines of tBehaviorList, 10) into tNoOfLines
5979
repeat with i = 1 to tNoOfLines
6080
set the toolTip of grc ("behaviorScriptLines" & i) of me to line i of tBehaviorList
81+
if line i of tBehaviorList is among the lines of tMissingBehaviorList then
82+
set the toolTip of grc ("behaviorScriptLines" & i) of me to ("Missing: " & line i of tBehaviorList)
83+
end if
6184
show grc ("behaviorScriptLines" & i) of me
6285
put ("cBehaviorLongID" & i) into tCPName
6386
set the tCPName of me to line i of tBehaviorList
@@ -196,14 +219,20 @@ getProp dvRowControl
196219
end dvRowControl
197220

198221
setProp dvHilite[pHiliteColor] pBoolean
222+
local tCPName
199223
if pBoolean then
200224
set the foregroundColor of field "type" of me to revIDEColor("dataView_TextHiliteColor")
201225
set the foregroundColor of field "name" of me to revIDEColor("dataView_TextHiliteColor")
202226
set the foregroundColor of field "scriptLines" of me to revIDEColor("text_1")
203227
set the backgroundColor of field "scriptLines" of me to revIDEColor("dataView_TextHiliteColor")
204228
repeat with i = 1 to 10
205229
set the foregroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("text_1")
206-
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_TextHiliteColor")
230+
put ("cBehaviorLongID" & i) into tCPName
231+
if exists(the tCPName of me) then
232+
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_TextHiliteColor")
233+
else
234+
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_scriptErrorBackgroundColor")
235+
end if
207236
end repeat
208237
set the colorOverlay["color"] of button "controlIcon" of me to revIDEColor("dataView_TextHiliteColor")
209238
set the foregroundColor of me to revIDEColor("dataView_disclosureIconHiliteColor")
@@ -222,11 +251,14 @@ setProp dvHilite[pHiliteColor] pBoolean
222251
set the backgroundColor of field "scriptLines" of me to revIDEColor("dataView_hiliteColor")
223252
end if
224253

225-
local tCPName
226254
repeat with i = 1 to 10
227255
put ("cBehaviorLongID" & i) into tCPName
228256
if exists(the tCPName of me) and the scriptStatus of the tCPName of me is "error" then
229257
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_scriptErrorBackgroundColor")
258+
else if not (exists(the tCPName of me)) then --##
259+
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_scriptErrorBackgroundColor")
260+
else if not (exists(the tCPName of me)) then
261+
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_scriptErrorBackgroundColor")
230262
else
231263
set the backgroundColor of grc ("behaviorScriptLines" & i) of me to revIDEColor("dataView_hiliteColor")
232264
end if
@@ -243,33 +275,43 @@ on mouseUp
243275
edit the script of the cObjectLongID of me
244276
break
245277
case "behaviorScriptLines1"
278+
checkExistence (the cBehaviorLongID1 of me), 1
246279
edit the script of the cBehaviorLongID1 of me
247280
break
248281
case "behaviorScriptLines2"
282+
checkExistence (the cBehaviorLongID2 of me), 2
249283
edit the script of the cBehaviorLongID2 of me
250284
break
251285
case "behaviorScriptLines3"
286+
checkExistence (the cBehaviorLongID3 of me), 3
252287
edit the script of the cBehaviorLongID3 of me
253288
break
254289
case "behaviorScriptLines4"
290+
checkExistence (the cBehaviorLongID4 of me), 4
255291
edit the script of the cBehaviorLongID4 of me
256292
break
257293
case "behaviorScriptLines5"
294+
checkExistence (the cBehaviorLongID5 of me), 5
258295
edit the script of the cBehaviorLongID5 of me
259296
break
260297
case "behaviorScriptLines6"
298+
checkExistence (the cBehaviorLongID6 of me), 6
261299
edit the script of the cBehaviorLongID6 of me
262300
break
263301
case "behaviorScriptLines7"
302+
checkExistence (the cBehaviorLongID7 of me), 7
264303
edit the script of the cBehaviorLongID7 of me
265304
break
266305
case "behaviorScriptLines8"
306+
checkExistence (the cBehaviorLongID8 of me), 8
267307
edit the script of the cBehaviorLongID8 of me
268308
break
269309
case "behaviorScriptLines9"
310+
checkExistence (the cBehaviorLongID9 of me), 9
270311
edit the script of the cBehaviorLongID9 of me
271312
break
272313
case "behaviorScriptLines10"
314+
checkExistence (the cBehaviorLongID10 of me), 10
273315
edit the script of the cBehaviorLongID10 of me
274316
break
275317
case "icon"
@@ -285,6 +327,17 @@ on mouseUp
285327
end switch
286328
end mouseUp
287329

330+
command checkExistence pLongID, pOrdinal
331+
local tGraphic
332+
if exists(pLongID) then
333+
return empty
334+
else
335+
put ("behaviorScriptLines" & pOrdinal) into tGraphic
336+
answer the toolTip of grc tGraphic of me
337+
exit to top
338+
end if
339+
end checkExistence
340+
288341
on mouseDown pButton
289342
if pButton is 3 then
290343
dispatch "pbRightClick" to stack "revIDEProjectBrowser" with the cObjectLongID of me

0 commit comments

Comments
 (0)