For navigating from results of the Query Explorer to an appropriate location in the editor which presents the particular model elements one must double-click the result in the Query Explorer. If the presenting editor is not a default EMF editor then model connectors are needed. As an example consider the MoDisco Browser which provides a more convenient and feature-rich EMF model presentation than the reflective Ecore model editor.
Provide an IAdapterFactory
The model connector concept is lightweight and seamlessly integrates as an adapter. Thus, you have to register a new
IAdapterFactory which creates the connector in your plugin.xml. See the MoDisco integration's plugin.xml.
The adaptableType property specifies the kind of editor being supported by this adapter factory (and thus it is supported by the model connector). Determine the adapter factory with the class property. The children adapter specifies the returning type of the adapter factory. This is the type which your editor is adapted to. In the case of VIATRA the type must always refer to org.eclipse.viatra.query.tooling.ui.queryexplorer.IModelConnector.
Next step is to implement the adapter factory which simply adapts an
IEditorPart to your custom
IModelConnector implementation. See the adapter factory for MoDisco.
The last step is to provide the implementation of the
IModelConnector interface. An abstract
EMFModelConnector base class is available for EMF-based editors. See the model connector for MoDisco.