Highlight missing files

This commit is contained in:
Matthias Neeracher 2015-01-11 02:53:50 +01:00 committed by Matthias Neeracher
parent e13c7f5757
commit bef839fdaa
2 changed files with 16 additions and 4 deletions

View File

@ -79,6 +79,9 @@ class ASFileNode {
func paths(rootPath: NSString) -> [NSString] { func paths(rootPath: NSString) -> [NSString] {
return [NSString]() return [NSString]()
} }
func exists() -> Bool {
return true
}
} }
class ASLogNode : ASFileNode { class ASLogNode : ASFileNode {
@ -200,6 +203,9 @@ class ASFileItem : ASFileNode {
override func paths(rootPath: NSString) -> [NSString] { override func paths(rootPath: NSString) -> [NSString] {
return [relativePath(rootPath)] return [relativePath(rootPath)]
} }
override func exists() -> Bool {
return url.checkResourceIsReachableAndReturnError(nil)
}
} }
class ASFileTree : NSObject, NSOutlineViewDataSource { class ASFileTree : NSObject, NSOutlineViewDataSource {

View File

@ -279,10 +279,16 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
updateChangeCount(.ChangeDone) updateChangeCount(.ChangeDone)
} }
func outlineView(outlineView: NSOutlineView, willDisplayCell cell: AnyObject, forTableColumn tableColumn: NSTableColumn?, item: AnyObject) { func outlineView(outlineView: NSOutlineView, willDisplayCell cell: AnyObject, forTableColumn tableColumn: NSTableColumn?, item: AnyObject) {
if let textCell = cell as? NSTextFieldCell {
textCell.textColor = NSColor.blackColor()
if item === files.root || item === files.buildLog || item === files.uploadLog || item === files.disassembly { if item === files.root || item === files.buildLog || item === files.uploadLog || item === files.disassembly {
(cell as NSCell).font = NSFont.boldSystemFontOfSize(13.0) textCell.font = NSFont.boldSystemFontOfSize(13.0)
} else { } else {
(cell as NSCell).font = NSFont.systemFontOfSize(13.0) textCell.font = NSFont.systemFontOfSize(13.0)
if !(item as ASFileNode).exists() {
textCell.textColor = NSColor.redColor()
}
}
} }
} }