redcar 0.12.1 → 0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +18 -0
- data/bin/redcar +1 -0
- data/lib/redcar.rb +4 -5
- data/lib/redcar/usage.rb +0 -1
- data/lib/redcar_quick_start.rb +3 -1
- data/plugins/application/lib/application.rb +1 -0
- data/plugins/application/lib/application/commands/treebook_commands.rb +11 -18
- data/plugins/application/lib/application/dialog.rb +1 -1
- data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +13 -5
- data/plugins/application/lib/application/global_state.rb +21 -0
- data/plugins/application/lib/application/menu/item.rb +37 -11
- data/plugins/application/lib/application/notebook.rb +12 -0
- data/plugins/application/lib/application/tree/mirror.rb +0 -11
- data/plugins/application/lib/application/window.rb +32 -7
- data/plugins/application_swt/lib/application_swt.rb +1 -1
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +35 -10
- data/plugins/application_swt/lib/application_swt/icon.rb +1 -1
- data/plugins/application_swt/lib/application_swt/menu.rb +47 -15
- data/plugins/application_swt/lib/application_swt/notebook.rb +11 -2
- data/plugins/application_swt/lib/application_swt/window.rb +37 -34
- data/plugins/auto_indenter/lib/auto_indenter/analyzer.rb +1 -1
- data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +9 -0
- data/plugins/declarations/lib/declarations.rb +31 -66
- data/plugins/declarations/lib/declarations/commands.rb +142 -0
- data/plugins/declarations/lib/declarations/file.rb +1 -1
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/javascript.js +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/nothing_to_see.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/one_lonely_class.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/similar_names.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/something_fancy.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/trailing_space.rb +0 -0
- data/plugins/edit_view/lib/edit_view.rb +35 -2
- data/plugins/edit_view/lib/edit_view/commands/change_language_command.rb +31 -0
- data/plugins/edit_view/lib/edit_view/commands/language_settings_commands.rb +45 -0
- data/plugins/edit_view/lib/edit_view/document/command.rb +1 -1
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +11 -13
- data/plugins/key_bindings/lib/key_bindings.rb +6 -2
- data/plugins/project/lib/project.rb +27 -32
- data/plugins/project/lib/project/commands.rb +3 -88
- data/plugins/project/lib/project/dir_controller.rb +12 -18
- data/plugins/project/lib/project/dir_mirror.rb +20 -25
- data/plugins/project/lib/project/file_mirror.rb +10 -10
- data/plugins/project/lib/project/find_file_dialog.rb +20 -18
- data/plugins/project/lib/project/find_recent_dialog.rb +6 -3
- data/plugins/project/lib/project/{adapters/local.rb → local_filesystem.rb} +35 -35
- data/plugins/project/lib/project/manager.rb +21 -75
- data/plugins/project/lib/project/sub_project.rb +3 -3
- data/plugins/project/plugin.rb +0 -1
- data/plugins/project_search/lib/project_search/lucene_refresh.rb +0 -1
- data/plugins/redcar/plugin.rb +2 -2
- data/plugins/redcar/redcar.rb +34 -42
- data/plugins/ruby/lib/ruby/syntax_checker.rb +27 -7
- data/plugins/scm/lib/scm.rb +1 -12
- data/plugins/sessions/lib/sessions.rb +22 -0
- data/plugins/sessions/lib/sessions/cursor_saver.rb +162 -0
- data/plugins/sessions/lib/sessions/loader.rb +99 -0
- data/plugins/sessions/lib/sessions/memory.rb +59 -0
- data/plugins/sessions/plugin.rb +8 -0
- data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +2 -2
- data/plugins/syntax_check/lib/syntax_check.rb +2 -2
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +1 -3
- data/redcar.gemspec +1 -1
- metadata +195 -291
- data/plugins/connection_manager/lib/connection_manager.rb +0 -57
- data/plugins/connection_manager/lib/connection_manager/commands.rb +0 -14
- data/plugins/connection_manager/lib/connection_manager/connection_store.rb +0 -87
- data/plugins/connection_manager/lib/connection_manager/controller.rb +0 -100
- data/plugins/connection_manager/lib/connection_manager/filter_dialog.rb +0 -38
- data/plugins/connection_manager/lib/connection_manager/private_key_store.rb +0 -93
- data/plugins/connection_manager/plugin.rb +0 -12
- data/plugins/connection_manager/views/index.html.erb +0 -284
- data/plugins/edit_view/lib/edit_view/info_speedbar.rb +0 -98
- data/plugins/outline_view/features/outline_view.feature +0 -79
- data/plugins/outline_view/features/project_outline.feature +0 -23
- data/plugins/outline_view/features/step_definitions/outline_steps.rb +0 -61
- data/plugins/outline_view/lib/outline_view.rb +0 -97
- data/plugins/outline_view/lib/outline_view/commands.rb +0 -19
- data/plugins/outline_view/plugin.rb +0 -10
- data/plugins/outline_view_swt/lib/outline_view_swt.rb +0 -79
- data/plugins/outline_view_swt/plugin.rb +0 -7
- data/plugins/project/lib/project/adapters/remote.rb +0 -96
- data/plugins/project/lib/project/adapters/remote_protocols/ftp.rb +0 -93
- data/plugins/project/lib/project/adapters/remote_protocols/protocol.rb +0 -94
- data/plugins/project/lib/project/adapters/remote_protocols/sftp.rb +0 -181
| @@ -16,8 +16,6 @@ module Redcar | |
| 16 16 |  | 
| 17 17 | 
             
                  attr_reader :menu_bar
         | 
