Skip to content

Commit 6063e98

Browse files
author
rcartwright
committed
This revision contains some minor code cleanup such as statically
importing the OptionConstants class. The following files were modified: M drjava/lib/platform.jar M drjava/src/edu/rice/cs/drjava/model/repl/newjvm/NewJVMTest.java M drjava/src/edu/rice/cs/drjava/model/GlobalModelCompileErrorsTest.java M drjava/src/edu/rice/cs/drjava/model/GlobalModelListener.java M drjava/src/edu/rice/cs/drjava/model/compiler/DefaultCompilerModel.java M drjava/src/edu/rice/cs/drjava/model/AbstractGlobalModel.java M drjava/src/edu/rice/cs/drjava/model/GlobalModelTestCase.java M drjava/src/edu/rice/cs/drjava/config/OptionConstants.java M drjava/src/edu/rice/cs/drjava/ui/config/ConfigFrame.java git-svn-id: file:///tmp/test-svn/branches/drscala@5573 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent f40b467 commit 6063e98

9 files changed

Lines changed: 210 additions & 222 deletions

File tree

drjava/lib/platform.jar

120 Bytes
Binary file not shown.

drjava/src/edu/rice/cs/drjava/config/OptionConstants.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,30 +1470,25 @@ public static ArrayList<String> evaluate() {
14701470
public static final BooleanOption SHOW_PATH_WARNINGS =
14711471
new BooleanOption("show.path.warnings", Boolean.FALSE);
14721472

1473-
/**
1474-
* Default compiler to use
1475-
* Stores the name of the compiler to use, set by changing the selection in
1476-
* the ForcedChoiceOption created by COMPILER_PREFERENCE_CONTROL.evaluate()
1477-
*/
1473+
/** Default compiler to use
1474+
* Stores the name of the compiler to use, set by changing the selection in
1475+
* the ForcedChoiceOption created by COMPILER_PREFERENCE_CONTROL.evaluate()
1476+
*/
14781477
public static final StringOption DEFAULT_COMPILER_PREFERENCE =
14791478
new StringOption("default.compiler.preference", COMPILER_PREFERENCE_CONTROL.SCALA); // NO_PREFERENCE in DrJava
14801479

1481-
/**
1482-
* Class that is used to dynamically populate the ForcedChoiceOption.
1483-
* setList method is used by DefaultCompilerModel to set the available
1484-
* compilers that it has
1485-
* Must store the selected name into DEFAULT_COMPILER_PREFERENCE to save the setting
1486-
*/
1480+
/** Class that is used to dynamically populate the ForcedChoiceOption.
1481+
* setList method is used by DefaultCompilerModel to set the available compilers that it has
1482+
* Must store the selected name into DEFAULT_COMPILER_PREFERENCE to save the setting
1483+
*/
14871484
public static final class COMPILER_PREFERENCE_CONTROL {
14881485
public static final String NO_PREFERENCE = "No Preference";
14891486
public static final String SCALA = "Scala version 2.9";
14901487
public static ArrayList<String> _list = new ArrayList<String>();
14911488

14921489
public static void setList(ArrayList<String> list) { _list = list; }
14931490
public static ForcedChoiceOption evaluate() {
1494-
if (! _list.contains(NO_PREFERENCE)) {
1495-
_list.add(NO_PREFERENCE);
1496-
}
1491+
if (! _list.contains(NO_PREFERENCE)) _list.add(NO_PREFERENCE);
14971492

14981493
ForcedChoiceOption fco;
14991494
String defaultC = edu.rice.cs.drjava.DrJava.getConfig().getSetting(DEFAULT_COMPILER_PREFERENCE);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,6 +3030,7 @@ public boolean inNewProjectPath(File projRoot) {
30303030
/** @return true if this has a legal source file name for the currently active compiler */
30313031
public boolean isSourceFile() {
30323032
if (isUntitled()) return false; // assert _file != null
3033+
// System.err.println("In " + this + " the active compiler is " + getCompilerModel().getActiveCompiler());
30333034
return getCompilerModel().getActiveCompiler().isSourceFileForThisCompiler(_file);
30343035
}
30353036

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1919
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2020
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21-
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21+
// * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2222
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2323
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2424
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
@@ -78,7 +78,7 @@ public final class GlobalModelCompileErrorsTest extends GlobalModelTestCase {
7878
" /**\n" +
7979
" * Some shared storage, an instance variable.\n" +
8080
" */\n" +
81-
" var shared = 5;\n" +
81+
" var shared = 5\n" +
8282
" \n" +
8383
" /**\n" +
8484
" * a sample method. This method has no parameters\n" +
@@ -124,7 +124,7 @@ private String _name() {
124124
public void testCompileAllFailsDifferentSourceRoots() throws BadLocationException, IOException, InterruptedException {
125125
debug.logStart();
126126

127-
_log.log("Starting testCompileAllFailsDifferentSourceRoots");
127+
System.err.println("Starting testCompileAllFailsDifferentSourceRoots");
128128

129129
File aDir = new File(_tempDir, "a");
130130
File bDir = new File(_tempDir, "b");
@@ -161,7 +161,7 @@ public void testCompileAllFailsDifferentSourceRoots() throws BadLocationExceptio
161161
assertEquals(_name() + "Class file exists after failing compile (2)", false, compiled2.exists());
162162
_model.removeListener(listener);
163163

164-
_log.log("testCompileAllFailsDifferentSourceRoots completed");
164+
System.err.println("testCompileAllFailsDifferentSourceRoots completed");
165165

166166
debug.logEnd();
167167
}
@@ -172,7 +172,7 @@ public void testCompileAllFailsDifferentSourceRoots() throws BadLocationExceptio
172172
public void testCompilePackageAsField() throws BadLocationException, IOException, InterruptedException {
173173
debug.logStart();
174174

175-
_log.log("Starting testCompilePackageAsField");
175+
System.err.println("Starting testCompilePackageAsField");
176176

177177
OpenDefinitionsDocument doc = setupDocument(FOO_PACKAGE_AS_FIELD);
178178
final File file = tempFile();
@@ -193,7 +193,7 @@ public void testCompilePackageAsField() throws BadLocationException, IOException
193193
assertEquals(_name() + "Class file exists after failing compile", false, compiled.exists());
194194
_model.removeListener(listener);
195195

196-
_log.log("testCompilePackageAsField completed");
196+
System.err.println("testCompilePackageAsField completed");
197197

198198
debug.logEnd();
199199
}
@@ -204,7 +204,7 @@ public void testCompilePackageAsField() throws BadLocationException, IOException
204204
public void testCompilePackageAsField2() throws BadLocationException, IOException, InterruptedException {
205205
debug.logStart();
206206

207-
_log.log("Starting testCompilePackageAsField2");
207+
System.err.println("Starting testCompilePackageAsField2");
208208

209209
final OpenDefinitionsDocument doc = setupDocument(FOO_PACKAGE_AS_FIELD_2);
210210
final File file = tempFile();

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@
4545
import edu.rice.cs.util.FileOpenSelector;
4646
import edu.rice.cs.util.swing.AsyncTask;
4747

48-
/**
49-
* An interface for responding to events generated by the GlobalModel.
50-
* TODO: Refactor to remove component listeners from Global level.
51-
*
52-
* @version $Id$
53-
*/
48+
/** An interface for responding to events generated by the GlobalModel.
49+
* TODO: Refactor to remove component listeners from Global level.
50+
*
51+
* @version $Id$
52+
*/
5453
public interface GlobalModelListener extends InteractionsListener, JavadocListener, CompilerListener, JUnitListener {
5554

5655
/** Called when an asynchronous task must be run in the model */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,7 @@ private void _notifyCompileDone() {
11091109

11101110
@Override public void activeCompilerChanged() {
11111111
// Utilities.showDebug("compileEnded called in CSSListener");
1112+
System.err.println("Active compiler changed");
11121113
synchronized(this) { activeCompilerChangedCount++; }
11131114
_notifyCompileDone();
11141115
}

drjava/src/edu/rice/cs/drjava/model/compiler/DefaultCompilerModel.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class DefaultCompilerModel implements CompilerModel {
8282
private final List<CompilerInterface> _compilers;
8383

8484
/** Current compiler -- one of _compilers, or a NoCompilerAvailable */
85-
private volatile CompilerInterface _active;
85+
private volatile CompilerInterface _activeCompiler;
8686

8787
/** Manages listeners to this model. */
8888
private final CompilerEventNotifier _notifier = new CompilerEventNotifier();
@@ -122,14 +122,15 @@ public DefaultCompilerModel(GlobalModel m, Iterable<? extends CompilerInterface>
122122
if (_compilers.size() > 0) {
123123
if (! dCompName.equals(OptionConstants.COMPILER_PREFERENCE_CONTROL.NO_PREFERENCE) &&
124124
compilerNames.contains(dCompName))
125-
_active = _compilers.get(compilerNames.indexOf(dCompName));
126-
else
127-
_active = _compilers.get(0);
125+
_activeCompiler = _compilers.get(compilerNames.indexOf(dCompName));
126+
else {
127+
_activeCompiler = _compilers.get(0);
128+
}
128129
}
129130
else
130-
_active = NoCompilerAvailable.ONLY;
131+
_activeCompiler = NoCompilerAvailable.ONLY;
131132

132-
_log.log("Setting _active compiler to " + _active);
133+
// System.err.println("Setting _activeCompiler to " + _activeCompiler);
133134

134135
_model = m;
135136
_compilerErrorModel = new CompilerErrorModel(new DJError[0], _model);
@@ -240,7 +241,7 @@ private boolean _prepareForCompile() {
240241
/** Compile the given documents. All compile commands invoke this private method! */
241242
private void _doCompile(List<OpenDefinitionsDocument> docs) throws IOException {
242243
// _LLSTM.clearCache();
243-
_log.log("_doCompile(" + docs + ") called");
244+
// System.err.println("_doCompile(" + docs + ") called");
244245
final ArrayList<File> filesToCompile = new ArrayList<File>();
245246
final ArrayList<File> excludedFiles = new ArrayList<File>();
246247
final ArrayList<DJError> packageErrors = new ArrayList<DJError>();
@@ -431,8 +432,8 @@ private static List<File> _testFileSort(List<File> files) {
431432
private void _distributeErrors(List<? extends DJError> errors) throws IOException {
432433
// resetCompilerErrors(); // Why is this done?
433434
_log.log("Preparing to construct CompilerErrorModel for errors: " + errors);
434-
System.err.println("Preparing to construct CompilerErrorModel for errors: " + errors);
435-
System.err.println("Creating error model with " + errors.size() + " errors");
435+
// System.err.println("Preparing to construct CompilerErrorModel for errors: " + errors);
436+
// System.err.println("Creating error model with " + errors.size() + " errors");
436437
_compilerErrorModel = new CompilerErrorModel(errors.toArray(new DJError[0]), _model);
437438
_model.setNumCompilerErrors(_compilerErrorModel.getNumCompilerErrors()); // cache number of compiler errors in global model
438439
}
@@ -471,7 +472,7 @@ public Iterable<CompilerInterface> getAvailableCompilers() {
471472
*
472473
* @see #setActiveCompiler
473474
*/
474-
public CompilerInterface getActiveCompiler() { return _active; }
475+
public CompilerInterface getActiveCompiler() { return _activeCompiler; }
475476

476477
/** Sets which compiler is the "active" compiler.
477478
*
@@ -482,10 +483,10 @@ public Iterable<CompilerInterface> getAvailableCompilers() {
482483
*/
483484
public void setActiveCompiler(CompilerInterface compiler) {
484485
if (_compilers.isEmpty() && compiler.equals(NoCompilerAvailable.ONLY)) {
485-
// _active should be set correctly already
486+
// _activeCompiler should be set correctly already
486487
}
487488
else if (_compilers.contains(compiler)) {
488-
_active = compiler;
489+
_activeCompiler = compiler;
489490
_notifier.activeCompilerChanged();
490491
}
491492
else {
@@ -499,7 +500,7 @@ else if (_compilers.contains(compiler)) {
499500
// /** Add a compiler to the active list */
500501
// public void addCompiler(CompilerInterface compiler) {
501502
// if (_compilers.isEmpty()) {
502-
// _active = compiler;
503+
// _activeCompiler = compiler;
503504
// }
504505
// _compilers.add(compiler);
505506
// }

drjava/src/edu/rice/cs/drjava/model/repl/newjvm/NewJVMTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
* @version $Id$
6161
*/
6262
public final class NewJVMTest extends DrJavaTestCase {
63-
private static final Log _log = new Log("GloblaModel.txt", true);
63+
private static final Log _log = new Log("NewJVMTest.txt", true);
6464

6565
private static volatile TestJVMExtension _jvm;
6666

0 commit comments

Comments
 (0)