Class: Eclipse::Workspace
- Inherits:
-
Object
- Object
- Eclipse::Workspace
- Defined in:
- lib/eclipse/workspace.rb
Instance Attribute Summary collapse
-
#features ⇒ Object
readonly
Returns the value of attribute features.
-
#perspectives ⇒ Object
readonly
Returns the value of attribute perspectives.
-
#plugins ⇒ Object
readonly
Returns the value of attribute plugins.
-
#preferencePage_categories ⇒ Object
readonly
Returns the value of attribute preferencePage_categories.
-
#preferencePages ⇒ Object
readonly
Returns the value of attribute preferencePages.
-
#view_categories ⇒ Object
readonly
Returns the value of attribute view_categories.
-
#views ⇒ Object
readonly
Returns the value of attribute views.
-
#workspace_dir ⇒ Object
readonly
Returns the value of attribute workspace_dir.
Instance Method Summary collapse
-
#initialize(workspace_dir) ⇒ Workspace
constructor
A new instance of Workspace.
- #parse ⇒ Object
- #parse_sub_dirs ⇒ Object
- #parsePluginDir(plugins_dir = File.join(@workspace_dir, "plugins")) ⇒ Object
- #show ⇒ Object
Constructor Details
#initialize(workspace_dir) ⇒ Workspace
Returns a new instance of Workspace.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/eclipse/workspace.rb', line 6 def initialize(workspace_dir) @workspace_dir = workspace_dir @views = Hash.new @view_categories = Hash.new @preferencePages = Hash.new @perspectives = Hash.new @preferencePage_categories = Hash.new @plugins = Hash.new @features = Hash.new end |
Instance Attribute Details
#features ⇒ Object (readonly)
Returns the value of attribute features.
5 6 7 |
# File 'lib/eclipse/workspace.rb', line 5 def features @features end |
#perspectives ⇒ Object (readonly)
Returns the value of attribute perspectives.
5 6 7 |
# File 'lib/eclipse/workspace.rb', line 5 def perspectives @perspectives end |
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
5 6 7 |
# File 'lib/eclipse/workspace.rb', line 5 def plugins @plugins end |
#preferencePage_categories ⇒ Object (readonly)
Returns the value of attribute preferencePage_categories.
5 6 7 |
# File 'lib/eclipse/workspace.rb', line 5 def preferencePage_categories @preferencePage_categories end |
#preferencePages ⇒ Object (readonly)
Returns the value of attribute preferencePages.
5 6 7 |
# File 'lib/eclipse/workspace.rb', line 5 def preferencePages @preferencePages end |
#view_categories ⇒ Object (readonly)
Returns the value of attribute view_categories.
5 6 7 |
# File 'lib/eclipse/workspace.rb', line 5 def view_categories @view_categories end |
#views ⇒ Object (readonly)
Returns the value of attribute views.
5 6 7 |
# File 'lib/eclipse/workspace.rb', line 5 def views @views end |
#workspace_dir ⇒ Object (readonly)
Returns the value of attribute workspace_dir.
5 6 7 |
# File 'lib/eclipse/workspace.rb', line 5 def workspace_dir @workspace_dir end |
Instance Method Details
#parse ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/eclipse/workspace.rb', line 27 def parse isInstallation = false ['plugins', 'features'].each{ |subdir| dir = File.join(@workspace_dir, subdir) if File.directory?(dir) isInstallation = true parsePluginDir(dir) end } parse_sub_dirs unless isInstallation end |
#parse_sub_dirs ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/eclipse/workspace.rb', line 39 def parse_sub_dirs Dir.glob("#{@workspace_dir}/*").each{ |item| proj = File.join(item, '.project') name = nil name = Document.new(File.new(proj).read).root.elements['name'].text if File.exists?(proj) next unless item and File.directory?(item) info = Plugin::Info.new(item) next unless info # ex. we read a feature add_info(info, item) if name and info.symbolicName and name != info.symbolicName puts "Warning: in #{item} the symbolicName (#{info.symbolicName}) of the plugin differs from the project name #{name}" end } show if $VERBOSE end |
#parsePluginDir(plugins_dir = File.join(@workspace_dir, "plugins")) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/eclipse/workspace.rb', line 17 def parsePluginDir(plugins_dir = File.join(@workspace_dir, "plugins")) Dir.glob("#{plugins_dir}/*.jar").each{ |jarname| info = Plugin::Info.new(jarname) next unless info add_info(info, jarname) } show if $VERBOSE end |
#show ⇒ Object
55 56 57 |
# File 'lib/eclipse/workspace.rb', line 55 def show puts "Workspace #{@workspace_dir} with #{@plugins.size} plugins #{@views.size}/#{@view_categories.size} views #{@preferencePages.size}/#{@preferencePage_categories.size} preferencePages #{@perspectives.size} perspectives" end |