| 18 18 |  | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 19 | 
             
                  def self.menu_types
         | 
| 22 20 | 
             
                    [Swt::SWT::BAR, Swt::SWT::POP_UP]
         | 
| 23 21 | 
             
                  end
         | 
| @@ -31,11 +29,13 @@ module Redcar | |
| 31 29 | 
             
                    @keymap = keymap
         | 
| 32 30 | 
             
                    @menu_bar = Swt::Widgets::Menu.new(window.shell, type)
         | 
| 33 31 | 
             
                    @menu_bar.set_visible(false)
         | 
| 32 | 
            +
                    
         | 
| 34 33 | 
             
                    return unless menu_model
         | 
| 35 34 | 
             
                    @handlers = []
         | 
| 36 35 | 
             
                    @use_numbers = options[:numbers]
         | 
| 37 36 | 
             
                    @number = 1
         | 
| 38 | 
            -
                     | 
| 37 | 
            +
                    
         | 
| 38 | 
            +
                    add_entries_to_menu(@menu_bar, nil, menu_model)
         | 
| 39 39 | 
             
                    #puts "ApplicationSWT::Menu initialize took #{Time.now - s}s"
         | 
| 40 40 | 
             
                  end
         | 
| 41 41 |  | 
| @@ -59,7 +59,26 @@ module Redcar | |
| 59 59 | 
             
                    @use_numbers
         | 
| 60 60 | 
             
                  end
         | 
| 61 61 |  | 
| 62 | 
            -
                   | 
| 62 | 
            +
                  class MenuListener
         | 
| 63 | 
            +
                    attr_reader :items
         | 
| 64 | 
            +
                    
         | 
| 65 | 
            +
                    def initialize
         | 
| 66 | 
            +
                      @items = []
         | 
| 67 | 
            +
                    end
         | 
| 68 | 
            +
                    
         | 
| 69 | 
            +
                    def menu_shown(e)
         | 
| 70 | 
            +
                      items.each do |item, entry|
         | 
| 71 | 
            +
                        if entry.type == :check
         | 
| 72 | 
            +
                          item.setSelection(entry.checked?)
         | 
| 73 | 
            +
                        end
         | 
| 74 | 
            +
                      end
         | 
| 75 | 
            +
                    end
         | 
| 76 | 
            +
                    
         | 
| 77 | 
            +
                    def menu_hidden(e)
         | 
| 78 | 
            +
                    end
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  def add_entries_to_menu(menu, menu_listener, menu_model)
         | 
| 63 82 | 
             
                    menu_model.each do |entry|
         | 
| 64 83 | 
             
                      if entry.is_a?(Redcar::Menu::LazyMenu)
         | 
| 65 84 | 
             
                        menu_header = Swt::Widgets::MenuItem.new(menu, Swt::SWT::CASCADE)
         | 
| @@ -68,7 +87,7 @@ module Redcar | |
| 68 87 | 
             
                        menu_header.menu = new_menu
         | 
| 69 88 | 
             
                        menu_header.add_arm_listener do
         | 
| 70 89 | 
             
                          new_menu.get_items.each {|i| i.dispose }
         | 
| 71 | 
            -
                          add_entries_to_menu(new_menu, entry)
         | 
| 90 | 
            +
                          add_entries_to_menu(new_menu, nil, entry)
         | 
| 72 91 | 
             
                        end
         | 
