Menu

Commit [r4413]  Maximize  Restore  History

This revision cleans up the code managing the interactions pane,

particularly the updating of the cursor, which was handled abominably
in earlier versions. The key insight in this refactoring is that the
interactions pane is tightly coupled with the interactions document.
In Swing, documents do not include any viewing state, most notably the
cursor position. But in an interactions pane, the position of the
cursor is a critical feature of the document an must be kept updated
by operations on the cdocument (such as console output, e.g.,
System.out, by the interpreter). Since the cursor resides in the
interactions pane, the interactions model must fuse the pane and the
document together. To keep the cursor in synch with all updates to the
interactions document, the refactored code base forces all interactions
document updates to be performed in the event thread. Then model operations
that do not originate with Swing components (such as console output by the
interpreter) can update the cursor before any Swing based updates (e.g.,
keyboard input) happen. In the old code, every document revision fired a
document listener that updated the cursor position in the interactions pane,
possibly from outside the event thread, breaking a critical Swing invariant.
(In particular, console output by the interpreter interspersed with keyboard
input would corrupt Swing/DrJava data structures.

This revision also excises the ConsoleControllerTest since it tested console
behavior (processing keyboard input) that is no longer possible in DrJava;
InteractionsConsoleController now handles all keyboard input. The code tested
by ConsoleControllerTest has also been removed.

The following files were modified:

M src/edu/rice/cs/drjava/DrJavaTestCase.java
M src/edu/rice/cs/drjava/model/DefaultGlobalModel.java
M src/edu/rice/cs/drjava/model/repl/InteractionsDocument.java
M src/edu/rice/cs/drjava/model/repl/InteractionsDocumentTest.java
M src/edu/rice/cs/drjava/model/repl/InteractionsDJDocumentTest.java
M src/edu/rice/cs/drjava/model/repl/InteractionsModel.java
M src/edu/rice/cs/drjava/model/repl/newjvm/InterpreterJVM.java
M src/edu/rice/cs/drjava/model/repl/newjvm/MainJVM.java
M src/edu/rice/cs/drjava/model/repl/DefaultInteractionsModel.java
M src/edu/rice/cs/drjava/model/repl/RMIInteractionsModel.java
M src/edu/rice/cs/drjava/model/repl/SimpleInteractionsModel.java
M src/edu/rice/cs/drjava/model/AbstractDJDocument.java
M src/edu/rice/cs/drjava/model/AbstractGlobalModel.java
M src/edu/rice/cs/drjava/ui/MainFrame.java
M src/edu/rice/cs/drjava/ui/ConsoleController.java
M src/edu/rice/cs/drjava/ui/InteractionsPaneTest.java
M src/edu/rice/cs/drjava/ui/InteractionsController.java
D src/edu/rice/cs/drjava/ui/ConsoleControllerTest.java
M src/edu/rice/cs/drjava/ui/AbstractConsoleController.java
M src/edu/rice/cs/util/text/ConsoleDocument.java

rcartwright 2008-03-23

changed /trunk/drjava/src/edu/rice/cs/drjava/DrJavaTestCase.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/AbstractDJDocument.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/AbstractGlobalModel.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/DefaultGlobalModel.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/DefaultInteractionsModel.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/InteractionsDJDocumentTest.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/InteractionsDocument.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/InteractionsDocumentTest.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/InteractionsModel.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/RMIInteractionsModel.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/SimpleInteractionsModel.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/newjvm/InterpreterJVM.java
changed /trunk/drjava/src/edu/rice/cs/drjava/model/repl/newjvm/MainJVM.java
changed /trunk/drjava/src/edu/rice/cs/drjava/ui/AbstractConsoleController.java
changed /trunk/drjava/src/edu/rice/cs/drjava/ui/ConsoleController.java
removed /trunk/drjava/src/edu/rice/cs/drjava/ui/ConsoleControllerTest.java
changed /trunk/drjava/src/edu/rice/cs/drjava/ui/InteractionsController.java
changed /trunk/drjava/src/edu/rice/cs/drjava/ui/InteractionsPaneTest.java
changed /trunk/drjava/src/edu/rice/cs/drjava/ui/MainFrame.java
changed /trunk/drjava/src/edu/rice/cs/util/text/ConsoleDocument.java
/trunk/drjava/src/edu/rice/cs/drjava/DrJavaTestCase.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/AbstractDJDocument.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/AbstractGlobalModel.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/DefaultGlobalModel.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/DefaultInteractionsModel.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/InteractionsDJDocumentTest.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/InteractionsDocument.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/InteractionsDocumentTest.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/InteractionsModel.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/RMIInteractionsModel.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/SimpleInteractionsModel.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/newjvm/InterpreterJVM.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/model/repl/newjvm/MainJVM.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/ui/AbstractConsoleController.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/ui/ConsoleController.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/ui/InteractionsController.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/ui/InteractionsPaneTest.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/drjava/ui/MainFrame.java Diff Switch to side-by-side view
Loading...
/trunk/drjava/src/edu/rice/cs/util/text/ConsoleDocument.java Diff Switch to side-by-side view
Loading...
MongoDB Logo MongoDB