Package org.eclipse.gef.mvc.fx.ui.parts
Class HistoryBasedDirtyStateProvider
java.lang.Object
org.eclipse.gef.mvc.fx.ui.parts.HistoryBasedDirtyStateProvider
- All Implemented Interfaces:
IDirtyStateProvider
,IDisposable
public class HistoryBasedDirtyStateProvider
extends Object
implements IDirtyStateProvider, IDisposable
A support class to handle the dirty state of a
WorkbenchPart
that
uses an IOperationHistory
and an IUndoContext
.-
Property Summary
PropertiesTypePropertyDescriptionA read-only property that provides the current dirty state. -
Constructor Summary
ConstructorsConstructorDescriptionHistoryBasedDirtyStateProvider
(IOperationHistory operationHistory, IUndoContext undoContext) Creates a newHistoryBasedDirtyStateProvider
. -
Method Summary
Modifier and TypeMethodDescriptionprotected IOperationHistoryListener
Returns theIOperationHistoryListener
that is to be used to update the dirty state of this editor.A read-only property that provides the current dirty state.void
dispose()
protected boolean
isContentsRelated
(IUndoableOperation operation) Tests whether the givenIUndoableOperation
is relevant for the dirty-state of the editor.boolean
isDirty()
Gets the value of the property dirty.void
Notifies the provider to mark the current state as being unchanged with respect to the saved state.
-
Property Details
-
dirty
- Specified by:
dirtyProperty
in interfaceIDirtyStateProvider
- Returns:
- A read-only boolean property.
- See Also:
-
-
Constructor Details
-
HistoryBasedDirtyStateProvider
Creates a newHistoryBasedDirtyStateProvider
.- Parameters:
operationHistory
- TheIOperationHistory
to use.undoContext
- TheIUndoContext
to evaluate.
-
-
Method Details
-
createOperationHistoryListener
Returns theIOperationHistoryListener
that is to be used to update the dirty state of this editor.- Returns:
- The
IOperationHistoryListener
that is to be used to update the dirty state of this editor.
-
dirtyProperty
Description copied from interface:IDirtyStateProvider
A read-only property that provides the current dirty state.- Specified by:
dirtyProperty
in interfaceIDirtyStateProvider
- Returns:
- A read-only boolean property.
- See Also:
-
dispose
public void dispose()- Specified by:
dispose
in interfaceIDisposable
-
isContentsRelated
Tests whether the givenIUndoableOperation
is relevant for the dirty-state of the editor.- Parameters:
operation
- TheIUndoableOperation
to test.- Returns:
true
if the operation encapsulates a dirty-state relevant change,false
otherwise.
-
isDirty
public boolean isDirty()Gets the value of the property dirty.- Specified by:
isDirty
in interfaceIDirtyStateProvider
- Property description:
- Returns:
true
if the source is dirty,false
otherwise.
-
markNonDirty
public void markNonDirty()Description copied from interface:IDirtyStateProvider
Notifies the provider to mark the current state as being unchanged with respect to the saved state.- Specified by:
markNonDirty
in interfaceIDirtyStateProvider
-