Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322144 - [doc] Container Manager example outdated
Summary: [doc] Container Manager example outdated
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 trivial (vote)
Target Milestone: SR1   Edit
Assignee: Jan Koehnlein CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-09 10:31 EDT by Karsten Thoms CLA
Modified: 2017-09-19 15:41 EDT (History)
2 users (show)

See Also:
jan: helios+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2010-08-09 10:31:45 EDT
The example code is not compilable:
------------------------------
@Inject
IContainer.Manager containerManager;

public void listVisibleResources(
        Resource myResource, IResourceDescriptions index) {
  IResourceDescription descr = 
        index.getResourceDescription(myResource.getURI());
  for(IContainer visibleContainer: manager.getVisibleContainers(descr)) { 
    for(IResourceDescription visibleResourceDesc:
            visibleContainer.getResourceDescription()) { 
      System.out.println(visibleResourceDesc.getURI());
    }
  }
}
------------------------------

The right code would be:

------------------------------
@Inject
IContainer.Manager containerManager;

	public void listVisibleResources(
	        Resource myResource, IResourceDescriptions index) {
	  IResourceDescription descr = 
	        index.getResourceDescription(myResource.getURI());
	  for(IContainer visibleContainer: containerManager.getVisibleContainers(descr, index)) { 
	    for(IResourceDescription visibleResourceDesc:
	            visibleContainer.getResourceDescriptions()) { 
	      System.out.println(visibleResourceDesc.getURI());
	    }
	  }
	}
Comment 1 Jan Koehnlein CLA 2010-08-12 05:49:18 EDT
Fixed in HEAD.
Comment 2 Karsten Thoms CLA 2017-09-19 15:41:40 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.