// this is ugly, but I am trying to hand all formatting issues to Project builder
if (([item filetype] != NSFileTypeDirectory) || (NSRunAlertPanel(@"Delete Directory !!!", @"Are you sure you want to delete all the contents of %@", @"No", @"Yes", nil, [item filename]) == NSAlertAlternateReturn))
{
// maybe because the selected cell is being deleted we get an exception?
[outlineView deselectAll:self];
if ( [fm removeFileAtPath:[item fullPathName] handler:self] == YES )
NSLog( @"Removed %@\n", [item fullPathName] );
else
NSLog( @"Error, could not remove %@\n", [item fullPathName] );
// make the parent reload it's contained files array, should reload next
// time we ask for the containedFiles
[parent setContainedFiles:nil];
// have the outline view reload the parent. The outline view should
// shrink to remove the deleted image. This causes an exception.
[descText setStringValue:[NSString stringWithFormat:@"%@ (%.1f x %.1f)", [item filename], size.width, size.height]];
}
else
{
[imageView setImage:nil];
if ([item filetype] == NSFileTypeDirectory)
[outlineView expandItem:item];
}
HANDLER
ENDHANDLER
}
/* This routine asks for the object corresponding to the indexth child of item. If the object is at the top level (i.e. the files contained in your home directory), the outlineView passes an item==nil, so that has to be special cased. In this case, there is a single FilteredFileInfo corresponding to the home directory that contains all of the top level FilteredFileInfos.
/* This routine checks to see whether a given item is expandable (i.e. needs a little spinning triangle thingy. In this case, it does if and only if it is a directory. Of course that doesn't mean that there are necessarily any subitems, since it should be possible to open an empty directory even though there's nothing inside.
/* outlineView:numberOfChildrenOfItem: performs a query to see how many children a particular item has. Presumably the item has already been tested by outlineView:isItemExpandable to make sure it can be opened in the first place. Again, an item==nil means that it's the top-level (see outlineView:child:ofItem:)
/* now that it's determined what the right object for a given row is, the NSOutlineView will ask what the appropriate data it should stick into each of the columns for that item. In this case, the NSTableColumns have been setup in Interface Builder to have identifiers that correspond exactly to the correct accessor methods of the FileInfo objects. Using the power of the Objective C runtime, these NSStrings are converted into selectors (similar to pointers to virtual functions in C++), which are then called on the items to return the correct information.
/* don't need to release finderListWindow since we never retained it. in general, we probably should have, but since it was only used in awakeFromNib, it wasn't necessary.