| org.eclipse.pde.core.IModel
All known Subclasses: org.eclipse.pde.internal.core.AbstractModel,
IModel | public interface IModel extends IBaseModel(Code) | | A generic model. Classes that implement this interface are expected to be
able to:
- Load from an input stream
- Reload (reset, load, fire 'world change')
- Dispose (clear all the data and reset)
- Be associated with a resource (optional)
If a model is not created from a workspace resource file, its underlying
resource will be null .
since: 2.0 |
Method Summary | |
String | getResourceString(String key) Returns a string found in the resource bundle associated with this model
for the provided key. | long | getTimeStamp() Returns the last modification time stamp. | public IResource | getUnderlyingResource() Returns a workspace resource that this model is created from. | boolean | isInSync() Tests if this model is in sync with the storage object it was loaded
from. | boolean | isLoaded() Tests if this model is loaded and can be used. | public boolean | isReconcilingModel() Returns whether this model needs to react to changes in source and
reconcile them. | public void | load() Loads the model directly from an underlying resource. | public void | load(InputStream source, boolean outOfSync) Loads the model from the provided input stream. | public void | reload(InputStream source, boolean outOfSync) Reload is a version of 'load' operation that has the following steps:
- Reset the model
- Load the model
- Fire "world changed" event
Reload operation is used when a model that is already in use is
invalidated by a change in the underlying buffer or resource. |
getResourceString | String getResourceString(String key)(Code) | | Returns a string found in the resource bundle associated with this model
for the provided key.
Parameters: key - the name to use for bundle lookup the string for the key in the resource bundle, or the key itselfif not found |
getTimeStamp | long getTimeStamp()(Code) | | Returns the last modification time stamp. The model itself does not have
the time stamp. It is 'borrowed' from the underlying physical object.
the time stamp of the underlying physical object. |
getUnderlyingResource | public IResource getUnderlyingResource()(Code) | | Returns a workspace resource that this model is created from. Load/reload
operations are not directly connected with the resource (although they
can be). In some cases, models will load from a buffer (an editor
document) rather than a resource. However, the buffer will eventually be
synced up with this resource.
With the caveat of stepped loading, all other properties of the
underlying resource could be used directly (path, project etc.).
a workspace resource (file) that this model is associated with,or null if the model is not created from aresource. |
isInSync | boolean isInSync()(Code) | | Tests if this model is in sync with the storage object it was loaded
from. Models loaded from resources are in sync if underlying resources
are in sync. Models loaded from files on the file systems are in sync if
the time stamp matches the model time stamp.
true if the model is in sync with the file system. |
isLoaded | boolean isLoaded()(Code) | | Tests if this model is loaded and can be used.
true if the model has been loaded |
isReconcilingModel | public boolean isReconcilingModel()(Code) | | Returns whether this model needs to react to changes in source and
reconcile them. Only model instances used in editors need to perform this
task.
true if this is a reconciling model,false otherwise. |
load | public void load() throws CoreException(Code) | | Loads the model directly from an underlying resource. This method does
nothing if this model has no underlying resource or if there is a buffer
stage between the model and the resource.
throws: CoreException - if errors are encountered during the loading. |
load | public void load(InputStream source, boolean outOfSync) throws CoreException(Code) | | Loads the model from the provided input stream. This method throws a
CoreException if errors are encountered during the loading. Upon
succesful load, 'isLoaded()' should return true .
Parameters: source - an input stream that should be parsed to load the model Parameters: outOfSync - if true, time stamp will not be updated to maintainout-of-sync state of the model. throws: CoreException - if errors are encountered during the loading. |
reload | public void reload(InputStream source, boolean outOfSync) throws CoreException(Code) | | Reload is a version of 'load' operation that has the following steps:
- Reset the model
- Load the model
- Fire "world changed" event
Reload operation is used when a model that is already in use is
invalidated by a change in the underlying buffer or resource. Since we
don't know the extent of the change, the only safe thing to do is to
reparse the buffer to sync up. The event that is subsequently fired
should be used by listeners to discard all caches and/or fully refresh
views that shows any portion of the model.
Parameters: source - an input stream that should be parsed to load the model. Parameters: outOfSync - if true, the timestamp will not be updated to maintainout-of-sync state of the model. throws: CoreException - if errors are encountered during the reloading. |
|
|