public final class EditorModel extends Object
Modifier and Type | Class and Description |
---|---|
static class |
EditorModel.AbstractListener
Base
EditorModel.Listener implementation that does nothing. |
static interface |
EditorModel.Listener
Interface for listeners.
|
Constructor and Description |
---|
EditorModel(Resources resources,
TextSource.Factory textSourceFactory,
AgentCacheState agentCacheState,
FileChangeWatcher fileChangeWatcher)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(EditorModel.Listener listener)
Add a new listener.
|
void |
closeBuffer(Buffer buffer)
Close a buffer.
|
Buffer |
getBufferForFile(File file)
Get the buffer for the given file.
|
Buffer[] |
getBuffers()
Return a copy of the current buffer list.
|
Buffer |
getSelectedBuffer()
Get the currently active buffer.
|
File |
getSelectedPropertiesFile()
Get the currently selected properties.
|
boolean |
isABufferDirty()
Return whether one of our buffers is dirty.
|
boolean |
isBoringFile(File f)
Return whether the given file should be marked as boring.
|
boolean |
isPropertiesFile(File f)
Return whether the given file should be considered to be a grinder
properties file.
|
boolean |
isScriptFile(File f)
Return whether the given file should be considered to be a script
file.
|
boolean |
isSelectedScript(File f)
Return whether the given file is the script file specified in the
currently selected properties file.
|
void |
openWithExternalEditor(File file)
Open the given file with the external file.
|
void |
selectBuffer(Buffer buffer)
Select a buffer.
|
Buffer |
selectBufferForFile(File file)
Select the buffer for the given file.
|
void |
selectNewBuffer()
Select a new buffer.
|
void |
setExternalEditor(File command,
String arguments)
Set the external editor command line.
|
void |
setSelectedPropertiesFile(File selectedProperties)
Set the currently selected properties.
|
public EditorModel(Resources resources, TextSource.Factory textSourceFactory, AgentCacheState agentCacheState, FileChangeWatcher fileChangeWatcher)
resources
- ResourcesImplementation.textSourceFactory
- Factory for TextSource
s.agentCacheState
- Notified when the model updates a file.fileChangeWatcher
- A FileDistribution.public Buffer getSelectedBuffer()
public void selectNewBuffer()
public Buffer selectBufferForFile(File file) throws ConsoleException
file
- The file.ConsoleException
- If a buffer could not be selected for the file.public Buffer getBufferForFile(File file)
file
- The file.null
=> there is no buffer for the file.public Buffer[] getBuffers()
public boolean isABufferDirty()
true
=> a buffer is dirty.public void selectBuffer(Buffer buffer)
buffer
- The buffer.public void closeBuffer(Buffer buffer)
buffer
- The buffer.public File getSelectedPropertiesFile()
public void setSelectedPropertiesFile(File selectedProperties)
selectedProperties
- The selected properties.public void addListener(EditorModel.Listener listener)
listener
- The listener.public boolean isScriptFile(File f)
f
- The file.true
=> its a Python file.public boolean isPropertiesFile(File f)
f
- The file.true
=> its a properties file.public boolean isSelectedScript(File f)
f
- The file.true
=> its the selected script.public boolean isBoringFile(File f)
f
- The file.true
=> its boring.public void openWithExternalEditor(File file) throws ConsoleException
file
- The file.ConsoleException
- If the file could not be opened.public void setExternalEditor(File command, String arguments)
command
- Path to the external editor executable. null
=>
no editor set.arguments
- Arguments to pass to the external editor. Any %f
will be replaced with the absolute path of the file to edit.
If no %f
is found, the file path will be appended
to the end of the command line.Copyright © 2000-2014. All Rights Reserved.