edu.rice.cs.drjava.model
Interface ILoadDocuments

All Known Subinterfaces:
GlobalModel, SingleDisplayModel
All Known Implementing Classes:
AbstractGlobalModel, DefaultGlobalModel, DummyGlobalModel, GlobalModelTestCase.TestGlobalModel, TestDocGetter

public interface ILoadDocuments

This interface encapsulates the behavior of a document loader. Components which provide a means to load documents (e.g. from disk, from a stream, from the ether) should implement this interface, rather than the entire GlobalModel. Components which simply need access to documents should use the more general IGetDocuments instead of this interface. TODO: Subdivide GlobalModelListener to target only events generated here. TODO: Simplify signatures to avoid command pattern overhead.

Version:
$Id: ILoadDocuments.java 4314 2008-01-30 00:08:33Z mgricken $
See Also:
GlobalModel, DefaultGlobalModel

Method Summary
 OpenDefinitionsDocument openFile(FileOpenSelector com)
          Open a file and read it into the definitions.
 OpenDefinitionsDocument[] openFiles(FileOpenSelector com)
          Opens multiple files and reads them into the definitions.
 

Method Detail

openFile

OpenDefinitionsDocument openFile(FileOpenSelector com)
                                 throws IOException,
                                        OperationCanceledException,
                                        AlreadyOpenException
Open a file and read it into the definitions. The provided file selector chooses a file, and on a successful open, the fileOpened() event is fired.

Parameters:
com - a command pattern command that selects what file to open
Returns:
The open document, or null if unsuccessful
Throws:
IOException
OperationCanceledException - if the open was canceled
AlreadyOpenException - if the file is already open

openFiles

OpenDefinitionsDocument[] openFiles(FileOpenSelector com)
                                    throws IOException,
                                           OperationCanceledException,
                                           AlreadyOpenException
Opens multiple files and reads them into the definitions. The provided file selector chooses multiple files, and for each successful open, the fileOpened() event is fired. Note that getFile called on the returned OpenDefinitionsDocument is guaranteed to return an absolute path, as this method makes it absolute.

Parameters:
com - a command pattern command that selects which files to open
Returns:
The last opened document, or null if unsuccessful.
Throws:
IOException - if an underlying I/O operation fails
OperationCanceledException - if the open was canceled
AlreadyOpenException - if the file is already open