Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to register adapter factory for ResourceMapping?
How to register adapter factory for ResourceMapping? [message #982304] Mon, 12 November 2012 22:32
Tom H is currently offline Tom H
Messages: 136
Registered: July 2009
Senior Member
I have a project which is primarily resource based, with some of the IFolder and IFile with specific object mappings, which are generated ecore EObjects.

The model derives from the opscode chef local repository structure, and looks like this;

chef-repo
chef-repo->cookbooks
chef-repo->cookbooks->cookbookA->recipe1
chef-repo->cookbooks->cookbookA->recipe2
..
chef-repo->cookbooks->cookbookB->recipe1
...
etc


I have some model-wrapper classes like so;

ChefProject(IProject project)->ChefResource
ChefContainer(IContainer container)->ChefResource
ChefCookbook(IFolder folder)->ChefResource
ChefResource(IResource resource)


Where the ChefResource object extends the PlatformObject, and some MappingResource obtains like so;

ChefResourceMapping(Object object)


On opening the project, the resourceChanged listening walks the tree, adding the resource to the model.

I have registered an ChefAdapterFactory for ResourceMapping types which can map back to the resource from the object.

However my AdapterFactory is never consulted, and the ResourceMapping always resolves to a SimpleResourceMapping.

My adapter factory declaration looks like this...
       <extension
            point="org.eclipse.core.runtime.adapters">
         <factory
               adaptableType="ChefResource"
               class="org.limepepper.chefclipse.providers.ChefAdapterFactory">
            <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
            <adapter type="org.eclipse.core.resources.mapping.ResourceMapping"/>
         </factory>


So do I need to register my adpater factory anywhere, in addition to the plugin.xml, or have a missed some typo somewhere?

So when I do something that does a check on a ResourceMapping, the mapped resource returns a class org.eclipse.core.internal.resources.mapping.SimpleResourceMapping rather than my ChefResourceMapping, which would have been returned by the ChefAdapterFactory (had it been consulted by the platform....)

Thanks!
Previous Topic:run multiple instances of "eclipse 4 application project
Next Topic:Migrating plug-ins from Eclipse 3.x to Eclipse 4
Goto Forum:
  


Current Time: Wed Aug 20 04:49:19 EDT 2014

Powered by FUDForum. Page generated in 0.02659 seconds