Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 425457

Summary: Need a way to construct the content type service without knowing service registry.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 5.0   
Target Milestone: 5.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 424866    

Description libing wang CLA 2014-01-10 17:33:03 EST
Please see bug 424866 comment 12, bullet 3.
Comment 1 Mark Macdonald CLA 2014-01-11 14:45:04 EST
I will refactor the ContentTypeRegistry so it can be powered by a flat data structure of hard-coded content type info, if no service registry is provided.
Comment 2 Mark Macdonald CLA 2014-01-13 10:59:19 EST
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=7d0ea3e
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=de56e8a

You can now construct a ContentTypeRegistry without a service registry like this:
> new mContentTypes.ContentTypeRegistry([
>   {	id: "text/plain",
>         name: "Text",
>         extension: ["txt"],
>         imageClass: "file-sprite-text modelDecorationSprite"
>   },
>   {     id: "text/html",
>         "extends": "text/plain",
>         name: "HTML",
>         extension: ["html", "htm"],
>         imageClass: "file-sprite-html modelDecorationSprite"
>   },
>   ...
> ]);

The parameter is an array of ContentType [1] objects.

[1] http://wiki.eclipse.org/Orion/Documentation/Developer_Guide/Plugging_into_the_navigator#The_ContentType_object