Package de.uni_hildesheim.sse.ui
Class BuildModelListener
- java.lang.Object
-
- net.ssehub.easy.dslCore.ui.editors.AbstractModelChangeListener
-
- de.uni_hildesheim.sse.ui.BuildModelListener
-
- All Implemented Interfaces:
IModelListener<Script>,IModelReloadListener<Script>
public class BuildModelListener extends AbstractModelChangeListener implements IModelReloadListener<Script>, IModelListener<Script>
Ade.uni_hildesheim.sse.easy_producer.instantiator.model.buildlangModel.Scriptlistener, which receives notifications about changes of the build model and then forces an update of thede.uni_hildesheim.sse.ui.XtextEditorinstance that is used to edit the corresponding document in which the script is defined. Note that receiving a change notification will also trigger updates of other running editors via thede.uni_hildesheim.sse.dslcore.ui.editors.ModelChangeNotifier.- Author:
- kroeher
-
-
Field Summary
-
Fields inherited from class net.ssehub.easy.dslCore.ui.editors.AbstractModelChangeListener
isListening, underlyingModel, xtextDocument, xtextEditor
-
-
Constructor Summary
Constructors Constructor Description BuildModelListener()Constructs a build model listener that updates a registeredde.uni_hildesheim.sse.ui.XtextEditorinstance if the underlyingde.uni_hildesheim.sse.easy_producer.instantiator.model.buildlangModel.Scriptinstance, which is edited in the registered editor, changes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IModelgetUnderlyingModel(java.net.URI modelFileUri, boolean forceBuild)Returns thede.uni_hildesheim.sse.utils.modelManagement.IModelinstance (an IVML-, VIL-, or VTL-model) based on the URI of theorg.eclipse.core.resources.IResource(the document) currently in use by the editor that is registered to this listener.voidnotifyReloadFailed(Script model)Is called to notify thatmodelwas not successfully reloaded, e.g., due to syntactic or semantic errors.voidnotifyReplaced(Script oldModel, Script newModel)Is called to notify thatoldModelis replaced bynewModel.protected booleanregisterToUnderlyingModel(IModel underlyingModel)Adds this listener to the underlying model in order to receive events if this model changes.voidunregister()Unregisters this listener from the underlying model in order to receive no events about changes of the model anymore.-
Methods inherited from class net.ssehub.easy.dslCore.ui.editors.AbstractModelChangeListener
buildModel, isListening, register, setXtextDocument, updateRegisteredEditor
-
-
-
-
Constructor Detail
-
BuildModelListener
public BuildModelListener()
Constructs a build model listener that updates a registeredde.uni_hildesheim.sse.ui.XtextEditorinstance if the underlyingde.uni_hildesheim.sse.easy_producer.instantiator.model.buildlangModel.Scriptinstance, which is edited in the registered editor, changes.
-
-
Method Detail
-
notifyReplaced
public void notifyReplaced(Script oldModel, Script newModel)
Description copied from interface:IModelListenerIs called to notify thatoldModelis replaced bynewModel. The listener registrations foroldModelwill be adjusted accordingly.
Do not modify the the listeners ofoldModelornewModelduring this method.- Specified by:
notifyReplacedin interfaceIModelListener<Script>- Parameters:
oldModel- the old model being replacednewModel- the new model (the replacement)
-
notifyReloadFailed
public void notifyReloadFailed(Script model)
Description copied from interface:IModelReloadListenerIs called to notify thatmodelwas not successfully reloaded, e.g., due to syntactic or semantic errors. Please note that successful reloads are notified throughIModelListener.- Specified by:
notifyReloadFailedin interfaceIModelReloadListener<Script>- Parameters:
model- the model that was not updated
-
unregister
public void unregister()
Description copied from class:AbstractModelChangeListenerUnregisters this listener from the underlying model in order to receive no events about changes of the model anymore. This method must be called if the registered editor is disposed.- Specified by:
unregisterin classAbstractModelChangeListener
-
registerToUnderlyingModel
protected boolean registerToUnderlyingModel(IModel underlyingModel)
Description copied from class:AbstractModelChangeListenerAdds this listener to the underlying model in order to receive events if this model changes.- Specified by:
registerToUnderlyingModelin classAbstractModelChangeListener- Parameters:
underlyingModel- thede.uni_hildesheim.sse.utils.modelManagement.IModelto which this listener must be registered- Returns:
trueif the registration of this listener to the given mode was successful,falseotherwise
-
getUnderlyingModel
protected IModel getUnderlyingModel(java.net.URI modelFileUri, boolean forceBuild)
Description copied from class:AbstractModelChangeListenerReturns thede.uni_hildesheim.sse.utils.modelManagement.IModelinstance (an IVML-, VIL-, or VTL-model) based on the URI of theorg.eclipse.core.resources.IResource(the document) currently in use by the editor that is registered to this listener. Note that this method will be called internally to retrieve the underlying model.- Specified by:
getUnderlyingModelin classAbstractModelChangeListener- Parameters:
modelFileUri- thejava.net.URIof theorg.eclipse.core.resources.IResource(the document) currently in use by the editor that is registered to this listener.forceBuild-trueif the model should be build if it cannot resolved.falseif no build should be forced.- Returns:
- the
de.uni_hildesheim.sse.utils.modelManagement.IModel(an IVML-, VIL-, or VTL-model) which is currently edited in the registered editor of this listener.
-
-