|Re: Junit Model discoverer [message #693806 is a reply to message #693354]
||Thu, 07 July 2011 08:36
| Nicolas Bros
Registered: July 2009
The discovery framework was improved, and it is now much simpler to write discoverers than with the old framework.|
If you want to migrate the JUnit discoverer to the new framework, you should:
- add a dependency to org.eclipse.modisco.infra.discovery.core (for the discoverer definition) instead of the old org.eclipse.gmt.modisco.infra.discoverymanager, and another dependency to org.eclipse.modisco.infra.discovery.ui for registering the discoverer in the UI
- extend org.eclipse.modisco.infra.discovery.core.AbstractModelDiscoverer<T> instead of DefaultDiscoverer. "T" is the source of the discovery, for example IFile or IProject
- define the discoverer parameters as methods or fields annotated with the "@Parameter" annotations, instead of the old DiscoveryParameter
- implement the methods isApplicableTo and basicDiscoverElement
- in basicDiscoverElement, define a default target with "setDefaultTargetURI", in case the user leaves the target URI blank
- still in basicDiscoverElement, create a Resource with "createTargetModel()", put the discovered elements in it, and call setTargetModel(resource) with this resource.
- remove the code that opens a model browser from the discoverer : this is now handled by the discovery framework
- register the discoverer with the extension point "org.eclipse.modisco.infra.discovery.core.discoverer"
- register the discoverer in the MoDisco context menu with the extension point "org.eclipse.modisco.infra.discovery.ui.discoverer"
- the discovery framework is designed so that the core and UI parts can be separated. So, the discoverer should preferably be put in a "core" plug-in, and the extension that registers it in a "UI" plug-in
The reference documentation for the discovery framework is:
Powered by FUDForum
. Page generated in 0.02995 seconds