Class EMFModelConnector
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.ui.modelconnector.EMFModelConnector
-
- All Implemented Interfaces:
IModelConnector
public class EMFModelConnector extends java.lang.Object implements IModelConnector
Model connector implementation for the default EMF generated model editors.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.ui.IEditorPart
editorPart
protected org.eclipse.core.runtime.ILog
logger
protected org.eclipse.ui.IWorkbenchPage
workbenchPage
-
Constructor Summary
Constructors Constructor Description EMFModelConnector(org.eclipse.ui.IEditorPart editorPart)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addListener(IModelConnectorListener listener)
protected org.eclipse.jface.viewers.TreePath
createTreePath(org.eclipse.ui.IEditorPart editorPart, org.eclipse.emf.ecore.EObject obj)
protected org.eclipse.jface.viewers.ISelection
getCurrentSelection()
org.eclipse.emf.common.notify.Notifier
getNotifier(IModelConnectorTypeEnum modelConnectorTypeEnum)
org.eclipse.ui.IWorkbenchPart
getOwner()
java.util.Collection<org.eclipse.emf.ecore.EObject>
getSelectedEObjects()
Returns the objects currently selected at the adapted model.protected java.util.Collection<org.eclipse.emf.ecore.EObject>
getSelectedEObjects(org.eclipse.jface.viewers.ISelection selection)
void
loadModel(IModelConnectorTypeEnum modelConnectorTypeEnum)
Loads the instance model into the model connector with the given type.protected void
navigateToElements(org.eclipse.ui.IEditorPart editorPart, org.eclipse.jface.viewers.IStructuredSelection selection)
protected org.eclipse.jface.viewers.TreeSelection
prepareSelection(java.lang.Object[] locationObjects)
boolean
removeListener(IModelConnectorListener listener)
void
showLocation(java.lang.Object[] locationObjects)
void
unloadModel()
Unloads the instance model from the model connector.
-
-
-
Method Detail
-
loadModel
public void loadModel(IModelConnectorTypeEnum modelConnectorTypeEnum)
Description copied from interface:IModelConnector
Loads the instance model into the model connector with the given type.- Specified by:
loadModel
in interfaceIModelConnector
- Parameters:
modelConnectorTypeEnum
- The model type which should be loaded.
-
unloadModel
public void unloadModel()
Description copied from interface:IModelConnector
Unloads the instance model from the model connector.- Specified by:
unloadModel
in interfaceIModelConnector
-
showLocation
public void showLocation(java.lang.Object[] locationObjects)
- Specified by:
showLocation
in interfaceIModelConnector
- Parameters:
locationObjects
- Shows the location of these objects inside the specific editor.
-
getNotifier
public org.eclipse.emf.common.notify.Notifier getNotifier(IModelConnectorTypeEnum modelConnectorTypeEnum)
- Specified by:
getNotifier
in interfaceIModelConnector
- Returns:
- A Notifier implementation for the given IModelConnectorType.
-
prepareSelection
protected org.eclipse.jface.viewers.TreeSelection prepareSelection(java.lang.Object[] locationObjects)
-
navigateToElements
protected void navigateToElements(org.eclipse.ui.IEditorPart editorPart, org.eclipse.jface.viewers.IStructuredSelection selection)
-
createTreePath
protected org.eclipse.jface.viewers.TreePath createTreePath(org.eclipse.ui.IEditorPart editorPart, org.eclipse.emf.ecore.EObject obj)
-
getOwner
public org.eclipse.ui.IWorkbenchPart getOwner()
- Specified by:
getOwner
in interfaceIModelConnector
- Returns:
- a workbench part (view, editor) which is the owner of the model adapted by the model connector
-
getSelectedEObjects
public java.util.Collection<org.eclipse.emf.ecore.EObject> getSelectedEObjects()
Description copied from interface:IModelConnector
Returns the objects currently selected at the adapted model. If there are both domain and view model elements in the adapted model, it is expected that the domain model elements are returned.- Specified by:
getSelectedEObjects
in interfaceIModelConnector
- Returns:
- a non-null, but possibly empty collection of model objects
-
getCurrentSelection
protected org.eclipse.jface.viewers.ISelection getCurrentSelection()
-
getSelectedEObjects
protected java.util.Collection<org.eclipse.emf.ecore.EObject> getSelectedEObjects(org.eclipse.jface.viewers.ISelection selection)
-
addListener
public boolean addListener(IModelConnectorListener listener)
-
removeListener
public boolean removeListener(IModelConnectorListener listener)
-
-