<commit_before>class IDE.FinderPane extends IDE.Pane

  constructor: (options = {}, data) ->

    super options, data

    appManager = KD.getSingleton 'appManager'

    appManager.open 'Finder', (finderApp) =>
      fc = @finderController = finderApp.create
        addAppTitle   : no
        treeItemClass : IDE.FinderItem

      @addSubView fc.getView()
      @bindListeners()
      fc.reset()

  bindListeners: ->
    mgr = KD.getSingleton 'appManager'
    fc  = @finderController

    fc.on 'FileNeedsToBeOpened', (file) ->
      file.fetchContents (err, contents) ->
        mgr.tell 'IDE', 'openFile', file, contents<commit_msg>IDE: Get machine from computeController and mount it.<commit_after>class IDE.FinderPane extends IDE.Pane

  constructor: (options = {}, data) ->

    super options, data

    appManager  = KD.getSingleton 'appManager'
    computeCtrl = KD.getSingleton 'computeController'
    ideApp      = appManager.getFrontApp()

    # TODO: 404 - Brain not found.
    # It should be fixed with computeController.ready but there is a race condition
    # there but I don't have enough brain to fix it right now.

    KD.utils.wait 2000, => # computeCtrl.ready =>
      for machine in computeCtrl.machines when machine.uid is ideApp.mountedMachineUId
        machineItem  = machine

      appManager.open 'Finder', (finderApp) =>
        fc = @finderController = finderApp.create
          addAppTitle   : no
          treeItemClass : IDE.FinderItem
          machineToMount: machineItem

        @addSubView fc.getView()
        @bindListeners()
        fc.reset()

  bindListeners: ->
    mgr = KD.getSingleton 'appManager'
    fc  = @finderController

    fc.on 'FileNeedsToBeOpened', (file) ->
      file.fetchContents (err, contents) ->
        mgr.tell 'IDE', 'openFile', file, contents
{'fraction_non_alphanumeric': 0.10099337748344371, 'fraction_numerical': 0.003863134657836645, 'mean_word_length': 2.769230769230769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '6261390', 'n_tokens_mistral': 568, 'n_tokens_neox': 526, 'n_words': 143}