public abstract class Editor extends Object implements IEditor, IFileLocker, IAbstractFileListener
GROUP_NAME
Constructor and Description |
---|
Editor(IWorkbench workbench,
IEditorProvider provider)
Constructs a new editor object and initializes it.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertOpened()
Checks whether the file was opened in the editor or not.
|
boolean |
canClose(boolean force)
Returns whether the window is ready to close or not.
|
protected boolean |
canModify()
Returns true if the editor can modify the file.
|
protected void |
fileLocked() |
void |
fileLocked(IFileLocker locker) |
void |
fileReleased(IFileLocker locker,
boolean modified) |
protected void |
fileUnlocked() |
IAbstractFile |
getAbstractFile()
Returns the abstract file that was loaded into the editor.
|
IFileInterpreter |
getFileInterpreter()
Returns the assigned file interpreter.
|
IEditorProvider |
getProvider() |
protected Color |
getSavedBackground() |
String |
getTitle()
Gets the title of the window.
|
protected IWorkbench |
getWorkbench() |
protected boolean |
isExternalModified() |
boolean |
isModified()
Returns true when the editor has changed the file and not written the
changes yet.
|
boolean |
isOpen()
Return a flag indicating whether the edior is opened or not.
|
void |
open(IFileInterpreter file) |
void |
save()
This method saves the current opened file.
|
protected void |
setModified(boolean modified)
Set the modified flag that is returned by the isModified method.
|
void |
windowActivated() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialize
getMenuBar, getToolBar, getToolTipText
getComponent, getIcon
public Editor(IWorkbench workbench, IEditorProvider provider)
protected void setModified(boolean modified)
modified
- a flag indicating if the file was changed since the last saveprotected boolean canModify()
protected void assertOpened() throws EditorNotOpenedException
EditorNotOpenedException
- - if the file was not opened in the editor yetprotected IWorkbench getWorkbench()
public void open(IFileInterpreter file) throws EditorNotAcceptedException
EditorNotAcceptedException
public boolean isOpen()
IEditor
public boolean canClose(boolean force)
IChildWindow
canClose
in interface IChildWindow
public IAbstractFile getAbstractFile() throws EditorNotOpenedException
IEditor
getAbstractFile
in interface IEditor
EditorNotOpenedException
- - if the editor was not openedpublic IFileInterpreter getFileInterpreter() throws EditorNotOpenedException
IEditor
getFileInterpreter
in interface IEditor
EditorNotOpenedException
- - if the editor was not openedpublic boolean isModified() throws EditorNotOpenedException
IEditor
isModified
in interface IEditor
EditorNotOpenedException
- - if no file was opened in the editorpublic void save() throws EditorNotOpenedException
IEditor
save
in interface IEditor
EditorNotOpenedException
- - if the editor was not openedpublic IEditorProvider getProvider()
getProvider
in interface IEditor
public String getTitle()
IWindow
protected void fileLocked()
protected void fileUnlocked()
protected Color getSavedBackground()
protected boolean isExternalModified()
public void fileLocked(IFileLocker locker)
fileLocked
in interface IAbstractFileListener
public void fileReleased(IFileLocker locker, boolean modified)
fileReleased
in interface IAbstractFileListener
public void windowActivated()
windowActivated
in interface IChildWindow