org.eclipse.xtext.ui.editor
Interface IDirtyStateManager

All Superinterfaces:
IExternalContentSupport.IExternalContentProvider, IResourceDescription.Event.Source, ISelectable
All Known Implementing Classes:
DirtyStateManager

public interface IDirtyStateManager
extends ISelectable, IExternalContentSupport.IExternalContentProvider, IResourceDescription.Event.Source

An implementation of IDirtyStateManager can be used to register a currently edited resource and listen to changes on those resources.

Author:
Sebastian Zarnekow - Initial contribution and API

Nested Class Summary
static interface IDirtyStateManager.Event
          The IDirtyStateManager will raise specialized events that provide direct type-safe access to the source as IDirtyStateManager.
 
Method Summary
 void announceDirtyStateChanged(IDirtyResource dirtyResource)
          Announce the dirty state of the given resource.
 void discardDirtyState(IDirtyResource dirtyResource)
          Mark the given dirty resource as unmanaged.
 IResourceDescription getDirtyResourceDescription(org.eclipse.emf.common.util.URI uri)
           
 boolean manageDirtyState(IDirtyResource dirtyResource)
          Initially try to manage the given resource and its dirty state.
 
Methods inherited from interface org.eclipse.xtext.resource.ISelectable
getExportedObjects, getExportedObjects, getExportedObjectsByObject, getExportedObjectsByType, isEmpty
 
Methods inherited from interface org.eclipse.xtext.resource.IExternalContentSupport.IExternalContentProvider
getActualContentProvider, getContent, hasContent
 
Methods inherited from interface org.eclipse.xtext.resource.IResourceDescription.Event.Source
addListener, removeListener
 

Method Detail

manageDirtyState

boolean manageDirtyState(IDirtyResource dirtyResource)
Initially try to manage the given resource and its dirty state. True will be returned, if the resource with the given URI was not managed before. However clients are free to call announceDirtyStateChanged(IDirtyResource) even if false was returned. A call to manageDirtyState(IDirtyResource) does not raise any events.

Returns:
true if this resource is the first one that has been registered for its URI

discardDirtyState

void discardDirtyState(IDirtyResource dirtyResource)
Mark the given dirty resource as unmanaged. This method may be called even if manageDirtyState has not been called before. Another dirty resource with the same URI will not become unmanaged. A call to this method will raise an event.

See Also:
announceDirtyStateChanged(IDirtyResource)

announceDirtyStateChanged

void announceDirtyStateChanged(IDirtyResource dirtyResource)
Announce the dirty state of the given resource. Clients should decide on their own when to call this method. The dirty state manager will not refuse any announcement due to incorrect internal state of the resource. Listeners will be notified about the changed dirty state. It is up to the implementor to decide about the actual point in time. Implementations are free to collect various announcement before actually raising an event. Events may be fired in a different thread.


getDirtyResourceDescription

IResourceDescription getDirtyResourceDescription(org.eclipse.emf.common.util.URI uri)