| 73 92 | 
             
                      elsif entry.is_a?(Redcar::Menu)
         | 
| 74 93 | 
             
                        menu_header = Swt::Widgets::MenuItem.new(menu, Swt::SWT::CASCADE)
         | 
| @@ -76,7 +95,9 @@ module Redcar | |
| 76 95 | 
             
                        new_menu = Swt::Widgets::Menu.new(menu)
         | 
| 77 96 | 
             
                        menu_header.menu = new_menu
         | 
| 78 97 | 
             
                        menu_header.enabled = (entry.length > 0)
         | 
| 79 | 
            -
                         | 
| 98 | 
            +
                        new_menu_listener = MenuListener.new
         | 
| 99 | 
            +
                        add_entries_to_menu(new_menu, new_menu_listener, entry)
         | 
| 100 | 
            +
                        new_menu.add_menu_listener(new_menu_listener)
         | 
| 80 101 | 
             
                        menu_header.add_arm_listener do
         | 
| 81 102 | 
             
                          entry.entries.zip(new_menu.get_items) do |sub_entry, swt_item|
         | 
| 82 103 | 
             
                            if sub_entry.lazy_text?
         | 
| @@ -88,12 +109,15 @@ module Redcar | |
| 88 109 | 
             
                        item = Swt::Widgets::MenuItem.new(menu, Swt::SWT::SEPARATOR)
         | 
| 89 110 | 
             
                      elsif entry.is_a?(Redcar::Menu::Item)
         | 
| 90 111 | 
             
                        item = Swt::Widgets::MenuItem.new(menu, Menu.types[entry.type] || Swt::SWT::PUSH)
         | 
| 91 | 
            -
                        item.setSelection(entry.active)
         | 
| 92 112 | 
             
                        if entry.command.is_a?(Proc)
         | 
| 93 113 | 
             
                          connect_proc_to_item(item, entry)
         | 
| 94 114 | 
             
                        else
         | 
| 95 115 | 
             
                          connect_command_to_item(item, entry)
         | 
| 96 116 | 
             
                        end
         | 
| 117 | 
            +
                        if [:check, :radio].include? entry.type
         | 
| 118 | 
            +
                          menu_listener.items << [item, entry] if menu_listener
         | 
| 119 | 
            +
                          item.setSelection(entry.checked?)
         | 
| 120 | 
            +
                        end
         | 
| 97 121 | 
             
                      else
         | 
| 98 122 | 
             
                        raise "unknown object of type #{entry.class} in menu"
         | 
| 99 123 | 
             
                      end
         | 
| @@ -121,7 +145,11 @@ module Redcar | |
| 121 145 | 
             
                    else
         | 
| 122 146 | 
             
                      item.text = entry.text
         | 
| 123 147 | 
             
                    end
         | 
| 124 | 
            -
                     | 
| 148 | 
            +
                    if entry.enabled?
         | 
| 149 | 
            +
                      item.addSelectionListener(ProcSelectionListener.new(entry))
         | 
| 150 | 
            +
                    else
         | 
| 151 | 
            +
                      item.enabled = false
         | 
| 152 | 
            +
                    end
         | 
| 125 153 | 
             
                  end
         | 
| 126 154 |  | 
| 127 155 | 
             
                  class SelectionListener
         | 
| @@ -151,14 +179,18 @@ module Redcar | |
| 151 179 | 
             
                    else
         | 
| 152 180 | 
             
                      item.text = entry.text
         | 
| 153 181 | 
             
                    end
         | 
| 154 | 
            -
                     | 
| 155 | 
            -
             | 
| 156 | 
            -
                       | 
| 157 | 
            -
                        item. | 
| 182 | 
            +
                    if entry.enabled?
         | 
| 183 | 
            +
                      item.add_selection_listener(SelectionListener.new(entry))
         | 
| 184 | 
            +
                      h = entry.command.add_listener(:active_changed) do |value|
         | 
| 185 | 
            +
                        unless item.disposed
         | 
| 186 | 
            +
                          item.enabled = value
         | 
| 187 | 
            +
                        end
         | 
| 158 188 | 
             
                      end
         | 
| 159 | 
            -
             | 
| 160 | 
            -
             | 
| 161 | 
            -
             | 
| 189 | 
            +
                      @handlers << [entry.command, h]
         | 
| 190 | 
            +
                      if not entry.command.active?
         | 
| 191 | 
            +
                        item.enabled = false
         | 
| 192 | 
            +
                      end
         | 
