Sha256: 7617d7385485a9eff489bb59b599c95db91c712fbf915edf3aa136d821438c42

Contents?: true

Size: 1.24 KB

Versions: 44

Compression:

Stored size: 1.24 KB

Contents

module Redcar
  class ApplicationSWT
    module Dialogs
      class InputDialog < JFace::Dialogs::Dialog
        def initialize(parent_shell, title, message, options={})
          super(parent_shell)
          @title, @message = title, message
          @options = {:password => false, :initial_text => ""}.merge(options)
        end
        
        def password?
          @options[:password]
        end
        
        def initial_text
          @options[:initial_text]
        end
        
        def createDialogArea(parent)
          composite = super(parent)
          
          passwordLabel = Swt::Widgets::Label.new(composite, Swt::SWT::RIGHT)
          passwordLabel.setText(@message)
          
          style = Swt::SWT::SINGLE
          style = style | Swt::SWT::PASSWORD if password?
          @inputField = Swt::Widgets::Text.new(composite, style)
          data = Swt::Layout::GridData.new(Swt::Layout::GridData::FILL_HORIZONTAL)
          @inputField.setLayoutData(data)
          @inputField.setText(initial_text)
          
          getShell.setText(@title)
        end
        
        def value
          @text
        end
        
        def close
          @text = @inputField.getText
          super
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
redcar-0.13 plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.13.5dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.13.4dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.13.3dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.13.2dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.13.1dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-0.12.1 plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.13.0dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-0.12 plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.27dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.26dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.25dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.24dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.23dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.22dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.21dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.20dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.19dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.18dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb
redcar-dev-0.12.17dev plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb