Sha256: 7566ff5cf6d8846afd5a5ba8777945205274b8bf0072b43bbd6a00c2030d2f9f
Contents?: true
Size: 1.53 KB
Versions: 24
Compression:
Stored size: 1.53 KB
Contents
module Redcar class EditTab < Tab attr_reader :edit_view def initialize(*args) super create_edit_view end def icon i = DEFAULT_ICON doc = @edit_view.document if doc and doc.path unless doc.mirror.adapter.is_a?(Redcar::Project::Adapters::Remote) if File.exists?(doc.path) if File.writable?(doc.path) key = File.basename(doc.path).split('.').last.split(//).first.downcase if key =~ /[a-z]/ if key == 'a' i = :document_attribute else i = :"document_attribute_#{key}" end else i = DEFAULT_ICON end else i = NO_WRITE_ICON end else i = MISSING_ICON end end end i end def update_for_file_changes new_icon = icon if new_icon and new_icon != @icon @icon = new_icon notify_listeners(:changed_icon, @icon) end end def create_edit_view @edit_view = Redcar::EditView.new @edit_view.add_listener(:focussed, &method(:edit_view_focussed)) @edit_view.document.add_listener(:changed) { notify_listeners(:changed, self) } @edit_view.document.add_listener(:selection_range_changed) { notify_listeners(:selection_changed) } @edit_view.add_listener(:title_changed) { |newt| self.title = newt } end def edit_view_focussed notify_listeners(:focus) end end end
Version data entries
24 entries across 24 versions & 2 rubygems