Package org.jetbrains.mps.openapi.model
Class SModelListenerBase
- java.lang.Object
-
- org.jetbrains.mps.openapi.model.SModelListenerBase
-
- All Implemented Interfaces:
SModelListener
public abstract class SModelListenerBase extends Object implements SModelListener
Convenient empty implementation ofSModelListener
-
-
Constructor Summary
Constructors Constructor Description SModelListenerBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
conflictDetected(SModel model)
This event is fired when the storage-memory conflict is detected (== isChanged() && needsReloading()).void
modelAttached(SModel model, SRepository repository)
Fired when a model becomes visible in a repository.void
modelDetached(SModel model, SRepository repository)
Fired when a model is no longer part of a repository, e.g.void
modelLoaded(SModel model, boolean partially)
void
modelReplaced(SModel model)
void
modelSaved(SModel model)
void
modelUnloaded(SModel model)
void
problemsDetected(SModel model, Iterable<SModel.Problem> problems)
This method is called each time a new problem, or a set of problems is discovered.
-
-
-
Method Detail
-
modelLoaded
public void modelLoaded(SModel model, boolean partially)
- Specified by:
modelLoaded
in interfaceSModelListener
-
modelReplaced
public void modelReplaced(SModel model)
- Specified by:
modelReplaced
in interfaceSModelListener
-
modelUnloaded
public void modelUnloaded(SModel model)
- Specified by:
modelUnloaded
in interfaceSModelListener
-
modelSaved
public void modelSaved(SModel model)
- Specified by:
modelSaved
in interfaceSModelListener
-
conflictDetected
public void conflictDetected(SModel model)
Description copied from interface:SModelListener
This event is fired when the storage-memory conflict is detected (== isChanged() && needsReloading()). An IDE can listen to it and give user a way to resolve the conflict by invoking either updateTimestamp(), or reloadFromSource().- Specified by:
conflictDetected
in interfaceSModelListener
-
problemsDetected
public void problemsDetected(SModel model, Iterable<SModel.Problem> problems)
Description copied from interface:SModelListener
This method is called each time a new problem, or a set of problems is discovered.- Specified by:
problemsDetected
in interfaceSModelListener
-
modelAttached
public void modelAttached(SModel model, SRepository repository)
Description copied from interface:SModelListener
Fired when a model becomes visible in a repository. IMPORTANT: it's unspecified whether the model is part of a module the moment this event is fired or not. Do not expectSModel.getModule()
to give meaningful value. This contract may change (i.e. become stricter) in future. NOTE: This is not an event most clients could make use of, as it's technically tricky to attach a listener to a model not yet visible inside a repository, and thus it's more of internal mechanism (i.e. code that instantiates a model may attach a listener to not yet published model and thus get notified). Besides, detached models do not get their listeners automatically discarded, and the listeners get a chance to react to model detach/re-attach sequence with this event.- Specified by:
modelAttached
in interfaceSModelListener
- Parameters:
model
- affected model, nevernull
repository
- repository the model become available at, nevernull
-
modelDetached
public void modelDetached(SModel model, SRepository repository)
Description copied from interface:SModelListener
Fired when a model is no longer part of a repository, e.g. due to removal from module. This event is intended to clean-up listener caches associated with the model and to gracefully unregister other listeners. IMPORTANT: it's unspecified whether the model is part of a module the moment this event is fired or not. Do not expectSModel.getModule()
to give meaningful value. This contract may change (i.e. become stricter) in future. Primary drive force for this event is desire to add model listener only, without a need to listen to module events to find out when the model is no longer available. Note, listeners not unregistered from the model would get notified withSModelListener.modelAttached(SModel, SRepository)
in case detached model is brought back (perhaps, in completely different module and repository).- Specified by:
modelDetached
in interfaceSModelListener
- Parameters:
model
- affected model, nevernull
repository
- repository the model become available at, nevernull
-
-