model
package is responsible for the majority of the logic
and state in DrJava.
It is independent of the presentation, allowing different user interfaces
to be created for the same codebase. The interfaces and classes in this
package maintain the state of all open documents, interface to the compiler
and interaction components, and communicate with the user interface through
public methods and GlobalModelListeners
.
The GlobalModel
is the central point of DrJava, coordinating
all components and communicating with the user interface.
To maintain state, the GlobalModel
keeps a list of the
OpenDefinitionsDocuments
, each of which is responsible for its
own DefinitionsDocument
object and document specific actions
on that object, such as saving and compiling.
The GlobalModel
also provides a set of public methods which
allow it to communicate with the user interface. This gives the
ui
package access to the OpenDefinitionsDocuments
,
compiler, console, and interactions code.
To keep the user interface up-to-date, the GlobalModel
fires
events to all GlobalModelListeners
which have registered with
it. Events are fired after actions which can affect the user interface, such
as the opening, saving, and closing of files, or the starting and ending
of compilation or interaction.
compiler
package provides an interface between the
model
and the available compilers, allowing DrJava to
compile documents and maintain any errors produced as a result.
definitions
package provides the model of the documents
and editor kit, as well as the reducedmodel
package for
lightweight representation of a document for easy parenthesis matching
and similar syntactic features.
repl
package contains the classes used for the
Interactions window, allowing the dynamic execution of Java code
from within DrJava.