protected static class AbstractTextEditor.TextEditorSavable extends Saveable
Constructor and Description |
---|
TextEditorSavable(ITextEditor textEditor)
Creates a new savable for this text editor.
|
Modifier and Type | Method and Description |
---|---|
void |
disconnectEditor()
Disconnects the editor from this savable.
|
void |
doSave(IProgressMonitor monitor)
Saves the contents of this saveable.
|
boolean |
equals(Object obj)
Clients must implement equals and hashCode as defined in
Object.equals(Object) and Object.hashCode() . |
<T> T |
getAdapter(Class<T> adapter)
Explicit comment needed to suppress wrong warning caused by
http://bugs.sun.com/bugdatabase/view_bug.do?
|
ImageDescriptor |
getImageDescriptor()
Returns the image descriptor for this saveable.
|
String |
getName()
Returns the name of this saveable for display purposes.
|
String |
getToolTipText()
Returns the tool tip text for this saveable.
|
int |
hashCode()
Clients must implement equals and hashCode as defined in
Object.equals(Object) and Object.hashCode() . |
boolean |
isDirty()
Returns whether the contents of this saveable have changed since the last
save operation.
|
boolean |
supportsBackgroundSave() |
public TextEditorSavable(ITextEditor textEditor)
textEditor
- the text editorpublic void disconnectEditor()
public String getName()
Saveable
public String getToolTipText()
Saveable
getToolTipText
in class Saveable
null
public ImageDescriptor getImageDescriptor()
Saveable
getImageDescriptor
in class Saveable
null
if there is no imagepublic void doSave(IProgressMonitor monitor) throws CoreException
Saveable
If the save is cancelled through user action, or for any other reason,
the part should invoke setCancelled
on the
IProgressMonitor
to inform the caller.
This method is long-running; progress and cancellation are provided by the given progress monitor.
doSave
in class Saveable
monitor
- the progress monitorCoreException
- if the save fails; it is the caller's responsibility to
report the failure to the userpublic boolean isDirty()
Saveable
Note: this method is called frequently, for example by actions to determine their enabled status.
public boolean supportsBackgroundSave()
public int hashCode()
Saveable
Object.equals(Object)
and Object.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();
public boolean equals(Object obj)
Saveable
Object.equals(Object)
and Object.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.public <T> T getAdapter(Class<T> adapter)
getAdapter
in interface IAdaptable
getAdapter
in class Saveable
adapter
- the adapter class to look upnull
if this object does not
have an adapter for the given classSaveable.getAdapter(java.lang.Class)
Copyright (c) 2000, 2017 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.