| 193 | 
            +
                    else
         | 
| 162 194 | 
             
                      item.enabled = false
         | 
| 163 195 | 
             
                    end
         | 
| 164 196 | 
             
                  end
         | 
| @@ -104,6 +104,12 @@ module Redcar | |
| 104 104 | 
             
                  def attach_view_listeners
         | 
| 105 105 | 
             
                    @tab_folder.add_ctab_folder2_listener(CTabFolder2Listener.new(self))
         | 
| 106 106 | 
             
                    @tab_folder.add_selection_listener(SelectionListener.new(self))
         | 
| 107 | 
            +
                    @tab_folder.add_listener(Swt::SWT::MenuDetect) do |event|
         | 
| 108 | 
            +
                      point = ApplicationSWT.display.map(nil, @tab_folder, Swt::Graphics::Point.new(event.x, event.y))
         | 
| 109 | 
            +
                      if item = @tab_folder.getItem(point)
         | 
| 110 | 
            +
                        @model.right_click_on_tab(tab_item_to_tab_model(item))
         | 
| 111 | 
            +
                      end
         | 
| 112 | 
            +
                    end
         | 
| 107 113 | 
             
                  end
         | 
| 108 114 |  | 
| 109 115 | 
             
                  # Called by the models when a tab is selected by Redcar.
         | 
| @@ -139,8 +145,11 @@ module Redcar | |
| 139 145 | 
             
                  private
         | 
| 140 146 |  | 
| 141 147 | 
             
                  def focussed_tab
         | 
| 142 | 
            -
                     | 
| 143 | 
            -
             | 
| 148 | 
            +
                    tab_item_to_tab_model(tab_folder.get_selection)
         | 
| 149 | 
            +
                  end
         | 
| 150 | 
            +
                  
         | 
| 151 | 
            +
                  def tab_item_to_tab_model(tab_item)
         | 
| 152 | 
            +
                    @model.tabs.detect {|tab| tab.controller.item == tab_item }
         | 
| 144 153 | 
             
                  end
         | 
| 145 154 |  | 
| 146 155 | 
             
                end
         | 
| @@ -2,11 +2,11 @@ | |
| 2 2 | 
             
            module Redcar
         | 
| 3 3 | 
             
              class ApplicationSWT
         | 
| 4 4 | 
             
                class Window
         | 
| 5 | 
            -
                  attr_reader :shell, :window
         | 
| 5 | 
            +
                  attr_reader :shell, :window, :sash
         | 
| 6 6 |  | 
| 7 7 | 
             
                  SASH_WIDTH             = 5
         | 
| 8 | 
            -
                  TREEBOOK_WIDTH         = 200
         | 
| 9 8 | 
             
                  MINIMUM_TREEBOOK_WIDTH = 0
         | 
| 9 | 
            +
                  TREEBOOK_WIDTH         = 200
         | 
| 10 10 | 
             
                  VISIBLE_TREEBOOK_WIDTH = 25
         | 
| 11 11 | 
             
                  TOOLBAR_HEIGHT         = 25
         | 
| 12 12 | 
             
                  @toolbar_height        = 30
         | 
| @@ -67,8 +67,7 @@ module Redcar | |
| 67 67 | 
             
                    @window.add_listener(:speedbar_closed, &method(:speedbar_closed))
         | 
| 68 68 | 
             
                    @window.add_listener(:enlarge_notebook, &method(:enlarge_notebook))
         | 
| 69 69 | 
             
                    @window.add_listener(:reset_notebook_widths, &method(:reset_notebook_sash_widths))
         | 
