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.IEditorParteditorPartprotected org.eclipse.core.runtime.ILogloggerprotected org.eclipse.ui.IWorkbenchPageworkbenchPage
-
Constructor Summary
Constructors Constructor Description EMFModelConnector(org.eclipse.ui.IEditorPart editorPart)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddListener(IModelConnectorListener listener)protected org.eclipse.jface.viewers.TreePathcreateTreePath(org.eclipse.ui.IEditorPart editorPart, org.eclipse.emf.ecore.EObject obj)protected org.eclipse.jface.viewers.ISelectiongetCurrentSelection()org.eclipse.emf.common.notify.NotifiergetNotifier(IModelConnectorTypeEnum modelConnectorTypeEnum)org.eclipse.ui.IWorkbenchPartgetOwner()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)voidloadModel(IModelConnectorTypeEnum modelConnectorTypeEnum)Loads the instance model into the model connector with the given type.protected voidnavigateToElements(org.eclipse.ui.IEditorPart editorPart, org.eclipse.jface.viewers.IStructuredSelection selection)protected org.eclipse.jface.viewers.TreeSelectionprepareSelection(java.lang.Object[] locationObjects)booleanremoveListener(IModelConnectorListener listener)voidshowLocation(java.lang.Object[] locationObjects)voidunloadModel()Unloads the instance model from the model connector.
-
-
-
Method Detail
-
loadModel
public void loadModel(IModelConnectorTypeEnum modelConnectorTypeEnum)
Description copied from interface:IModelConnectorLoads the instance model into the model connector with the given type.- Specified by:
loadModelin interfaceIModelConnector- Parameters:
modelConnectorTypeEnum- The model type which should be loaded.
-
unloadModel
public void unloadModel()
Description copied from interface:IModelConnectorUnloads the instance model from the model connector.- Specified by:
unloadModelin interfaceIModelConnector
-
showLocation
public void showLocation(java.lang.Object[] locationObjects)
- Specified by:
showLocationin 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:
getNotifierin 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:
getOwnerin 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:IModelConnectorReturns 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:
getSelectedEObjectsin 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)
-
-