Class BuildModelListener

  • All Implemented Interfaces:
    IModelListener<Script>, IModelReloadListener<Script>

    public class BuildModelListener
    extends AbstractModelChangeListener
    implements IModelReloadListener<Script>, IModelListener<Script>
    A de.uni_hildesheim.sse.easy_producer.instantiator.model.buildlangModel.Script listener, which receives notifications about changes of the build model and then forces an update of the de.uni_hildesheim.sse.ui.XtextEditor instance 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 the de.uni_hildesheim.sse.dslcore.ui.editors.ModelChangeNotifier.
    Author:
    kroeher
    • Constructor Summary

      Constructors 
      Constructor Description
      BuildModelListener()
      Constructs a build model listener that updates a registered de.uni_hildesheim.sse.ui.XtextEditor instance if the underlying de.uni_hildesheim.sse.easy_producer.instantiator.model.buildlangModel.Script instance, which is edited in the registered editor, changes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected IModel getUnderlyingModel​(java.net.URI modelFileUri, boolean forceBuild)
      Returns the de.uni_hildesheim.sse.utils.modelManagement.IModel instance (an IVML-, VIL-, or VTL-model) based on the URI of the org.eclipse.core.resources.IResource (the document) currently in use by the editor that is registered to this listener.
      void notifyReloadFailed​(Script model)
      Is called to notify that model was not successfully reloaded, e.g., due to syntactic or semantic errors.
      void notifyReplaced​(Script oldModel, Script newModel)
      Is called to notify that oldModel is replaced by newModel.
      protected boolean registerToUnderlyingModel​(IModel underlyingModel)
      Adds this listener to the underlying model in order to receive events if this model changes.
      void unregister()
      Unregisters this listener from the underlying model in order to receive no events about changes of the model anymore.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BuildModelListener

        public BuildModelListener()
        Constructs a build model listener that updates a registered de.uni_hildesheim.sse.ui.XtextEditor instance if the underlying de.uni_hildesheim.sse.easy_producer.instantiator.model.buildlangModel.Script instance, which is edited in the registered editor, changes.
    • Method Detail

      • notifyReplaced

        public void notifyReplaced​(Script oldModel,
                                   Script newModel)
        Description copied from interface: IModelListener
        Is called to notify that oldModel is replaced by newModel. The listener registrations for oldModel will be adjusted accordingly.
        Do not modify the the listeners of oldModel or newModel during this method.
        Specified by:
        notifyReplaced in interface IModelListener<Script>
        Parameters:
        oldModel - the old model being replaced
        newModel - the new model (the replacement)
      • notifyReloadFailed

        public void notifyReloadFailed​(Script model)
        Description copied from interface: IModelReloadListener
        Is called to notify that model was not successfully reloaded, e.g., due to syntactic or semantic errors. Please note that successful reloads are notified through IModelListener.
        Specified by:
        notifyReloadFailed in interface IModelReloadListener<Script>
        Parameters:
        model - the model that was not updated
      • unregister

        public void unregister()
        Description copied from class: AbstractModelChangeListener
        Unregisters 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:
        unregister in class AbstractModelChangeListener
      • registerToUnderlyingModel

        protected boolean registerToUnderlyingModel​(IModel underlyingModel)
        Description copied from class: AbstractModelChangeListener
        Adds this listener to the underlying model in order to receive events if this model changes.
        Specified by:
        registerToUnderlyingModel in class AbstractModelChangeListener
        Parameters:
        underlyingModel - the de.uni_hildesheim.sse.utils.modelManagement.IModel to which this listener must be registered
        Returns:
        true if the registration of this listener to the given mode was successful, false otherwise
      • getUnderlyingModel

        protected IModel getUnderlyingModel​(java.net.URI modelFileUri,
                                            boolean forceBuild)
        Description copied from class: AbstractModelChangeListener
        Returns the de.uni_hildesheim.sse.utils.modelManagement.IModel instance (an IVML-, VIL-, or VTL-model) based on the URI of the org.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:
        getUnderlyingModel in class AbstractModelChangeListener
        Parameters:
        modelFileUri - the java.net.URI of the org.eclipse.core.resources.IResource (the document) currently in use by the editor that is registered to this listener.
        forceBuild - true if the model should be build if it cannot resolved. false if 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.