<commit_before>//
//  PopoverTableView.swift
//  idrop.link
//
//  Created by <NAME> on 31/05/15.
//  Copyright (c) 2015 andinfinity. All rights reserved.
//

import Cocoa

class PopoverTableView: NSTableView {
    var user: User?

    override func awakeFromNib() {
        // refine drawing (for the NSTableView as well
        // as for the enclosing NSScrollView). we want to
        // be completely transparent. to reach this, we
        // have to do the following:
        //     * remove any border
        //     * remove any background
        //     * remove header
        self.enclosingScrollView?.drawsBackground = false
        self.enclosingScrollView?.borderType = NSBorderType.NoBorder
        self.headerView = nil
        self.backgroundColor = NSColor.clearColor()

        // wire up action executed on double click
        // note that we have to use a selector
        // due to the underlying cocoa logic which is
        // written in Objective-C
        self.doubleAction = "onDoubleAction:" as Selector

        // the message which is being sent to the selector
        // declared above should be delivered to this very
        // object (well, actually its instance(s))
        self.target = self
    }

    /**
    Gets executed on double click. Every cell represents a drop
    which has a URL. This URL gets openend in the default browser.

    - parameter sender: The sender

    :see: doubleAction (attribute)
    :see: target (attribute)
    */
    func onDoubleAction(sender: AnyObject) {
        // the case when no drops are displayed
        if self.selectedRow < 0 {
            return
        }

        if let usr = self.user {
            if usr.drops.count > 0 && usr.drops.count >= self.selectedRow {
                if let url = usr.drops[self.selectedRow].url {
                    let _url = NSURL(string: url) as! CFURLRef
                    LSOpenCFURLRef(_url, nil)
                }
            }
        }
    }

}
<commit_msg>Replaced deprecated selector syntax with #selector()<commit_after>//
//  PopoverTableView.swift
//  idrop.link
//
//  Created by <NAME> on 31/05/15.
//  Copyright (c) 2015 andinfinity. All rights reserved.
//

import Cocoa

class PopoverTableView: NSTableView {
    var user: User?

    override func awakeFromNib() {
        // refine drawing (for the NSTableView as well
        // as for the enclosing NSScrollView). we want to
        // be completely transparent. to reach this, we
        // have to do the following:
        //     * remove any border
        //     * remove any background
        //     * remove header
        self.enclosingScrollView?.drawsBackground = false
        self.enclosingScrollView?.borderType = NSBorderType.NoBorder
        self.headerView = nil
        self.backgroundColor = NSColor.clearColor()

        // wire up action executed on double click
        // note that we have to use a selector
        // due to the underlying cocoa logic which is
        // written in Objective-C
        self.doubleAction = #selector(onDoubleAction)

        // the message which is being sent to the selector
        // declared above should be delivered to this very
        // object (well, actually its instance(s))
        self.target = self
    }

    /**
    Gets executed on double click. Every cell represents a drop
    which has a URL. This URL gets openend in the default browser.

    - parameter sender: The sender

    :see: doubleAction (attribute)
    :see: target (attribute)
    */
    func onDoubleAction(sender: AnyObject) {
        // the case when no drops are displayed
        if self.selectedRow < 0 {
            return
        }

        if let usr = self.user {
            if usr.drops.count > 0 && usr.drops.count >= self.selectedRow {
                if let url = usr.drops[self.selectedRow].url {
                    if let _url = NSURL(string: url) {
                            NSWorkspace.sharedWorkspace().openURL(_url)
                    }
                    //let _url = NSURL(string: url) as! CFURLRef
                    //LSOpenCFURLRef(_url, nil)
                }
            }
        }
    }

}

{'fraction_non_alphanumeric': 0.08349374398460058, 'fraction_numerical': 0.005774783445620789, 'mean_word_length': 1.7731821214142762, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3290052', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1095, 'n_words': 389}