3838
3939import com .microsoft .copilot .eclipse .ui .CopilotUi ;
4040import com .microsoft .copilot .eclipse .ui .chat .services .ChatServiceManager ;
41+ import com .microsoft .copilot .eclipse .ui .chat .tools .ChangedFile ;
4142import com .microsoft .copilot .eclipse .ui .chat .tools .FileToolService ;
4243import com .microsoft .copilot .eclipse .ui .chat .tools .FileToolService .FileChangeProperty ;
4344import com .microsoft .copilot .eclipse .ui .utils .SwtUtils ;
@@ -103,7 +104,7 @@ private void setupMocks() {
103104 void testNoScrollForFewFiles () {
104105 SwtUtils .invokeOnDisplayThread (() -> {
105106 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
106- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (3 , false );
107+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (3 );
107108
108109 workingSetBar .buildSummaryBarFor (filesMap );
109110
@@ -122,7 +123,7 @@ void testNoScrollForFewFiles() {
122123 void testNoScrollForExactlyMaxFiles () {
123124 SwtUtils .invokeOnDisplayThread (() -> {
124125 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
125- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (5 , false );
126+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (5 );
126127
127128 workingSetBar .buildSummaryBarFor (filesMap );
128129
@@ -141,7 +142,7 @@ void testNoScrollForExactlyMaxFiles() {
141142 void testScrollCreatedForManyFiles () {
142143 SwtUtils .invokeOnDisplayThread (() -> {
143144 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
144- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (10 , false );
145+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (10 );
145146
146147 workingSetBar .buildSummaryBarFor (filesMap );
147148
@@ -164,7 +165,7 @@ void testScrollCreatedForManyFiles() {
164165 void testScrollHeightHintForManyFiles () {
165166 SwtUtils .invokeOnDisplayThread (() -> {
166167 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
167- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (8 , false );
168+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (8 );
168169
169170 workingSetBar .buildSummaryBarFor (filesMap );
170171
@@ -190,7 +191,7 @@ void testAllFileRowsRenderedWithScroll() {
190191 SwtUtils .invokeOnDisplayThread (() -> {
191192 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
192193 int fileCount = 7 ;
193- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (fileCount , false );
194+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (fileCount );
194195
195196 workingSetBar .buildSummaryBarFor (filesMap );
196197
@@ -215,7 +216,7 @@ void testAllFileRowsRenderedWithScroll() {
215216 void testContentAreaSetInScrolledComposite () {
216217 SwtUtils .invokeOnDisplayThread (() -> {
217218 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
218- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (8 , false );
219+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (8 );
219220
220221 workingSetBar .buildSummaryBarFor (filesMap );
221222
@@ -242,7 +243,7 @@ void testContentAreaSetInScrolledComposite() {
242243 void testMinHeightSetForScrolledComposite () {
243244 SwtUtils .invokeOnDisplayThread (() -> {
244245 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
245- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (10 , false );
246+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (10 );
246247
247248 workingSetBar .buildSummaryBarFor (filesMap );
248249
@@ -266,7 +267,7 @@ void testRebuildSummaryBarChangesScrollBehavior() {
266267 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
267268
268269 // First build with few files (no scroll)
269- Map <IFile , FileChangeProperty > fewFiles = createMockFilesMap (3 , false );
270+ Map <ChangedFile , FileChangeProperty > fewFiles = createMockFilesMap (3 );
270271 workingSetBar .buildSummaryBarFor (fewFiles );
271272
272273 Object changedFiles1 = getFieldValue (workingSetBar , "changedFiles" );
@@ -275,7 +276,7 @@ void testRebuildSummaryBarChangesScrollBehavior() {
275276 assertNull (scroll1 , "No scroll should exist for 3 files" );
276277
277278 // Rebuild with many files (should have scroll)
278- Map <IFile , FileChangeProperty > manyFiles = createMockFilesMap (10 , false );
279+ Map <ChangedFile , FileChangeProperty > manyFiles = createMockFilesMap (10 );
279280 workingSetBar .buildSummaryBarFor (manyFiles );
280281
281282 Object changedFiles2 = getFieldValue (workingSetBar , "changedFiles" );
@@ -294,7 +295,7 @@ void testRebuildSummaryBarChangesScrollBehavior() {
294295 void testExpandIconImageWhenExpanded () {
295296 SwtUtils .invokeOnDisplayThread (() -> {
296297 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
297- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (3 , false );
298+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (3 );
298299
299300 workingSetBar .buildSummaryBarFor (filesMap );
300301
@@ -322,7 +323,7 @@ void testExpandIconImageWhenExpanded() {
322323 void testExpandIconImageWhenCollapsed () {
323324 SwtUtils .invokeOnDisplayThread (() -> {
324325 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
325- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (3 , false );
326+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (3 );
326327
327328 workingSetBar .buildSummaryBarFor (filesMap );
328329
@@ -354,7 +355,7 @@ void testExpandIconImageWhenCollapsed() {
354355 void testTooltipTextWhenExpanded () {
355356 SwtUtils .invokeOnDisplayThread (() -> {
356357 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
357- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (3 , false );
358+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (3 );
358359
359360 workingSetBar .buildSummaryBarFor (filesMap );
360361
@@ -395,7 +396,7 @@ void testTooltipTextWhenExpanded() {
395396 void testTooltipTextWhenCollapsed () {
396397 SwtUtils .invokeOnDisplayThread (() -> {
397398 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
398- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (5 , false );
399+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (5 );
399400
400401 workingSetBar .buildSummaryBarFor (filesMap );
401402
@@ -436,7 +437,7 @@ void testTooltipTextWhenCollapsed() {
436437 void testTooltipAndImageToggleBehavior () {
437438 SwtUtils .invokeOnDisplayThread (() -> {
438439 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
439- Map <IFile , FileChangeProperty > filesMap = createMockFilesMap (4 , false );
440+ Map <ChangedFile , FileChangeProperty > filesMap = createMockFilesMap (4 );
440441
441442 workingSetBar .buildSummaryBarFor (filesMap );
442443
@@ -476,7 +477,7 @@ void testTooltipContainsCorrectFileCount() {
476477 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
477478
478479 // Test with 1 file
479- Map <IFile , FileChangeProperty > oneFile = createMockFilesMap (1 , false );
480+ Map <ChangedFile , FileChangeProperty > oneFile = createMockFilesMap (1 );
480481 workingSetBar .buildSummaryBarFor (oneFile );
481482
482483 Object titleBar = getFieldValue (workingSetBar , "titleBar" );
@@ -488,7 +489,7 @@ void testTooltipContainsCorrectFileCount() {
488489 "Tooltip should contain 'file' (singular)" );
489490
490491 // Test with 10 files
491- Map <IFile , FileChangeProperty > tenFiles = createMockFilesMap (10 , false );
492+ Map <ChangedFile , FileChangeProperty > tenFiles = createMockFilesMap (10 );
492493 workingSetBar .buildSummaryBarFor (tenFiles );
493494
494495 titleBar = getFieldValue (workingSetBar , "titleBar" );
@@ -508,7 +509,7 @@ void testTooltipContainsCorrectFileCount() {
508509 void testEmptyFilesMapDoesNotCreateChangedFiles () {
509510 SwtUtils .invokeOnDisplayThread (() -> {
510511 workingSetBar = new WorkingSetBar (parent , SWT .NONE );
511- Map <IFile , FileChangeProperty > emptyMap = new LinkedHashMap <>();
512+ Map <ChangedFile , FileChangeProperty > emptyMap = new LinkedHashMap <>();
512513
513514 workingSetBar .buildSummaryBarFor (emptyMap );
514515
@@ -524,11 +525,11 @@ void testEmptyFilesMapDoesNotCreateChangedFiles() {
524525 /**
525526 * Creates a map of mock files with the specified count.
526527 */
527- private Map <IFile , FileChangeProperty > createMockFilesMap (int count , boolean isHandled ) {
528- Map <IFile , FileChangeProperty > filesMap = new LinkedHashMap <>();
528+ private Map <ChangedFile , FileChangeProperty > createMockFilesMap (int count ) {
529+ Map <ChangedFile , FileChangeProperty > filesMap = new LinkedHashMap <>();
529530 for (int i = 0 ; i < count ; i ++) {
530531 IFile mockFile = createMockFile ("TestFile" + i + ".java" );
531- filesMap .put (mockFile , new FileChangeProperty (FileChangeType .Created ));
532+ filesMap .put (ChangedFile . workspace ( mockFile ) , new FileChangeProperty (FileChangeType .Created ));
532533 }
533534 return filesMap ;
534535 }
0 commit comments