| 70 | 
            -
                    @window.add_listener(: | 
| 71 | 
            -
                    @window.add_listener(:decrease_treebook_width, &method(:decrease_treebook_width))
         | 
| 70 | 
            +
                    @window.add_listener(:treebook_width_changed, &method(:set_sash_widths))
         | 
| 72 71 |  | 
| 73 72 | 
             
                    @window.add_listener(:toggle_trees_visible, &method(:toggle_sash_widths))
         | 
| 74 73 | 
             
                    @window.treebook.add_listener(:tree_added) do
         | 
| @@ -87,19 +86,34 @@ module Redcar | |
| 87 86 | 
             
                    @window.treebook.add_listener(:tree_removed) do
         | 
| 88 87 | 
             
                      reset_sash_widths
         | 
| 89 88 | 
             
                    end
         | 
| 89 | 
            +
                    
         | 
| 90 90 | 
             
                    @shell.add_key_listener(KeyListener.new(self))
         | 
| 91 | 
            +
                    @sash.add_selection_listener do |e|
         | 
| 92 | 
            +
                      @treebook_open_width = e.x
         | 
| 93 | 
            +
                    end
         | 
| 91 94 | 
             
                  end
         | 
| 92 95 |  | 
| 93 | 
            -
                  def  | 
| 94 | 
            -
                     | 
| 96 | 
            +
                  def default_treebook_width
         | 
| 97 | 
            +
                    TREEBOOK_WIDTH + SASH_WIDTH
         | 
| 95 98 | 
             
                  end
         | 
| 96 99 |  | 
| 97 100 | 
             
                  def treebook_width
         | 
| 98 101 | 
             
                    @sash.layout_data.left.offset
         | 
| 99 102 | 
             
                  end
         | 
| 100 103 |  | 
| 101 | 
            -
                  def  | 
| 102 | 
            -
                     | 
| 104 | 
            +
                  def treebook_open_width
         | 
| 105 | 
            +
                    @treebook_open_width || default_treebook_width
         | 
| 106 | 
            +
                  end
         | 
| 107 | 
            +
                  
         | 
| 108 | 
            +
                  def set_treebook_open_width(width)
         | 
| 109 | 
            +
                    @treebook_open_width = width
         | 
| 110 | 
            +
                    unless treebook_hidden?
         | 
| 111 | 
            +
                      set_sash_widths(width)
         | 
| 112 | 
            +
                    end
         | 
| 113 | 
            +
                  end
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                  def treebook_hidden?
         | 
| 116 | 
            +
                    treebook_width <= VISIBLE_TREEBOOK_WIDTH
         | 
| 103 117 | 
             
                  end
         | 
| 104 118 |  | 
| 105 119 | 
             
                  def fullscreen
         | 
| @@ -109,6 +123,17 @@ module Redcar | |
| 109 123 | 
             
                  def fullscreen=(value)
         | 
| 110 124 | 
             
                    @shell.setFullScreen(value)
         | 
| 111 125 | 
             
                  end
         | 
| 126 | 
            +
                  
         | 
| 127 | 
            +
                  def bounds
         | 
| 128 | 
            +
                    rect = @shell.bounds
         | 
| 129 | 
            +
                    [rect.x, rect.y, rect.width, rect.height]
         | 
| 130 | 
            +
                  end
         | 
| 131 | 
            +
                  
         | 
| 132 | 
            +
                  def set_bounds(new_bounds)
         | 
| 133 | 
            +
                    @shell.set_bounds(
         | 
| 134 | 
            +
                      Java::OrgEclipseSwtGraphics::Rectangle.new(
         | 
| 135 | 
            +
                        new_bounds[0], new_bounds[1], new_bounds[2], new_bounds[3]))
         | 
| 136 | 
            +
                  end
         | 
| 112 137 |  | 
| 113 138 | 
             
                  class KeyListener
         | 
| 114 139 | 
             
                    def initialize(edit_view_swt)
         | 
| @@ -116,18 +141,13 @@ module Redcar | |
| 116 141 | 
             
                    end
         | 
| 117 142 |  | 
| 118 143 | 
             
                    def key_pressed(key_event)
         | 
| 119 | 
            -
                      p key_event
         | 
| 120 144 | 
             
                      if key_event.character == Swt::SWT::TAB
         | 
| 121 | 
            -
                        p :tab_pressedwin
         | 
| 122 145 | 
             
                      elsif key_event.character == Swt::SWT::ESC
         | 
| 123 | 
            -
                        p :esc_pressedwin
         | 
| 124 146 | 
             
                      end
         | 
| 125 147 | 
             
                    end
         | 
| 126 148 |  | 
| 127 149 | 
             
                    def verify_key(key_event)
         | 
| 128 | 
            -
                      p :verkey
         | 
| 129 150 | 
             
                      if key_event.character == Swt::SWT::TAB
         | 
| 130 | 
            -
                        p :tab_pressed
         | 
| 131 151 | 
             
                        key_event.doit = false
         | 
| 132 152 | 
             
                      end
         | 
| 133 153 | 
             
                    end
         | 
| @@ -138,9 +158,7 @@ module Redcar | |
| 138 158 |  | 
| 139 159 | 
             
                  def create_treebook_controller
         | 
| 140 160 | 
             
                    treebook = @window.treebook
         | 
| 141 | 
            -
                    controller = ApplicationSWT::Treebook.new(
         | 
| 142 | 
            -
                    self,
         | 
| 143 | 
            -
                    treebook)
         | 
| 161 | 
            +
                    controller = ApplicationSWT::Treebook.new(self, treebook)
         | 
| 144 162 | 
             
                    treebook.controller = controller
         | 
| 145 163 | 
             
                  end
         | 
| 146 164 |  | 
| @@ -353,11 +371,7 @@ module Redcar | |
| 353 371 | 
             
                    @treebook_unopened = !@window.treebook.trees.any?
         | 
| 354 372 | 
             
                    width = 0
         | 
| 355 373 | 
             
                    if @window.treebook.trees.any?
         | 
| 356 | 
            -
                       | 
| 357 | 
            -
                        width = @treebook_open_width
         | 
| 358 | 
            -
                      else
         | 
| 359 | 
            -
                        width = default_treebook_width
         | 
| 360 | 
            -
                      end
         | 
| 374 | 
            +
                      width = treebook_open_width
         | 
| 361 375 | 
             
                    end
         | 
| 362 376 | 
             
                    set_sash_widths(width)
         | 
| 363 377 | 
             
                  end
         | 
| @@ -370,23 +384,12 @@ module Redcar | |
| 370 384 | 
             
                      set_sash_widths(MINIMUM_TREEBOOK_WIDTH)
         | 
| 371 385 | 
             
                    end
         | 
| 372 386 | 
             
                  end
         | 
| 373 | 
            -
             | 
| 374 | 
            -
                  def decrease_treebook_width
         | 
| 375 | 
            -
                    width = treebook_width
         | 
| 376 | 
            -
                    unless width < MINIMUM_TREEBOOK_WIDTH + SASH_WIDTH
         | 
| 377 | 
            -
                      set_sash_widths(width-SASH_WIDTH)
         | 
| 378 | 
            -
                    end
         | 
| 379 | 
            -
                  end
         | 
| 380 | 
            -
             | 
| 381 | 
            -
                  def increase_treebook_width
         | 
| 382 | 
            -
                    set_sash_widths(treebook_width+SASH_WIDTH)
         | 
| 383 | 
            -
                  end
         | 
| 384 | 
            -
             | 
| 387 | 
            +
                  
         | 
| 385 388 | 
             
                  def set_sash_widths(offset)
         | 
| 386 389 | 
             
                    @sash.layout_data.left = Swt::Layout::FormAttachment.new(0, offset)
         | 
| 387 390 | 
             
                    @shell.layout
         | 
| 388 391 | 
             
                  end
         | 
| 389 | 
            -
             | 
| 392 | 
            +
                  
         | 
| 390 393 | 
             
                  def reset_notebook_sash_widths
         | 
| 391 394 | 
             
                    width = (100/@window.notebooks.length).to_i
         | 
| 392 395 | 
             
                    widths = [width]*@window.notebooks.length
         | 
| @@ -58,6 +58,15 @@ RUBY | |
| 58 58 | 
             
                  should_indent(<<RUBY, :line => 1, :indent => 0)
         | 
| 59 59 | 
             
            def foo
         | 
| 60 60 | 
             
              end # should be dedented
         | 
| 61 | 
            +
            RUBY
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
                
         | 
| 64 | 
            +
                it "should ignore blank lines as part of the indentation" do
         | 
| 65 | 
            +
                  should_indent(<<RUBY, :line => 3, :indent => 1)
         | 
| 66 | 
            +
              def foo
         | 
| 67 | 
            +
              end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            def foo
         | 
| 61 70 | 
             
            RUBY
         | 
| 62 71 | 
             
                end
         | 
| 63 72 | 
             
              end
         | 
| @@ -1,4 +1,5 @@ | |
| 1 1 |  | 
| 2 | 
            +
            require 'declarations/commands'
         | 
| 2 3 | 
             
            require 'declarations/completion_source'
         | 
| 3 4 | 
             
            require 'declarations/file'
         | 
| 4 5 | 
             
            require 'declarations/parser'
         | 
| @@ -9,8 +10,17 @@ module Redcar | |
| 9 10 | 
             
              class Declarations
         | 
| 10 11 | 
             
                def self.menus
         | 
| 11 12 | 
             
                  Menu::Builder.build do
         | 
| 13 | 
            +
                    sub_menu "Edit" do
         | 
| 14 | 
            +
                      group :priority => 30 do
         | 
| 15 | 
            +
                        item "Find declaration", :command => Declarations::OpenOutlineViewCommand
         | 
| 16 | 
            +
                      end
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
                    
         | 
| 12 19 | 
             
                    sub_menu "Project" do
         | 
| 13 | 
            -
                       | 
| 20 | 
            +
                      group :priority => 60 do
         | 
| 21 | 
            +
                        item "Go to declaration", :command => Declarations::GoToTagCommand, :priority => 30
         | 
| 22 | 
            +
                        item "Find declaration", :command => Declarations::OpenProjectOutlineViewCommand, :priority => :first
         | 
| 23 | 
            +
                      end
         | 
| 14 24 | 
             
                      sub_menu "Refresh", :priority => 31 do
         | 
| 15 25 | 
             
                        item "Declarations file", :command => Declarations::RebuildTagsCommand
         | 
| 16 26 | 
             
                      end
         | 
| @@ -21,10 +31,14 @@ module Redcar | |
| 21 31 | 
             
                def self.keymaps
         | 
| 22 32 | 
             
                  linwin = Keymap.build("main", [:linux, :windows]) do
         | 
| 23 33 | 
             
                    link "Alt+G", Declarations::GoToTagCommand
         | 
| 34 | 
            +
                    link "Ctrl+I", Declarations::OpenOutlineViewCommand
         | 
| 35 | 
            +
                    link "Ctrl+Shift+I", Declarations::OpenProjectOutlineViewCommand
         | 
| 24 36 | 
             
                  end
         | 
| 25 37 |  | 
| 26 38 | 
             
                  osx = Keymap.build("main", :osx) do
         | 
| 27 39 | 
             
                    link "Ctrl+Alt+G", Declarations::GoToTagCommand
         | 
| 40 | 
            +
                    link "Cmd+I", Declarations::OpenOutlineViewCommand
         | 
| 41 | 
            +
                    link "Cmd+Ctrl+I", Declarations::OpenProjectOutlineViewCommand
         | 
| 28 42 | 
             
                  end
         | 
| 29 43 |  | 
| 30 44 | 
             
                  [linwin, osx]
         | 
| @@ -38,6 +52,20 @@ module Redcar | |
| 38 52 | 
             
                  ::File.join(project.config_dir, 'tags')
         | 
| 39 53 | 
             
                end
         | 
| 40 54 |  | 
| 55 | 
            +
                def self.icon_for_kind(kind)
         | 
| 56 | 
            +
                  h = {
         | 
| 57 | 
            +
                    :method     => :node_insert,
         | 
| 58 | 
            +
                    :class      => :open_source_flipped,
         | 
| 59 | 
            +
                    :attribute  => :status,
         | 
| 60 | 
            +
                    :alias      => :arrow_branch,
         | 
| 61 | 
            +
                    :assignment => :arrow,
         | 
| 62 | 
            +
                    :interface  => :information,
         | 
| 63 | 
            +
                    :closure    => :node_magnifier,
         | 
| 64 | 
            +
                    :none       => nil
         | 
| 65 | 
            +
                  }
         | 
| 66 | 
            +
                  h[kind.to_sym]
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
                  
         | 
| 41 69 | 
             
                class ProjectRefresh < Task
         | 
| 42 70 | 
             
                  def initialize(project)
         | 
| 43 71 | 
             
                    @file_list   = project.file_list
         | 
| @@ -49,7 +77,6 @@ module Redcar | |
| 49 77 | 
             
                  end
         | 
| 50 78 |  | 
| 51 79 | 
             
                  def execute
         | 
| 52 | 
            -
                    return if @project.remote?
         | 
| 53 80 | 
             
                    file = Declarations::File.new(Declarations.file_path(@project))
         | 
| 54 81 | 
             
                    file.update_files(@file_list)
         | 
| 55 82 | 
             
                    file.dump
         | 
| @@ -78,9 +105,9 @@ module Redcar | |
| 78 105 | 
             
                  end
         | 
| 79 106 | 
             
                end
         | 
| 80 107 |  | 
| 81 | 
            -
             | 
| 108 | 
            +
                def self.match_kind(path, regex)
         | 
| 82 109 | 
             
                  Declarations::Parser.new.match_kind(path, regex)
         | 
| 83 | 
            -
             | 
| 110 | 
            +
                end
         | 
| 84 111 |  | 
| 85 112 | 
             
                def self.clear_tags_for_path(path)
         | 
| 86 113 | 
             
                  @tags_for_path ||= {}
         | 
| @@ -93,67 +120,5 @@ module Redcar | |
| 93 120 | 
             
                  regexp = Regexp.new(Regexp.escape(match[:match]))
         | 
| 94 121 | 
             
                  DocumentSearch::FindNextRegex.new(regexp, true).run_in_focussed_tab_edit_view
         | 
| 95 122 | 
             
                end
         | 
| 96 | 
            -
             | 
| 97 | 
            -
                class RebuildTagsCommand < Command
         | 
| 98 | 
            -
                  def execute
         | 
| 99 | 
            -
                    project = Project::Manager.focussed_project
         | 
| 100 | 
            -
                    tags_path = Declarations.file_path(project)
         | 
| 101 | 
            -
                    FileUtils.rm tags_path if ::File.exists? tags_path
         | 
| 102 | 
            -
                    ProjectRefresh.new(project).execute
         | 
| 103 | 
            -
                  end
         | 
| 104 | 
            -
                end
         | 
| 105 | 
            -
                
         | 
| 106 | 
            -
                class GoToTagCommand < EditTabCommand
         | 
| 107 | 
            -
                  sensitize :open_project
         | 
| 108 | 
            -
             | 
| 109 | 
            -
                  def execute
         | 
| 110 | 
            -
                    if Project::Manager.focussed_project.remote?
         | 
| 111 | 
            -
                      Application::Dialog.message_box("Go to declaration doesn't work in remote projects yet :(")
         | 
| 112 | 
            -
                      return
         | 
| 113 | 
            -
                    end
         | 
| 114 | 
            -
             | 
| 115 | 
            -
                    if doc.selection?
         | 
| 116 | 
            -
                      handle_tag(doc.selected_text)
         | 
| 117 | 
            -
                    else
         | 
| 118 | 
            -
                      range = doc.current_word_range
         | 
| 119 | 
            -
                      handle_tag(doc.get_slice(range.first, range.last))
         | 
| 120 | 
            -
                    end
         | 
| 121 | 
            -
                  end
         | 
| 122 | 
            -
             | 
| 123 | 
            -
                  def handle_tag(token = '')
         | 
| 124 | 
            -
                    tags_path = Declarations.file_path(Project::Manager.focussed_project)
         | 
| 125 | 
            -
                    unless ::File.exist?(tags_path)
         | 
| 126 | 
            -
                      Application::Dialog.message_box("The declarations file 'tags' has not been generated yet.")
         | 
| 127 | 
            -
                      return
         | 
| 128 | 
            -
                    end
         | 
| 129 | 
            -
                    matches = find_tag(tags_path, token).uniq
         | 
| 130 | 
            -
                    
         | 
| 131 | 
            -
                    # save current cursor position before jump to another location.
         | 
| 132 | 
            -
                    Redcar.app.navigation_history.save(doc) if matches.size > 0
         | 
| 133 | 
            -
                    
         | 
| 134 | 
            -
                    case matches.size
         | 
| 135 | 
            -
                    when 0
         | 
| 136 | 
            -
                      Application::Dialog.message_box("There is no declaration for '#{token}' in the 'tags' file.")
         | 
| 137 | 
            -
                    when 1
         | 
| 138 | 
            -
                      Redcar::Declarations.go_to_definition(matches.first)
         | 
| 139 | 
            -
                    else
         | 
| 140 | 
            -
                      open_select_tag_dialog(matches)
         | 
| 141 | 
            -
                    end
         | 
| 142 | 
            -
                    
         | 
| 143 | 
            -
                    Redcar.app.navigation_history.save(doc) if matches.size > 0
         | 
| 144 | 
            -
                  end
         | 
| 145 | 
            -
             | 
| 146 | 
            -
                  def find_tag(tags_path, tag)
         | 
| 147 | 
            -
                    Declarations.tags_for_path(tags_path)[tag] || []
         | 
| 148 | 
            -
                  end
         | 
| 149 | 
            -
             | 
| 150 | 
            -
                  def open_select_tag_dialog(matches)
         | 
| 151 | 
            -
                    Declarations::SelectTagDialog.new(matches).open
         | 
| 152 | 
            -
                  end
         | 
| 153 | 
            -
             | 
| 154 | 
            -
                  def log(message)
         | 
| 155 | 
            -
                    puts("==> Ctags: #{message}")
         | 
| 156 | 
            -
                  end
         | 
| 157 | 
            -
                end
         | 
| 158 123 | 
             
              end
         | 
| 159 124 | 
             
            end
         |