Skip to content

Commit 360888f

Browse files
author
mgricken
committed
Tools->Advanced->New DrJava Instance feature
git-svn-id: file:///tmp/test-svn/trunk@5301 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 3315184 commit 360888f

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,11 @@ public static Vector<KeyStroke> vector(KeyStroke... ks) {
11111111
public static final VectorOption<KeyStroke> KEY_GENERATE_CUSTOM_DRJAVA =
11121112
new VectorOption<KeyStroke>("key.generate.custom.drjava", new KeyStrokeOption("",null), to.vector());
11131113

1114+
/** The key binding for starting a new, blank DrJava instance. */
1115+
public static final VectorOption<KeyStroke> KEY_NEW_DRJAVA_INSTANCE=
1116+
new VectorOption<KeyStroke>("key.new.drjava.instance", new KeyStrokeOption("",null),
1117+
to.vector(KeyStroke.getKeyStroke(KeyEvent.VK_F1, CTRL_MASK|SHIFT_MASK)));
1118+
11141119
/* ---------- Find Replace Options ---------- */
11151120

11161121
public static final BooleanOption FIND_MATCH_CASE =

drjava/src/edu/rice/cs/drjava/ui/MainFrame.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,17 @@ public void actionPerformed(ActionEvent ae) {
22282228
popup.setVisible(true);
22292229
}
22302230
};
2231+
2232+
/** Action that starts a new, blank, unconnected DrJava instance. */
2233+
private final Action _newDrJavaInstanceAction = new AbstractAction("New DrJava Instance...") {
2234+
public void actionPerformed(ActionEvent ae) {
2235+
try {
2236+
Process p = edu.rice.cs.plt.concurrent.JVMBuilder.DEFAULT.classPath(FileOps.getDrJavaFile()).
2237+
start(edu.rice.cs.drjava.DrJava.class.getName(), "-new");
2238+
}
2239+
catch(IOException ioe) { MainFrameStatics.showIOError(MainFrame.this, ioe); }
2240+
}
2241+
};
22312242

22322243
/** Action that switches to next document. Only runs in the event thread. */
22332244
private final Action _switchToNextAction = new AbstractAction("Next Document") {
@@ -5276,6 +5287,14 @@ void quit() {
52765287
// on HP tc1100 and Toshiba Portege tablet PCs, but did not help in all cases
52775288
if (! _closeProject(true)) { return; /* if user pressed cancel, do not quit */ }
52785289

5290+
_updateSavedConfiguration();
5291+
5292+
//DrJava.consoleOut().println("Quitting DrJava...");
5293+
dispose(); // Free GUI elements of this frame
5294+
_model.quit();
5295+
}
5296+
5297+
void _updateSavedConfiguration() {
52795298
_recentFileManager.saveRecentFiles();
52805299
_recentProjectManager.saveRecentFiles();
52815300
if (! _model.closeAllFilesOnQuit()) { return; /* if user pressed cancel, do not quit */ }
@@ -5287,9 +5306,6 @@ void quit() {
52875306
try { DrJava.getConfig().saveConfiguration(); }
52885307
catch (IOException ioe) { MainFrameStatics.showIOError(MainFrame.this, ioe); }
52895308
}
5290-
//DrJava.consoleOut().println("Quitting DrJava...");
5291-
dispose(); // Free GUI elements of this frame
5292-
_model.quit();
52935309
}
52945310

52955311
private void _forceQuit() { _model.forceQuit(); }
@@ -6637,6 +6653,7 @@ public void actionPerformed(ActionEvent ae) {
66376653
DrJava.getConfig().getSetting(OptionConstants.EXTERNAL_SAVED_COUNT)));
66386654
final JMenu advancedMenu = new JMenu("Advanced");
66396655
_addMenuItem(advancedMenu, _generateCustomDrJavaJarAction, KEY_GENERATE_CUSTOM_DRJAVA);
6656+
_addMenuItem(advancedMenu, _newDrJavaInstanceAction, KEY_NEW_DRJAVA_INSTANCE);
66406657
toolsMenu.add(advancedMenu);
66416658

66426659
toolsMenu.addSeparator();

0 commit comments

Comments
 (0)