Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EMF Compare/Specifications/ExtensionPointForAdapterFactories

< EMF Compare
Revision as of 11:07, 4 April 2013 by Axel.richard.obeo.fr (Talk | contribs) (Evolution Specification: Provide an adapter factory extension mechanism)

Evolution Specification: Provide an adapter factory extension mechanism

Current status is DRAFT

Preamble

It enables to provide his own match adapter factory implementation.

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
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.edit
      • org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptorRegistryImpl

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

Back to the top