Skip to content

Commit d900ead

Browse files
committed
Merge branch 'drscala' of https://github.com/DrJavaAtRice/drjava into drscala
Updating this repository to be consistent with its parent at github.
2 parents df39346 + c1e6106 commit d900ead

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1297
-1308
lines changed

drjava/src/edu/rice/cs/drjava/DrScala.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@
103103
* @version $Id: DrScala.java 5594 2012-06-21 11:23:40Z rcartwright $
104104
*/
105105
public class DrScala {
106-
public static volatile Log _log = new Log("DrScala.txt", false);
106+
public static volatile Log _log = new Log("MasterJVM.txt", true);
107107

108-
private static final String DEFAULT_MAX_HEAP_SIZE_ARG = "-Xmx128M";
108+
private static final String DEFAULT_MAX_HEAP_SIZE_ARG = "-Xmx256M";
109109

110110
private static final ArrayList<String> _filesToOpen = new ArrayList<String>();
111111
private static final ArrayList<String> _jvmArgs = new ArrayList<String>();
@@ -128,7 +128,7 @@ public class DrScala {
128128
static volatile boolean _restartedDrScalaUsesRemoteControl = true;
129129

130130
/** Time in millisecond before restarting DrScala to change the heap size, etc. is deemed a success. */
131-
private static final int WAIT_BEFORE_DECLARING_SUCCESS = 5000;
131+
private static final int WAIT_BEFORE_DECLARING_SUCCESS = 10000;
132132

133133
/** Number of times we retry opening with the remote control. */
134134
private static final int NUM_REMOTE_CONTROL_RETRIES = 15;
@@ -140,7 +140,7 @@ public class DrScala {
140140
* config file's location. (Might be specified on command line.) Instead, use accessor methods to
141141
* prevent others from assigning new values. */
142142

143-
/** Default properties file used by the configuration object, i.e. ".drsclal" in the user's home directory. */
143+
/** Default properties file used by the configuration object, i.e. ".drscala" in the user's home directory. */
144144
public static final File DEFAULT_PROPERTIES_FILE = new File(System.getProperty("user.home"), ".drscala");
145145

146146
/** Properties file used by the configuration object. Defaults to DEFAULT_PROPERTIES_FILE. */
@@ -254,7 +254,7 @@ public static void configureAndLoadDrScalaRoot(String[] args) {
254254
// }
255255

256256
// The code below is in a loop so that DrScala can retry launching itself
257-
// if it fails the first time after resetting the configuration file.
257+
// if it fails the first time after resetting the .
258258
// This helps for example when the main JVM heap size is too large, and
259259
// the JVM cannot be created.
260260
int failCount = 0;

drjava/src/edu/rice/cs/drjava/DrScalaRoot.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -339,20 +339,5 @@ public static void installModalWindowAdapter(final Window w,
339339
public static void removeModalWindowAdapter(Window w) {
340340
_mainFrame.removeModalWindowAdapter(w);
341341
}
342-
343-
// /** Handles an "open file" request, either from the remote control server or the operating system.
344-
// * @param f file to open
345-
// * @param lineNo line number to jump to, or -1 of not specified */
346-
// public static void handleRemoteOpenFile(File f, int lineNo) {
347-
// DrJava._log.log("DrScalaRoot.handleRemoteOpenFile, f=" + f);
348-
// if (_mainFrame != null) {
349-
// DrJava._log.log("\tcalling _mainFrame");
350-
// _mainFrame.handleRemoteOpenFile(f, lineNo);
351-
// }
352-
// else {
353-
// DrJava._log.log("\tadded to _filesToOpen");
354-
// DrJava.addFileToOpen(f.getAbsolutePath());
355-
// }
356-
// }
357342
}
358343

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,19 +1653,6 @@ public static ArrayList<String> evaluate() {
16531653
public static final BooleanOption DETACH_TABBEDPANES =
16541654
new BooleanOption("tabbedpanes.detach", Boolean.FALSE);
16551655

1656-
1657-
/* Debugger deactivated in DrScala */
1658-
// /** The last state of the "Debugger" frame. */
1659-
// public static final StringOption DIALOG_DEBUGFRAME_STATE = new StringOption("debugger.state", "default");
1660-
//
1661-
// /** Whether to save and restore window size and position at startUp/shutdown. */
1662-
// public static final BooleanOption DIALOG_DEBUGFRAME_STORE_POSITION =
1663-
// new BooleanOption("debugger.store.position", Boolean.TRUE);
1664-
//
1665-
// /** Whether the debugger is detached from the MainFrame. */
1666-
// public static final BooleanOption DETACH_DEBUGGER =
1667-
// new BooleanOption("debugger.detach", Boolean.FALSE);
1668-
16691656
/** The last state of the "Create Jar from Project" dialog. */
16701657
public static final StringOption DIALOG_JAROPTIONS_STATE = new StringOption("dialog.jaroptions.state", "default");
16711658

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

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -556,21 +556,28 @@ public void setBuildDirectory(File f) {
556556
/** Sets autofresh status of the project */
557557
public void setAutoRefreshStatus(boolean status) { _state.setAutoRefreshStatus(status); }
558558

559-
/** @return the working directory for the Master JVM (editor and GUI). */
559+
/** @return the defrault working directory for the Master JVM (editor and GUI). If _activeDirectory is non-null,
560+
* it is probably a better choice for a guessed working directory. */
560561
public File getMasterWorkingDirectory() {
561-
File file;
562-
try {
563-
// restore the path from the configuration
564-
file = FileOps.getValidDirectory(DrScala.getConfig().getSetting(LAST_DIRECTORY));
565-
}
566-
catch (RuntimeException e) {
567-
// something went wrong, clear the setting and use "user.home"
568-
DrScala.getConfig().setSetting(LAST_DIRECTORY, FileOps.NULL_FILE);
569-
file = FileOps.getValidDirectory(new File(System.getProperty("user.home", ".")));
570-
}
571-
// update the setting and return it
572-
DrScala.getConfig().setSetting(LAST_DIRECTORY, file);
573-
return file;
562+
/* On startup, LAST_DIRECTORY is random! It may be left over from unit testing (including
563+
* a failing unit test) and no longer exist! It should NEVER be used in a fresh start of DrJava!
564+
*/
565+
return FileOps.getValidDirectory(new File(System.getProperty("user.home", ".")));
566+
567+
// File file;
568+
// try {
569+
// // restore the path from the configuration
570+
// file = FileOps.getValidDirectory(DrScala.getConfig().getSetting(LAST_DIRECTORY));
571+
// }
572+
// catch (RuntimeException e) {
573+
// // something went wrong, clear the setting and use "user.home"
574+
// DrScala.getConfig().setSetting(LAST_DIRECTORY, FileOps.NULL_FILE);
575+
// file = ;
576+
// }
577+
// // update the setting and return it
578+
// DrScala.getConfig().setSetting(LAST_DIRECTORY, file);
579+
// return file;
580+
// }
574581
}
575582

576583
/** @return the working directory for the Slave (Interactions) JVM */
@@ -711,14 +718,14 @@ public File getWorkingDirectory() {
711718
// containing the project file
712719
File parentDir = _projectFile.getParentFile();
713720
if (parentDir != null) {
714-
return parentDir.getCanonicalFile(); // default is project root
721+
return parentDir.getCanonicalFile(); // default is directory containing project file
715722
} // or if all else fails, user.dir
716723
else return new File(System.getProperty("user.dir"));
717724
}
718725
return _workDir.getCanonicalFile();
719726
}
720727
catch(IOException e) { /* fall through */ }
721-
return _workDir.getAbsoluteFile();
728+
return _workDir.getAbsoluteFile(); // Explain how getAbsoluteFile differs from getCanonicalFile
722729
}
723730

724731
/** Sets project file to specifed value; used in "Save Project As ..." command in MainFrame. */
@@ -1015,18 +1022,19 @@ public File getWorkingDirectory() {
10151022
Iterable<File> roots = getSourceRootSet();
10161023
if (! IterUtil.isEmpty(roots)) { return IterUtil.first(roots); }
10171024
else {
1018-
// use the last directory saved to the configuration
1019-
if (DrScala.getConfig().getSetting(STICKY_INTERACTIONS_DIRECTORY)) {
1020-
try {
1021-
// restore the path from the configuration
1022-
file = FileOps.getValidDirectory(DrScala.getConfig().getSetting(LAST_INTERACTIONS_DIRECTORY));
1023-
}
1024-
catch (RuntimeException e) { file = FileOps.NULL_FILE; }
1025-
}
1026-
if (file == FileOps.NULL_FILE) {
1027-
// something went wrong, clear the setting and use "user.home"
1028-
file = FileOps.getValidDirectory(new File(System.getProperty("user.home", ".")));
1029-
}
1025+
file = getMasterWorkingDirectory();
1026+
// // use the last directory saved to the configuration
1027+
// if (DrScala.getConfig().getSetting(STICKY_INTERACTIONS_DIRECTORY)) {
1028+
// try {
1029+
// // restore the path from the configuration
1030+
// file = FileOps.getValidDirectory(DrScala.getConfig().getSetting(LAST_INTERACTIONS_DIRECTORY));
1031+
// }
1032+
// catch (RuntimeException e) { file = FileOps.NULL_FILE; }
1033+
// }
1034+
// if (file == FileOps.NULL_FILE) {
1035+
// // something went wrong, clear the setting and use "user.home"
1036+
// file = FileOps.getValidDirectory(new File(System.getProperty("user.home", ".")));
1037+
// }
10301038
// update the setting and return it
10311039
DrScala.getConfig().setSetting(LAST_INTERACTIONS_DIRECTORY, file);
10321040
return file;
@@ -1450,15 +1458,15 @@ private OpenDefinitionsDocument[] _openFiles(File[] files)
14501458
*/
14511459
public void openFolder(File dir, boolean rec, String ext)
14521460
throws IOException, OperationCanceledException, AlreadyOpenException {
1453-
debug.logStart();
1461+
// debug.logStart();
14541462

14551463
final File[] sfiles = getFilesInFolder(dir, rec, ext);
14561464
if (sfiles == null) return;
14571465
openFiles(new FileOpenSelector() { public File[] getFiles() { return sfiles; } });
14581466

14591467
if (sfiles.length > 0 && _state.inProjectPath(dir)) setProjectChanged(true);
14601468

1461-
debug.logEnd();
1469+
// debug.logEnd();
14621470
}
14631471

14641472
/** @return the file extension for the "Open Folder..." command for the currently selected compiler. */
@@ -2384,9 +2392,6 @@ void setDefinitionsIndent(int indent) {
23842392
/** A degenerate operation since this has no slave JVM and no interactions model. */
23852393
public void resetInteractions(File wd) { /* do nothing */ }
23862394

2387-
/** A degenerate operation since this has no slave JVM and no interactions model. */
2388-
public void resetInteractions(File wd, boolean forceReset) { /* do nothing */ }
2389-
23902395
/** Resets the console. Fires consoleReset() event. */
23912396
public void resetConsole() {
23922397
_consoleDoc.reset("");
@@ -4239,7 +4244,10 @@ private boolean _hasOneEmptyDocument() {
42394244

42404245
/** Creates a new document if there are currently no documents open. */
42414246
private void _ensureNotEmpty() {
4242-
if (getDocumentCount() == 0) newFile(getMasterWorkingDirectory());
4247+
if (getDocumentCount() == 0) {
4248+
File wd = _activeDirectory == null ? getMasterWorkingDirectory() : _activeDirectory;
4249+
newFile(wd);
4250+
}
42434251
}
42444252

42454253
/** Makes sure that none of the documents in the list are active.

0 commit comments

Comments
 (0)