               ruleSet.dataSource match
 
   showMenu:(options, data)->
-    
+
     {token,rule} = options
     @menu.destroy() if @menu
     o =

      if matchRules
        for rule, ruleSet of matchRules
          matches = val.match ruleSet.regex
          
          return unless matches

          matches.forEach (match,i)->

    @input.setBlur()
    @menu = new JContextMenu o, data
    @menu.on "ContextMenuItemReceivedClick", (menuItem)=>
      @registerSelectedToken {rule, token}, menuItem.getData()
      # @getOptions().match[rule].callback token, menuItem.getData()

  registerSelectedToken:({rule, token}, data)->

    @registeredTokens[rule][token] = {
      replacedText : data.title
      data
    }
    log @registeredTokens
    val = @input.getValue()
    val = val.replace token, "#{data.title}"
    @input.setValue val
    @layer.updatePartial @layer.$().html().replace data.title, "<span>#{data.title}</span>"
    @menu.destroy()
    @input.setFocus()


  pistachio:->

