-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBMLinearReporterViewController.m
More file actions
executable file
·1143 lines (799 loc) · 26 KB
/
BMLinearReporterViewController.m
File metadata and controls
executable file
·1143 lines (799 loc) · 26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright (c) 2004-2010, Stephane Sudre
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the WhiteBox nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "BMLinearReporterViewController.h"
#import "BMLinearReportCell.h"
#define SAFE_LINEAR_TREE_NODE(n) ((BMLinearTreeNode*)((n!=nil)?(n):(displayTree_)))
@implementation BMLinearReporterViewController
- (void) awakeFromNib
{
NSTableColumn * tTableColumn;
cachedScopeButtons_=[[NSArray alloc] initWithObjects:IBallScope_,IBerrorsScope_,IBwarningsScope_,IBnotesScope_,nil];
scopeSetAll_=[NSMutableIndexSet new];
[scopeSetAll_ addIndex:BM_PROBLEM_LEVEL_NOTE];
[scopeSetAll_ addIndex:BM_PROBLEM_LEVEL_WARNING];
[scopeSetAll_ addIndex:BM_PROBLEM_LEVEL_ERROR];
scopeSet_=[[NSMutableIndexSet alloc] initWithIndexSet:scopeSetAll_];
[IBallScope_ setState:NSOnState];
[IBerrorsScope_ setState:NSOffState];
[IBwarningsScope_ setState:NSOffState];
[IBnotesScope_ setState:NSOffState];
tTableColumn=[IBoutlineView_ tableColumnWithIdentifier:@"Report"];
if (tTableColumn!=nil)
{
BMLinearReportCell * tProtoypeCell;
tProtoypeCell=[[BMLinearReportCell alloc] initTextCell:@""];
if (tProtoypeCell!=nil)
{
[tTableColumn setDataCell:tProtoypeCell];
[tProtoypeCell release];
}
}
[IBoutlineView_ setDoubleAction:@selector(revealSelectedIssues:)];
[IBoutlineView_ setTarget:self];
[IBoutlineView_ setAutoresizesOutlineColumn:NO];
// A COMPLETER
// Register for notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(outlineViewFrameDidChange:) name:NSViewFrameDidChangeNotification object:[self view]];
}
- (id) initWithReportingDictionary:(NSDictionary *) inDictionary
{
self=[super initWithReportingDictionary:inDictionary];
if (self!=nil)
{
[self removeControllerDefaultForKey:[self disclosedStateKey]];
[iconsCache_ release];
iconsCache_=[[NSMutableDictionary alloc] initWithCapacity:10];
if ([NSBundle loadNibNamed:@"BMBundleLinearReporterView" owner:self]==YES)
{
}
}
return self;
}
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[itemsToExpand_ release];
[iconsCache_ release];
[storageTree_ release];
[storageTreeHash_ release];
[displayTree_ release];
[displayTreeHash_ release];
[scopeSetAll_ retain];
[scopeSet_ release];
[cachedScopeButtons_ release];
// A COMPLETER
[IBcheckingView_ release];
[IBnoGlitchesView_ release];
[super dealloc];
}
#pragma mark -
- (NSString *) disclosedStateKey
{
return @"LinearReport";
}
- (void) prepareData
{
storageTree_=[BMLinearTreeNode buildTree];
if (storageTree_!=nil)
{
storageTreeHash_=[[NSMutableDictionary alloc] initWithCapacity:100];
if (storageTreeHash_==nil)
{
storageTree_=nil;
}
else
{
NSEnumerator * tKeyEnumerator;
tKeyEnumerator=[reportDictionary_ keyEnumerator];
if (tKeyEnumerator!=nil)
{
NSString * tFilePath;
while (tFilePath=[tKeyEnumerator nextObject])
{
BMLinearNodeData * tFileLinearData;
tFileLinearData=[BMLinearNodeData nodeOfType:BM_LINEAR_TREE_TYPE_FILE withReport:nil ofLevel:BM_PROBLEM_LEVEL_NOTE];
if (tFileLinearData!=nil)
{
BMLinearTreeNode * tFileTreeNode;
[tFileLinearData setFilePath:tFilePath];
tFileTreeNode=[[BMLinearTreeNode alloc] initWithData:tFileLinearData
parent:nil
children:[NSArray array]];
if (tFileTreeNode!=nil)
{
NSDictionary * tLevelsDictionary;
[storageTree_ insertSortedChildReverse:tFileTreeNode];
[storageTreeHash_ setObject:tFileTreeNode forKey:tFilePath];
tLevelsDictionary=[reportDictionary_ objectForKey:tFilePath];
if (tLevelsDictionary!=nil)
{
NSEnumerator * tLevelKeyEnumerator;
tLevelKeyEnumerator=[tLevelsDictionary keyEnumerator];
if (tLevelKeyEnumerator!=nil)
{
NSNumber * tLevelNumber;
while (tLevelNumber=[tLevelKeyEnumerator nextObject])
{
NSArray * tReportArray;
NSUInteger i,tCount;
NSInteger tLevelValue;
tLevelValue=[tLevelNumber longValue];
tReportArray=[tLevelsDictionary objectForKey:tLevelNumber];
tCount=[tReportArray count];
for(i=0;i<tCount;i++)
{
NSDictionary * tReportDictionary;
BMLinearNodeData * tReportLinearData;
tReportDictionary=[tReportArray objectAtIndex:i];
tReportLinearData=[BMLinearNodeData nodeOfType:BM_LINEAR_TREE_REPORT withReport:tReportDictionary ofLevel:tLevelValue];
if (tReportLinearData!=nil)
{
BMLinearTreeNode * tReportTreeNode;
tReportTreeNode=[[BMLinearTreeNode alloc] initWithData:tReportLinearData
parent:nil
children:[NSArray array]];
if (tReportTreeNode!=nil)
{
[tFileTreeNode insertChild: tReportTreeNode
atIndex: [tFileTreeNode numberOfChildren]];
[tReportTreeNode release];
}
}
}
}
}
else
{
// Low Memory
// A COMPLETER
}
}
[tFileTreeNode release];
}
}
}
}
[storageTree_ retain];
displayTreeHash_=[[NSMutableDictionary alloc] initWithCapacity:100];
if (displayTreeHash_!=nil)
{
displayTree_=[[BMLinearTreeNode duplicateTree:storageTree_ limitedToScopes:scopeSet_ searchPattern:nil hash:displayTreeHash_] retain];
}
}
}
else
{
storageTree_=nil;
}
}
- (void) delayedRefresh:(id) inObject
{
NSUInteger tCount;
[IBoutlineView_ reloadData];
tCount=[itemsToExpand_ count];
if (tCount>0)
{
for(id tItem in itemsToExpand_)
{
[IBoutlineView_ expandItem:tItem];
}
[itemsToExpand_ removeAllObjects];
}
[itemsToExpand_ release];
itemsToExpand_=nil;
}
#pragma mark -
- (id) outlineView:(NSOutlineView *) inOutlineView child:(NSInteger) inIndex ofItem:(id) inItem
{
if (inOutlineView==IBoutlineView_)
{
if (displayTree_!=nil)
{
return [SAFE_LINEAR_TREE_NODE(inItem) childAtIndex:inIndex];
}
}
return nil;
}
- (BOOL) outlineView:(NSOutlineView *) inOutlineView isItemExpandable:(id) inItem
{
if (inOutlineView==IBoutlineView_)
{
BMLinearNodeData * tNodeData;
tNodeData=BM_LINEAR_NODE_DATA(inItem);
return ([tNodeData isLeaf]==NO);
}
return NO;
}
- (NSInteger) outlineView:(NSOutlineView *) inOutlineView numberOfChildrenOfItem:(id) inItem
{
if (inOutlineView==IBoutlineView_)
{
if (displayTree_!=nil)
{
return [SAFE_LINEAR_TREE_NODE(inItem) numberOfChildren];
}
}
return 0;
}
- (id) outlineView:(NSOutlineView *) inOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id) inItem
{
if (inOutlineView==IBoutlineView_)
{
BMLinearNodeData * tNodeData;
tNodeData=BM_LINEAR_NODE_DATA(inItem);
if ([tNodeData type]==BM_LINEAR_TREE_TYPE_FILE)
{
NSUInteger tLength;
tLength=[bundlePath_ length];
return [@"." stringByAppendingPathComponent:[[tNodeData filePath] substringFromIndex:tLength]];
}
else if ([tNodeData type]==BM_LINEAR_TREE_REPORT)
{
return [[tNodeData report] objectForKey:BM_PROBLEM_TITLE];
}
}
return nil;
}
- (NSString *) outlineView:(NSOutlineView *) inOutlineView toolTipForCell:(NSCell *) inCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *) inTableColumn item:(id) inItem mouseLocation:(NSPoint)mouseLocation
{
if (inOutlineView==IBoutlineView_)
{
BMLinearNodeData * tNodeData;
tNodeData=BM_LINEAR_NODE_DATA(inItem);
if ([tNodeData type]==BM_LINEAR_TREE_TYPE_FILE)
{
return [tNodeData filePath];
}
}
return nil;
}
- (void) outlineView:(NSOutlineView *) inOutlineView willDisplayCell:(id) inCell forTableColumn:(NSTableColumn *) inTableColumn item:(id) inItem
{
if (inOutlineView==IBoutlineView_)
{
if ([[inTableColumn identifier] isEqualToString:@"Report"])
{
BMLinearNodeData * tNodeData;
BMLinearReportCell * tReportCell;
tReportCell=(BMLinearReportCell *) inCell;
tNodeData=BM_LINEAR_NODE_DATA(inItem);
if ([tNodeData type]==BM_LINEAR_TREE_TYPE_FILE)
{
NSString * tFilePath;
NSImage * tIcon=nil;
NSUInteger tLength;
//NSDictionary * tReportDictionary;
//tReportDictionary=[tNodeData report];
[tReportCell setType:BM_LINEAR_CELL_TYPE_FILE];
// Icon
tFilePath=[tNodeData filePath];
if (tFilePath!=nil)
{
tIcon=[iconsCache_ objectForKey:tFilePath];
if (tIcon==nil)
{
tIcon=[[NSWorkspace sharedWorkspace] iconForFile:tFilePath];
if (tIcon!=nil)
{
[tIcon setScalesWhenResized:YES];
[tIcon setSize:NSMakeSize(32.0,32.0)];
[iconsCache_ setObject:tIcon forKey:tFilePath];
}
}
}
[tReportCell setIcon:tIcon];
// Text
tLength=[bundlePath_ length];
[tReportCell setTitle:[@"." stringByAppendingPathComponent:[[tNodeData filePath] substringFromIndex:tLength]]];
// Notes, Warnings & Errors
[tReportCell setNotes:[tNodeData notes] warnings:[tNodeData warnings] errors:[tNodeData errors]];
}
else
{
NSDictionary * tReportDictionary;
[tReportCell setType:BM_LINEAR_CELL_TYPE_REPORT];
switch([tNodeData level])
{
case BM_PROBLEM_LEVEL_NOTE:
[tReportCell setIcon:[BMLinearReportCell noteIcon]];
break;
case BM_PROBLEM_LEVEL_WARNING:
[tReportCell setIcon:[BMLinearReportCell warningIcon]];
break;
case BM_PROBLEM_LEVEL_ERROR:
[tReportCell setIcon:[BMLinearReportCell errorIcon]];
break;
}
tReportDictionary=[tNodeData report];
if (tReportDictionary!=nil)
{
NSString * tDescription;
[tReportCell setTitle:[tReportDictionary objectForKey:BM_PROBLEM_TITLE]];
[tReportCell setHighlightRange:NSMakeRange(NSNotFound,0)];
tDescription=[tReportDictionary objectForKey:BM_PROBLEM_DESCRIPTION];
if ([tDescription length]>0 /*&& [tNodeData descriptionVisible]==YES*/)
{
NSDictionary * tExtrasDictionary;
tExtrasDictionary=[tReportDictionary objectForKey:BM_PROBLEM_EXTRAS];
if (tExtrasDictionary!=nil)
{
NSString * tRangeString;
tRangeString=[tExtrasDictionary objectForKey:BM_PROBLEM_EXTRA_HIGHLIGHT_TEXT_RANGE];
if (tRangeString!=nil)
{
[tReportCell setHighlightRange:NSRangeFromString(tRangeString)];
}
}
[tReportCell setDescription:tDescription];
}
else
{
[tReportCell setDescription:nil];
}
}
else
{
[tReportCell setTitle:nil];
[tReportCell setDescription:nil];
}
}
}
}
}
- (CGFloat) outlineView:(NSOutlineView *) inOutlineView heightOfRowByItem:(id) inItem
{
if (inOutlineView==IBoutlineView_)
{
BMLinearNodeData * tNodeData;
tNodeData=BM_LINEAR_NODE_DATA(inItem);
if ([tNodeData type]==BM_LINEAR_TREE_TYPE_FILE)
{
return 36.0;
}
else
{
NSDictionary * tReportDictionary;
NSString * tDescription=nil;
NSTableColumn * tTableColumn;
NSSize tSize;
tReportDictionary=[tNodeData report];
tSize.width=0.;
tSize.height=20.0;
tTableColumn=[inOutlineView tableColumnWithIdentifier:@"Report"];
if (tTableColumn!=nil)
{
tSize.width=[tTableColumn width]-32.0;
}
/*if ([tNodeData descriptionVisible]==YES)*/
{
tDescription=[tReportDictionary objectForKey:BM_PROBLEM_DESCRIPTION];
}
return [BMLinearReportCell heightOfCellWithTitle:[tReportDictionary objectForKey:BM_PROBLEM_TITLE] description:tDescription frameSize:tSize];
}
}
return 15.0;
}
#pragma mark -
- (void) expandItem:(BMLinearTreeNode *) inFileTree ifKeyOfDictionary:(NSMutableDictionary *) inDictionary
{
if (inFileTree!=nil && [inDictionary count]>0)
{
if ([BM_LINEAR_NODE_DATA(inFileTree) isLeaf]==NO)
{
NSString * tFilePath;
NSArray * tChildren;
NSNumber * tNumber;
tFilePath=[BM_LINEAR_NODE_DATA(inFileTree) filePath];
[IBoutlineView_ expandItem:inFileTree];
// Check children
tChildren=[inFileTree children];
for(BMLinearTreeNode * tFileTree in tChildren)
{
[self expandItem:tFileTree ifKeyOfDictionary:inDictionary];
}
tNumber=[inDictionary objectForKey:tFilePath];
if (tNumber==nil || [tNumber boolValue]==NO)
{
[IBoutlineView_ collapseItem:inFileTree];
}
}
}
}
- (void) restoreDisclosedStates
{
NSDictionary * tDictionary;
tDictionary=[self controllerDefaultForKey:[self disclosedStateKey]];
if (tDictionary!=nil)
{
NSMutableDictionary * tDictionaryCopy;
tDictionaryCopy=[tDictionary mutableCopy];
if (tDictionaryCopy!=nil)
{
NSArray * tChildren;
tChildren=[displayTree_ children];
for(BMLinearTreeNode * tFileTree in tChildren)
{
[self expandItem:tFileTree ifKeyOfDictionary:tDictionaryCopy];
}
[tDictionaryCopy release];
}
}
}
#pragma mark -
- (void) revealSelectedIssues:(id) sender
{
NSIndexSet * tIndexSet;
tIndexSet=[IBoutlineView_ selectedRowIndexes];
if ([tIndexSet count]>0)
{
NSUInteger tIndex;
tIndex=[tIndexSet firstIndex];
while (tIndex!=NSNotFound)
{
BMLinearTreeNode * tNode;
tNode=[IBoutlineView_ itemAtRow:tIndex];
if (tNode!=nil)
{
NSString * tAbsolutePath=nil;
BMLinearNodeData * tNodeData=BM_LINEAR_NODE_DATA(tNode);
if ([tNodeData type]==BM_LINEAR_TREE_REPORT)
{
NSDictionary * tReportDictionary=[tNodeData report];
tAbsolutePath=[BM_LINEAR_NODE_DATA([tNode nodeParent]) filePath];
NSDictionary * tExtrasDictionary=[tReportDictionary objectForKey:BM_PROBLEM_EXTRAS];
NSNumber * tLineNumber=[tExtrasDictionary objectForKey:BM_PROBLEM_EXTRA_LINE_NUMBER];
if (tLineNumber!=nil)
{
#define XED_PATH @"/usr/bin/xed"
// Look for xed
if ([[NSFileManager defaultManager] fileExistsAtPath:XED_PATH]==YES)
{
NSTask * tTask;
tTask=[[NSTask new] autorelease];
if (tTask!=nil)
{
[tTask setLaunchPath:XED_PATH];
[tTask setArguments:[NSArray arrayWithObjects:@"-l",[tLineNumber stringValue],tAbsolutePath,nil]];
[tTask launch];
return;
}
}
}
[[NSWorkspace sharedWorkspace] selectFile:tAbsolutePath inFileViewerRootedAtPath:@""];
}
else if ([tNodeData type]==BM_LINEAR_TREE_TYPE_FILE)
{
tAbsolutePath=[tNodeData filePath];
[[NSWorkspace sharedWorkspace] selectFile:tAbsolutePath inFileViewerRootedAtPath:@""];
}
}
tIndex=[tIndexSet indexGreaterThanIndex:tIndex];
}
}
}
- (void) _switchedToScope:(id) sender
{
NSUInteger i,tCount;
NSInteger tTag=-1;
if ([sender isKindOfClass:[NSMenuItem class]]==YES)
{
tTag=[sender tag];
}
tCount=[cachedScopeButtons_ count];
for(i=0;i<tCount;i++)
{
NSButton * tButton;
tButton=[cachedScopeButtons_ objectAtIndex:i];
if (tButton!=sender)
{
if (tTag!=-1)
{
if ([tButton tag]==tTag)
{
[tButton setState:NSOnState];
continue;
}
}
[tButton setState:NSOffState];
}
}
}
- (IBAction) switchScope:(id) sender
{
[scopeSet_ removeAllIndexes];
if ([sender tag]==7)
{
[scopeSet_ addIndexes:scopeSetAll_];
}
else
{
[scopeSet_ addIndex:[sender tag]];
}
[self _switchedToScope:sender];
[displayTreeHash_ release];
[displayTree_ release];
displayTreeHash_=[[NSMutableDictionary alloc] initWithCapacity:100];
if (displayTreeHash_!=nil)
{
displayTree_=[[BMLinearTreeNode duplicateTree:storageTree_ limitedToScopes:scopeSet_ searchPattern:nil hash:displayTreeHash_] retain];
}
// A COMPLETER (Gestion de la selection + disclosure)
[IBoutlineView_ reloadData];
[self restoreDisclosedStates];
}
#pragma mark -
- (void) didReceiveNewReport:(NSDictionary *) inReportDictionary forFileAtPath:(NSString *) inPath level:(NSNumber *) inLevelNumber
{
if (inReportDictionary!=nil && inPath!=nil && inLevelNumber!=nil)
{
BMLinearTreeNode * tFileTreeNode;
NSInteger tLevelValue;
tLevelValue=[inLevelNumber longValue];
tFileTreeNode=[storageTreeHash_ objectForKey:inPath];
if (tFileTreeNode==nil)
{
BMLinearNodeData * tFileLinearData;
tFileLinearData=[BMLinearNodeData nodeOfType:BM_LINEAR_TREE_TYPE_FILE withReport:nil ofLevel:tLevelValue];
if (tFileLinearData!=nil)
{
[tFileLinearData setFilePath:inPath];
tFileTreeNode=[[BMLinearTreeNode alloc] initWithData:tFileLinearData
parent:nil
children:[NSArray array]];
if (tFileTreeNode!=nil)
{
[storageTree_ insertSortedChildReverse: tFileTreeNode];
[storageTreeHash_ setObject:tFileTreeNode forKey:inPath];
[tFileTreeNode release];
}
}
}
if (tFileTreeNode!=nil)
{
BMLinearNodeData * tFileLinearData;
tFileLinearData=BM_LINEAR_NODE_DATA(tFileTreeNode);
if (tFileLinearData!=nil)
{
BMLinearNodeData * tReportLinearData;
tReportLinearData=[BMLinearNodeData nodeOfType:BM_LINEAR_TREE_REPORT withReport:inReportDictionary ofLevel:tLevelValue];
if (tReportLinearData!=nil)
{
BMLinearTreeNode * tReportTreeNode;
tReportTreeNode=[[BMLinearTreeNode alloc] initWithData:tReportLinearData
parent:nil
children:[NSArray array]];
if (tReportTreeNode!=nil)
{
[tFileTreeNode insertChild: tReportTreeNode
atIndex: [tFileTreeNode numberOfChildren]];
[tReportTreeNode release];
}
}
}
}
if ([scopeSet_ containsIndex:tLevelValue]==YES)
{
BOOL isNewFile=NO;
tFileTreeNode=[displayTreeHash_ objectForKey:inPath];
if (tFileTreeNode==nil)
{
BMLinearNodeData * tFileLinearData;
tFileLinearData=[BMLinearNodeData nodeOfType:BM_LINEAR_TREE_TYPE_FILE withReport:nil ofLevel:tLevelValue];
if (tFileLinearData!=nil)
{
[tFileLinearData setFilePath:inPath];
tFileTreeNode=[[BMLinearTreeNode alloc] initWithData:tFileLinearData
parent:nil
children:[NSArray array]];
if (tFileTreeNode!=nil)
{
[displayTree_ insertSortedChildReverse: tFileTreeNode];
[displayTreeHash_ setObject:tFileTreeNode forKey:inPath];
[tFileTreeNode release];
isNewFile=YES;
}
}
}
if (tFileTreeNode!=nil)
{
BMLinearNodeData * tFileLinearData;
tFileLinearData=BM_LINEAR_NODE_DATA(tFileTreeNode);
if (tFileLinearData!=nil)
{
BMLinearNodeData * tReportLinearData;
tReportLinearData=[BMLinearNodeData nodeOfType:BM_LINEAR_TREE_REPORT withReport:inReportDictionary ofLevel:tLevelValue];
if (tReportLinearData!=nil)
{
BMLinearTreeNode * tReportTreeNode;
tReportTreeNode=[[BMLinearTreeNode alloc] initWithData:tReportLinearData
parent:nil
children:[NSArray array]];
if (tReportTreeNode!=nil)
{
[tFileTreeNode insertChild: tReportTreeNode
atIndex: [tFileTreeNode numberOfChildren]];
[tReportTreeNode release];
}
}
}
}
if (isNewFile==YES)
{
[itemsToExpand_ addObject:tFileTreeNode];
}
/*[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayedRefresh:) object:nil];
[self performSelector:@selector(delayedRefresh:) withObject:nil afterDelay:0.1];*/
}
}
}
- (BOOL) canSwitchScope
{
return (noGlitchesFound_==NO);
}
- (void) analysisWillStart
{
NSRect tBounds;
NSRect tFrame;
[super analysisWillStart];
[storageTree_ release];
storageTree_=nil;
[displayTree_ release];
displayTree_=nil;
[IBoutlineView_ setHidden:YES];
[IBoutlineView_ deselectAll:nil];
[IBoutlineView_ reloadData];
if (outlineSubView_!=nil)
{
[outlineSubView_ removeFromSuperview];
}
outlineSubView_=IBcheckingView_;
tBounds=[IBoutlineView_ bounds];
tFrame=[outlineSubView_ frame];
tFrame.origin.x=round(NSMidX(tBounds)-NSWidth(tFrame)*0.5);
tFrame.origin.y=round(NSMidY(tBounds)-NSHeight(tFrame)*0.5);
[outlineSubView_ setFrame:tFrame];
[self.view addSubview:outlineSubView_];
[IBallScope_ setEnabled:NO];
[IBerrorsScope_ setEnabled:NO];
[IBwarningsScope_ setEnabled:NO];
[IBnotesScope_ setEnabled:NO];
[IBspinningIndicator_ startAnimation:nil];
[itemsToExpand_ release];
itemsToExpand_=[[NSMutableArray alloc] initWithCapacity:10];
[self prepareData];
}
- (void) analysisDidStart
{
// A COMPLETER
}
- (void) analysisDidComplete
{
[storageTreeHash_ release];
storageTreeHash_=nil;
[displayTreeHash_ release];
displayTreeHash_=nil;
if (outlineSubView_!=nil)
{
[IBspinningIndicator_ stopAnimation:nil];
[outlineSubView_ removeFromSuperview];
}
if ([reportDictionary_ count]==0)
{
NSRect tBounds;
NSRect tFrame;
outlineSubView_=IBnoGlitchesView_;
noGlitchesFound_=YES;
tBounds=[IBoutlineView_ bounds];
tFrame=[outlineSubView_ frame];
tFrame.origin.x=round(NSMidX(tBounds)-NSWidth(tFrame)*0.5);