Skip to content

Commit 2492d5d

Browse files
committed
This revision is the latest attempt to subsume interpreterReplaced under interpreterReady but not all unit tests pass.
The following files were modified, added, or deleted: modified: src/edu/rice/cs/drjava/model/GlobalEventNotifier.java modified: src/edu/rice/cs/drjava/model/GlobalModelIOTest.java modified: src/edu/rice/cs/drjava/model/GlobalModelOtherTest.java modified: src/edu/rice/cs/drjava/model/GlobalModelTestCase.java modified: src/edu/rice/cs/drjava/model/repl/DummyInteractionsListener.java modified: src/edu/rice/cs/drjava/model/repl/InteractionsEventNotifier.java modified: src/edu/rice/cs/drjava/model/repl/InteractionsListener.java modified: src/edu/rice/cs/drjava/model/repl/InteractionsModelCallback.java modified: src/edu/rice/cs/drjava/model/repl/RMIInteractionsModel.java modified: src/edu/rice/cs/drjava/ui/MainFrame.java modified: src/edu/rice/cs/util/text/ConsoleDocument.java
1 parent 11d6d5c commit 2492d5d

11 files changed

Lines changed: 82 additions & 82 deletions

drjava/src/edu/rice/cs/drjava/model/GlobalEventNotifier.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,15 @@ public void interpreterExited(int status) {
403403
finally { _lock.endRead(); }
404404
}
405405

406-
/** Called when the active interpreter is changed.
407-
* @param inProgress Whether the new interpreter is processing an interaction (i.e,. whether an interactionEnded
408-
* event will be fired)
409-
*/
410-
public void interpreterReplaced() {
411-
_lock.startRead();
412-
try { for (GlobalModelListener l : _listeners) { l.interpreterReplaced(); } }
413-
finally { _lock.endRead(); }
414-
}
406+
// /** Called when the active interpreter is changed.
407+
// * @param inProgress Whether the new interpreter is processing an interaction (i.e,. whether an interactionEnded
408+
// * event will be fired)
409+
// */
410+
// public void interpreterReplaced() {
411+
// _lock.startRead();
412+
// try { for (GlobalModelListener l : _listeners) { l.interpreterReplaced(); } }
413+
// finally { _lock.endRead(); }
414+
// }
415415

416416
//-------------------------------- Compiler --------------------------------//
417417

drjava/src/edu/rice/cs/drjava/model/GlobalModelIOTest.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void MultipleFiles() throws BadLocationException {
9595
}
9696

