Package org.eclipse.ui.texteditor
Class AbstractTextEditor.TextEditorSavable
java.lang.Object
org.eclipse.ui.internal.InternalSaveable
org.eclipse.ui.Saveable
org.eclipse.ui.texteditor.AbstractTextEditor.TextEditorSavable
- All Implemented Interfaces:
IAdaptable
- Enclosing class:
AbstractTextEditor
This text editor's savable.
- Since:
- 3.3
-
Constructor Summary
ConstructorsConstructorDescriptionTextEditorSavable(ITextEditor textEditor) Creates a new savable for this text editor. -
Method Summary
Modifier and TypeMethodDescriptionvoidDisconnects the editor from this savable.voiddoSave(IProgressMonitor monitor) Saves the contents of this saveable.booleanClients must implement equals and hashCode as defined inObject.equals(Object)andObject.hashCode().<T> TgetAdapter(Class<T> adapter) Explicit comment needed to suppress wrong warning caused by http://bugs.sun.com/bugdatabase/view_bug.do?Returns the image descriptor for this saveable.getName()Returns the name of this saveable for display purposes.Returns the tool tip text for this saveable.inthashCode()Clients must implement equals and hashCode as defined inObject.equals(Object)andObject.hashCode().booleanisDirty()Returns whether the contents of this saveable have changed since the last save operation.boolean
-
Constructor Details
-
TextEditorSavable
Creates a new savable for this text editor.- Parameters:
textEditor- the text editor
-
-
Method Details
-
disconnectEditor
public void disconnectEditor()Disconnects the editor from this savable. -
getName
Description copied from class:SaveableReturns the name of this saveable for display purposes. -
getToolTipText
Description copied from class:SaveableReturns the tool tip text for this saveable. This text is used to differentiate between two inputs with the same name. For instance, MyClass.java in folder X and MyClass.java in folder Y. The format of the text varies between input types.- Specified by:
getToolTipTextin classSaveable- Returns:
- the tool tip text; never
null
-
getImageDescriptor
Description copied from class:SaveableReturns the image descriptor for this saveable.- Specified by:
getImageDescriptorin classSaveable- Returns:
- the image descriptor for this model; may be
nullif there is no image
-
doSave
Description copied from class:SaveableSaves the contents of this saveable.If the save is cancelled through user action, or for any other reason, the part should invoke
setCancelledon theIProgressMonitorto inform the caller.This method is long-running; progress and cancellation are provided by the given progress monitor.
- Specified by:
doSavein classSaveable- Parameters:
monitor- the progress monitor- Throws:
CoreException- if the save fails; it is the caller's responsibility to report the failure to the user
-
isDirty
public boolean isDirty()Description copied from class:SaveableReturns whether the contents of this saveable have changed since the last save operation.Note: this method is called frequently, for example by actions to determine their enabled status.
-
supportsBackgroundSave
public boolean supportsBackgroundSave() -
hashCode
public int hashCode()Description copied from class:SaveableClients must implement equals and hashCode as defined inObject.equals(Object)andObject.hashCode(). Two saveables should be equal if their dirty state is shared, and saving one will save the other. If two saveables are equal, their hash codes MUST be the same, and their names, tooltips, and images should be the same because only one of them will be shown when prompting the user to save.IMPORTANT: Implementers should ensure that the hashCode returned is sufficiently unique so as not to collide with hashCodes returned by other implementations. It is suggested that the defining plug-in's ID be used as part of the returned hashCode, as in the following example:
int PRIME = 31; int hash = ...; // compute the "normal" hash code, e.g. based on some identifier unique within the defining plug-in return hash * PRIME + MY_PLUGIN_ID.hashCode(); -
equals
Description copied from class:SaveableClients must implement equals and hashCode as defined inObject.equals(Object)andObject.hashCode(). Two saveables should be equal if their dirty state is shared, and saving one will save the other. If two saveables are equal, their names, tooltips, and images should be the same because only one of them will be shown when prompting the user to save. -
getAdapter
Explicit comment needed to suppress wrong warning caused by http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4848177- Specified by:
getAdapterin interfaceIAdaptable- Overrides:
getAdapterin classSaveable- Type Parameters:
T- the class type- Parameters:
adapter- the adapter class to look up- Returns:
- a object of the given class, or
nullif this object does not have an adapter for the given class - See Also:
-