Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EMF Compare/Specifications/ExtensionPointForAdapterFactories"
(→Preamble) |
(→Evolution Specification: Provide an adapter factory extension mechanism) |
||
Line 18: | Line 18: | ||
The aim is to provide a mechanism that allow users to provide their own adapter factory with a specific rank. | The aim is to provide a mechanism that allow users to provide their own adapter factory with a specific rank. | ||
− | The | + | The AdapterFactory interface will be extended in order to manage ranking. |
− | + | ||
The new extended AdapterFactory that the users will have to implement will be named RankedAdapterFactory. | The new extended AdapterFactory that the users will have to implement will be named RankedAdapterFactory. | ||
− | The | + | The ComposedAdapterFactory will interrogate first the newly created emf compare adapter factory registry (composed of RankedAdapterFactories) to find an appropriate RankedAdapterFactory. |
− | If no appropriate adapter factory is found, then | + | If no appropriate adapter factory is found in the first registry, then registry will delegate his research to the "default" ComposedAdapterFactory registry. |
− | With this mechanism you will able to provide your own CompareItemProviderAdapterFactory that will overrides the default CompareItemProviderAdapterFactory. | + | With this mechanism you will able to provide, for example, your own CompareItemProviderAdapterFactory that will overrides the default CompareItemProviderAdapterFactory, in order to customize the labels of the emf compare metamodel elements. Another use case you will be able to provide, is to extends the EcoreItemProviderAdapterFactory, in order to customize the labels of the ecore metamodel elements. |
== Backward Compatibility and Migration Paths == | == Backward Compatibility and Migration Paths == | ||
Line 58: | Line 57: | ||
</extension> | </extension> | ||
</source> | </source> | ||
− | |||
− | |||
− | |||
− | |||
* New interfaces: | * New interfaces: | ||
Line 74: | Line 69: | ||
} | } | ||
</source> | </source> | ||
− | *** org.eclipse.emf.compare.internal.adapterfactory. | + | *** org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor |
− | *** org.eclipse.emf.compare.internal.adapterfactory. | + | *** org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor.Registry |
<source lang="java"> | <source lang="java"> | ||
− | public interface | + | public interface RankedAdapterFactoryDescriptor extends ComposedAdapterFactory.Descriptor { |
int getRanking(); | int getRanking(); | ||
Line 86: | Line 81: | ||
} | } | ||
</source> | </source> | ||
+ | |||
+ | *New implementations: | ||
+ | ** org.eclipse.emf.compare.rcp | ||
+ | *** org.eclipse.emf.compare.rcp.internal.adapterfactory.RankedAdapterFactoryDescriptorImpl | ||
+ | |||
+ | ** org.eclipse.emf.compare.edit | ||
+ | *** org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptorRegistryImpl | ||
=== User Interface Changes === | === User Interface Changes === | ||
Line 96: | Line 98: | ||
*New and Noteworthy | *New and Noteworthy | ||
*Developer Guide | *Developer Guide | ||
+ | |||
+ | == Example of use == | ||
+ | |||
+ | |||
== Tests and Non-regression strategy == | == Tests and Non-regression strategy == |
Revision as of 11:07, 4 April 2013
Contents
Evolution Specification: Provide an adapter factory extension mechanism
Current status is DRAFT
Preamble
It enables to provide his own match adapter factory implementation.
- Bug 404274 - Provide an adapter factory extension mechanism
- Review 11551
Introduction
There is no actual mechanism to provide his own adapter factory. An extension point mechanism will be useful to allow users to provide their own adapter factories.
Detailed Specification
The aim is to provide a mechanism that allow users to provide their own adapter factory with a specific rank.
The AdapterFactory interface will be extended in order to manage ranking. The new extended AdapterFactory that the users will have to implement will be named RankedAdapterFactory.
The ComposedAdapterFactory will interrogate first the newly created emf compare adapter factory registry (composed of RankedAdapterFactories) to find an appropriate RankedAdapterFactory. If no appropriate adapter factory is found in the first registry, then registry will delegate his research to the "default" ComposedAdapterFactory registry.
With this mechanism you will able to provide, for example, your own CompareItemProviderAdapterFactory that will overrides the default CompareItemProviderAdapterFactory, in order to customize the labels of the emf compare metamodel elements. Another use case you will be able to provide, is to extends the EcoreItemProviderAdapterFactory, in order to customize the labels of the ecore metamodel elements.
Backward Compatibility and Migration Paths
Metamodel Changes
N/A
API Changes
- New extension point:
- org.eclipse.emf.compare.edit
<extension-point id="adapterFactory" name="EMF Compare Adapter Factory" schema="schema/adapterFactory.exsd"/>
Example of use:
<extension point="org.eclipse.emf.compare.edit.adapterFactory"> <factory uri="http://www.eclipse.org/emf/compare" class="org.eclipse.emf.compare.test.adapterfactory.MyCompareItemProviderAdapterFactorySpec" ranking="10" supportedTypes= "org.eclipse.emf.edit.provider.IEditingDomainItemProvider org.eclipse.emf.edit.provider.IStructuredItemContentProvider org.eclipse.emf.edit.provider.ITreeItemContentProvider org.eclipse.emf.edit.provider.IItemLabelProvider org.eclipse.emf.edit.provider.IItemPropertySource org.eclipse.emf.compare.provider.IItemStyledLabelProvider org.eclipse.emf.compare.provider.IItemDescriptionProvider"/> </extension>
- New interfaces:
- org.eclipse.emf.compare.edit
- org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactory
- org.eclipse.emf.compare.edit
public interface RankedAdapterFactory extends AdapterFactory { int getRanking(); void setRanking(int ranking); }
- org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor
- org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor.Registry
public interface RankedAdapterFactoryDescriptor extends ComposedAdapterFactory.Descriptor { int getRanking(); interface Registry extends ComposedAdapterFactory.Descriptor.Registry { } }
- New implementations:
- org.eclipse.emf.compare.rcp
- org.eclipse.emf.compare.rcp.internal.adapterfactory.RankedAdapterFactoryDescriptorImpl
- org.eclipse.emf.compare.rcp
- org.eclipse.emf.compare.edit
- org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptorRegistryImpl
- org.eclipse.emf.compare.edit
User Interface Changes
N/A
Documentation Changes
This documentation will have to be updated:
- New and Noteworthy
- Developer Guide
Example of use
Tests and Non-regression strategy
JUnit tests: EMFCompareAdapterFactoryTest.java in o.e.e.c.tests.
Implementation choices and tradeoffs
N/A