9797
/** Opens several documents and ensures that the array returned by the model is correct and in the right order. */
98-
public void xtestMultipleFilesArray() throws BadLocationException {
98+
public void testMultipleFilesArray() throws BadLocationException {
9999

100100
_log.log("+++Starting testMultipleFilesArray");
101101

@@ -117,7 +117,7 @@ public void xtestMultipleFilesArray() throws BadLocationException {
117117
}
118118

119119
/** Ensures closing documents works correctly. */
120-
public void xtestCloseMultipleFiles() throws BadLocationException {
120+
public void testCloseMultipleFiles() throws BadLocationException {
121121

122122
_log.log("+++Starting testCloseMultipleFiles()");
123123

@@ -144,7 +144,7 @@ public void xtestCloseMultipleFiles() throws BadLocationException {
144144

145145

146146
/** Creates a new document, modifies it, then allows it to be closed, ignoring the changes made. */
147-
public void xtestCloseFileAllowAbandon() throws BadLocationException {
147+
public void testCloseFileAllowAbandon() throws BadLocationException {
148148

149149
_log.log("+++Starting testCloseFileDisallowAbandon");
150150

@@ -168,7 +168,7 @@ public synchronized boolean canAbandonFile(OpenDefinitionsDocument doc) {
168168
}
169169

170170
/** Creates a new document, modifies it, but disallows a call to close it without saving changes. */
171-
public void xtestCloseFileDisallowAbandon() throws BadLocationException {
171+
public void testCloseFileDisallowAbandon() throws BadLocationException {
172172
OpenDefinitionsDocument doc = setupDocument(FOO_TEXT);
173173

174174
TestListener listener = new TestIOListener() {
@@ -188,7 +188,7 @@ public synchronized boolean canAbandonFile(OpenDefinitionsDocument doc) {
188188
}
189189

190190
/** Opens a file. */
191-
public void xtestOpenRealFile() throws BadLocationException, IOException {
191+
public void testOpenRealFile() throws BadLocationException, IOException {
192192

193193
final File tempFile = writeToNewTempFile(BAR_TEXT);
194194
final TestListener listener = new TestFileIOListener(tempFile);
@@ -224,7 +224,7 @@ public void run() {
224224
}
225225

226226
/** Initiates a file open, but cancels. */
227-
public void xtestCancelOpenFile() throws BadLocationException, IOException {
227+
public void testCancelOpenFile() throws BadLocationException, IOException {
228228

229229
_log.log("+++Starting testCancelOpenFile");
230230

@@ -275,7 +275,7 @@ public void run() {
275275
}
276276

277277
/** Attempts to open a non-existent file. */
278-
public void xtestOpenNonexistentFile() throws IOException {
278+
public void testOpenNonexistentFile() throws IOException {
279279

280280
_log.log("+++Starting testOpenNonexistentFile");
281281

@@ -305,7 +305,7 @@ public void xtestOpenNonexistentFile() throws IOException {
305305
}
306306

307307
/** Attempts to reopen an already open file. */
308-
public void xtestReopenFile() throws BadLocationException, IOException {
308+
public void testReopenFile() throws BadLocationException, IOException {
309309

310310
final File tempFile = writeToNewTempFile(BAR_TEXT);
311311
final TestListener listener = new TestFileIOListener(tempFile);
@@ -392,7 +392,7 @@ public void run() {
392392
}
393393

394394
/** Opens multiple files. */
395-
public void xtestOpenMultipleFiles() throws BadLocationException, IOException {
395+
public void testOpenMultipleFiles() throws BadLocationException, IOException {
396396

397397
_log.log("+++Starting testOpenMultipleFiles");
398398
final File tempFile1 = writeToNewTempFile(FOO_TEXT);
@@ -439,7 +439,7 @@ public void fileOpened(OpenDefinitionsDocument doc) {
439439
}
440440

441441
/** Initiates a file open, but cancels. */
442-
public void xtestCancelOpenMultipleFiles() throws BadLocationException, IOException {
442+
public void testCancelOpenMultipleFiles() throws BadLocationException, IOException {
443443

444444
_log.log("+++Starting CancelMultipleOpenFiles");
445445

@@ -495,7 +495,7 @@ public void run() {
495495
}
496496

497497
/** Attempts to open a non-existent file. */
498-
public void xtestOpenMultipleNonexistentFiles() throws IOException {
498+
public void testOpenMultipleNonexistentFiles() throws IOException {
499499

500500
_log.log("+++Starting testOpenMultipleNonexistentFiles");
501501

@@ -522,7 +522,7 @@ public void xtestOpenMultipleNonexistentFiles() throws IOException {
522522
}
523523

524524
/** Error checking for openening multiple files checks for null and an array w/null. */
525-
public void xtestOpenMultipleFilesError() {
525+
public void testOpenMultipleFilesError() {
526526

527527
_log.log("+++Starting testOpenMultipleFilesError");
528528

@@ -554,7 +554,7 @@ public void xtestOpenMultipleFilesError() {
554554
}
555555

556556
/** Force a file to be opened with getDocumentforFile. */
557-
public void xtestForceFileOpen() throws BadLocationException, IOException, OperationCanceledException,
557+
public void testForceFileOpen() throws BadLocationException, IOException, OperationCanceledException,
558558
AlreadyOpenException {
559559

560560
_log.log("+++Starting testForceFileOpen");
@@ -599,7 +599,7 @@ public void run() {
599599
}
600600

601601
/** Attempts to make the first save of a document, but cancels instead. */
602-
public void xtestCancelFirstSave() throws BadLocationException, IOException {
602+
public void testCancelFirstSave() throws BadLocationException, IOException {
603603

604604
_log.log("+++Starting testCancelFirstSave");
605605

@@ -618,7 +618,7 @@ public void xtestCancelFirstSave() throws BadLocationException, IOException {
618618
}
619619

620620
/** Makes a first save of the current document. */
621-
public void xtestRealSaveFirstSave() throws BadLocationException, IOException {
621+
public void testRealSaveFirstSave() throws BadLocationException, IOException {
622622

623623
_log.log("+++Starting testRealSaveFirstSave");
624624

@@ -650,7 +650,7 @@ public void fileSaved(OpenDefinitionsDocument doc) {
650650
}
651651

652652
/** Makes a first save-copy of the current document, ensures that it's still modified. */
653-
public void xtestRealSaveFirstSaveCopy() throws BadLocationException, IOException {
653+
public void testRealSaveFirstSaveCopy() throws BadLocationException, IOException {
654654
_log.log("+++Starting testRealSaveFirstSaveCopy");
655655
OpenDefinitionsDocument doc = setupDocument(FOO_TEXT);
656656
final File file = tempFile();
@@ -680,7 +680,7 @@ public void fileSaved(OpenDefinitionsDocument doc) {
680680
}
681681

682682
/** Saves a file already saved and overwrites its contents. */
683-
public void xtestSaveAlreadySavedAndOverwrite() throws Exception {
683+
public void testSaveAlreadySavedAndOverwrite() throws Exception {
684684
_log.log("+++Starting testSaveAlreadySavedAndOverwrite");
685685

686686
//disable file backups, remember original setting
@@ -778,7 +778,7 @@ public void fileSaved(OpenDefinitionsDocument doc) {
778778
* to cancel if we are asked for a new file name. Confirms that no cancellation happens (since the
779779
* file is already saved.
780780
*/
781-
public void xtestSaveAlreadySaved() throws BadLocationException, IOException {
781+
public void testSaveAlreadySaved() throws BadLocationException, IOException {
782782

783783
_log.log("+++Starting testCancelSaveAlreadySaved");
784784

@@ -838,7 +838,7 @@ public void fileSaved(OpenDefinitionsDocument doc) {
838838
// /* Consolidation of testCancelSaveAsAlreadySaved */
839839

840840
/** Make sure that saveAs doesn't save if we cancel! */
841-
public void xtestCancelSaveAsAlreadySaved() throws BadLocationException, IOException {
841+
public void testCancelSaveAsAlreadySaved() throws BadLocationException, IOException {
842842

843843
_log.log("+++Starting testCancelSaveAsAlreadySaved");
844844

@@ -876,7 +876,7 @@ public void xtestCancelSaveAsAlreadySaved() throws BadLocationException, IOExcep
876876
}
877877

878878
/** Comprehensive test of the "Save As" command */
879-
public void xtestSaveAs() throws BadLocationException, IOException {
879+
public void testSaveAs() throws BadLocationException, IOException {
880880

881881
_log.log("+++Starting testSaveAs");
882882

@@ -924,7 +924,7 @@ public void fileSaved(OpenDefinitionsDocument doc) {
924924

925925
/* Consolidatingvoid testSaveAsExistsAndOverwrite */
926926

927-
public void xtestSaveAsExists() throws BadLocationException, IOException {
927+
public void testSaveAsExists() throws BadLocationException, IOException {
928928

929929
{ /* Bracket former testSaveAsExists() */
930930

@@ -1022,7 +1022,7 @@ public void run() {
10221022

10231023

10241024
/** Forces a file to be opened with getDocumentforFile. */
1025-
public void xtestRevertFile() throws BadLocationException, IOException, OperationCanceledException,
1025+
public void testRevertFile() throws BadLocationException, IOException, OperationCanceledException,
10261026
AlreadyOpenException {
10271027

10281028
_log.log("+++Starting testRevertFile");
@@ -1058,7 +1058,7 @@ public void xtestRevertFile() throws BadLocationException, IOException, Operatio
10581058
}
10591059

10601060

1061-
public void xtestModifiedByOther() throws BadLocationException, IOException, OperationCanceledException,
1061+
public void testModifiedByOther() throws BadLocationException, IOException, OperationCanceledException,
10621062
AlreadyOpenException, InterruptedException {
10631063

10641064
_log.log("+++Starting testModifiedByOther");
@@ -1105,7 +1105,7 @@ public synchronized boolean shouldRevertFile(OpenDefinitionsDocument doc) {
11051105
_log.log("+++Completing testModifiedByOther");
11061106
}
11071107

1108-
public void xtestModifiedByOtherFalse() throws BadLocationException, IOException, OperationCanceledException,
1108+
public void testModifiedByOtherFalse() throws BadLocationException, IOException, OperationCanceledException,
11091109
AlreadyOpenException, InterruptedException {
11101110

11111111
_log.log("+++Starting testModifiedByOtherFalse");
@@ -1286,7 +1286,7 @@ public void run() {
12861286
/** Test for the possibility that the file has been moved or deleted
12871287
* since it was last referenced
12881288
*/
1289-
public void xtestFileMovedWhenTriedToSave() throws BadLocationException, IOException {
1289+
public void testFileMovedWhenTriedToSave() throws BadLocationException, IOException {
12901290

12911291
final OpenDefinitionsDocument doc = setupDocument(FOO_TEXT);
12921292
final File file = tempFile();
@@ -1319,7 +1319,7 @@ public void run() {
13191319
}
13201320

13211321
/** Tests that input can be written to and read from the console correctly. */
1322-
public void xtestConsoleInput() throws EditDocumentException {
1322+
public void testConsoleInput() throws EditDocumentException {
13231323
_log.log("+++Starting testConsoleInput+++");
13241324
_model.getInteractionsModel().setInputListener(new InputListener() {
13251325
int n = 0;

drjava/src/edu/rice/cs/drjava/model/GlobalModelOtherTest.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,13 @@ public void testInteractionsLiveUpdateClassPath() throws BadLocationException, E
542542
// Need to patch code to replace interpreter
543543
public void xtestReplaceInterpreter() {
544544

545-
_log.log("Starting testReplaceInterpreters");
546-
TestListener listener = new TestListener() {
547-
public void interpreterReplaced() {
548-
// assertTrue("should not be in progress", !inProgress);
549-
interpreterReplacedCount++;
550-
}
551-
};
545+
_log.log("Starting testReplaceInterpreter");
546+
TestListener listener = new TestListener(); // {
547+
// public void interpreterReplaced() {
548+
//// assertTrue("should not be in progress", !inProgress);
549+
// interpreterReplacedCount++;
550+
// }
551+
// };
552552
_model.addListener(listener);
553553

554554
final DefaultInteractionsModel dim = _model.getInteractionsModel();
@@ -564,15 +564,14 @@ public void run() {
564564
});
565565

566566
// Utilities.clearEventQueue();
567-
listener.assertInterpreterChangedCount(1);
567+
// listener.assertInterpreterChangedCount(1);
568568
_model.removeListener(listener);
569569

570570
_log.log("testReplaceInterpreter completed");
571571
debug.logEnd();
572572
}
573573

574574
public void testRunMainMethod() throws Exception {
575-
// debug.logStart();
576575

577576
_log.log("Starting testRunMainMethod");
578577
File dir = makeCanonical(new File(_tempDir, "bar"));
@@ -603,7 +602,6 @@ public void run() {
603602
// Killing time here; Slave JVM may not have released Foo.class so that the file can be deleted on Windows.
604603

605604
_log.log("Starting testRunMainMethod completed");
606-
// debug.logEnd();
607605
}
608606

609607
public void testBookmark() throws Exception {

drjava/src/edu/rice/cs/drjava/model/GlobalModelTestCase.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ public static class TestListener implements GlobalModelListener {
627627
protected volatile int interpreterReadyCount;
628628
protected volatile int interpreterExitedCount;
629629
protected volatile int interpreterResetFailedCount;
630-
protected volatile int interpreterReplacedCount;
630+
// protected volatile int interpreterReplacedCount;
631631
//protected int interactionCaretPositionChangedCount;
632632
protected volatile int consoleResetCount;
633633
protected volatile int saveBeforeCompileCount;
@@ -670,7 +670,7 @@ public synchronized void resetCounts() {
670670
interactionStartCount = 0;
671671
interactionEndCount = 0;
672672
interactionErrorCount = 0;
673-
interpreterReplacedCount = 0;
673+
// interpreterReplacedCount = 0;
674674
//interactionCaretPositionChangedCount = 0;
675675
consoleResetCount = 0;
676676
interpreterResettingCount = 0;
@@ -771,9 +771,9 @@ public void assertInteractionErrorCount(int i) {
771771
assertEquals("number of times interactionError fired", i, interactionErrorCount );
772772
}
773773

774-
public void assertInterpreterChangedCount(int i) {
775-
assertEquals("number of times interpreterReplaced fired", i, interpreterReplacedCount);
776-
}
774+
// public void assertInterpreterChangedCount(int i) {
775+
// assertEquals("number of times interpreterReplaced fired", i, interpreterReplacedCount);
776+
// }
777777

778778
// /** Not used */
779779
// public void assertInteractionCaretPositionChangedCount(int i) {
@@ -921,7 +921,7 @@ public void interpreterResetting() {
921921
listenerFail("interpreterResetting fired unexpectedly");
922922
}
923923

924-
public void interpreterReplaced() { listenerFail("interpreterReplaced fired unexpectedly"); }
924+
// public void interpreterReplaced() { listenerFail("interpreterReplaced fired unexpectedly"); }
925925
public void interpreterReady() { listenerFail("interpreterReady() fired unexpectedly"); }
926926
// public void interpreterReady(File wd) { listenerFail("interpreterReady(File wd) fired unexpectedly"); }
927927
public void interpreterExited(int status) {
@@ -1120,7 +1120,7 @@ public void checkCompileOccurred() {
11201120
}
11211121

11221122
/* These overrides were added in DrScala to address the fact that the Scala interpreter reset function is broken. */
1123-
public void interpreterReplaced() { /* DrScala uses replace instead of reset */ }
1123+
// public void interpreterReplaced() { /* DrScala uses replace instead of reset */ }
11241124
public void interpreterReady() { /* DrScala may use replace instead of hard reset */ }
11251125
}
11261126

@@ -1186,7 +1186,7 @@ public void checkCompileOccurred() {
11861186
}
11871187

11881188
/* These overrides were added in DrScala to address the fact that the Scala interpreter reset function is broken. */
1189-
public void interpreterReplaced() { /* DrScala may use replace instead of reset */ }
1189+
// public void interpreterReplaced() { /* DrScala may use replace instead of reset */ }
11901190
public void interpreterReady() { /* DrScala may use replace instead of hard reset */ }
11911191

11921192
}

drjava/src/edu/rice/cs/drjava/model/repl/DummyInteractionsListener.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ public void interpreterExited(int status) { }
7979
/** Called if the interpreter reset failed. (Subclasses must maintain listeners.) */
8080
public void interpreterResetFailed(Throwable t) { }
8181

82-
/** Called when the active interpreter is changed.
83-
* @param inProgress Whether the new interpreter is currently processing an interaction (i.e. whether an
84-
* interactionEnded event will be fired)
85-
*/
86-
public void interpreterReplaced() { }
82+
// /** Called when the active interpreter is changed.
83+
// * @param inProgress Whether the new interpreter is currently processing an interaction (i.e. whether an
84+
// * interactionEnded event will be fired)
85+
// */
86+
// public void interpreterReplaced() { }
8787

8888
/** Called when enter was typed in the interactions pane but the interaction was incomplete. */
8989
public void interactionIncomplete() { }

0 commit comments

Comments
 (0)