Skip to content

Commit 3850150

Browse files
author
mgricken
committed
Started working on fixed working directory preference.
M src/edu/rice/cs/drjava/model/AbstractGlobalModel.java M src/edu/rice/cs/drjava/config/OptionConstants.java M src/edu/rice/cs/drjava/ui/config/ConfigFrame.java M src/edu/rice/cs/drjava/ui/config/DirectoryOptionComponent.java git-svn-id: file:///tmp/test-svn/trunk@5126 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 362905f commit 3850150

4 files changed

Lines changed: 36 additions & 10 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,9 @@ public static ArrayList<String> evaluate() {
11751175
/** The directory in use by the Interactions pane upon the previous quit. */
11761176
public static final FileOption LAST_INTERACTIONS_DIRECTORY = new FileOption("last.interactions.dir", FileOps.NULL_FILE);
11771177

1178+
/** The directory for the Interactions pane to use (as long as there is no project working directory). */
1179+
public static final FileOption FIXED_INTERACTIONS_DIRECTORY = new FileOption("fixed.interactions.dir", FileOps.NULL_FILE);
1180+
11781181
/** Whether to save and restore Interactions pane directory at startUp/shutdown (sticky=true), or to use
11791182
* "user.home" (sticky=false). */
11801183
public static final BooleanOption STICKY_INTERACTIONS_DIRECTORY =

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ class FlatFileGroupingState implements FileGroupingState {
919919
public File getBuildDirectory() { return FileOps.NULL_FILE; }
920920
public File getProjectRoot() { return getWorkingDirectory(); }
921921
public File getWorkingDirectory() {
922+
System.out.println("foo");
922923
Iterable<File> roots = getSourceRootSet();
923924
if (!IterUtil.isEmpty(roots)) { return IterUtil.first(roots); }
924925
else {

drjava/src/edu/rice/cs/drjava/ui/config/ConfigFrame.java

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,37 @@ private void _setupCompilerPanel(ConfigPanel panel) {
14251425

14261426
/** Add all of the components for the Interactions panel of the preferences window. */
14271427
private void _setupInteractionsPanel(ConfigPanel panel) {
1428+
final DirectoryOptionComponent wdComponent =
1429+
new DirectoryOptionComponent(OptionConstants.FIXED_INTERACTIONS_DIRECTORY,
1430+
"Interactions Working Directory", this,
1431+
"<html>Working directory for the Interactions Pane (unless<br>"+
1432+
"a project working directory has been set).</html>",
1433+
_dirChooser);
1434+
addOptionComponent(panel, wdComponent);
1435+
final BooleanOptionComponent stickyComponent =
1436+
new BooleanOptionComponent(OptionConstants.STICKY_INTERACTIONS_DIRECTORY,
1437+
"<html><p align=\"right\">" +
1438+
StringOps.
1439+
splitStringAtWordBoundaries("Restore last working directory of the Interactions pane on start up",
1440+
33, "<br>", SEPS), this,
1441+
"<html>Whether to restore the last working directory of the Interaction pane on start up,<br>" +
1442+
"or to always use the value of the \"user.home\" Java property<br>"+
1443+
"(currently "+System.getProperty("user.home")+").");
1444+
addOptionComponent(panel, stickyComponent);
1445+
1446+
// OptionComponent.ChangeListener wdListener = new OptionComponent.ChangeListener() {
1447+
// public Object value(Object oc) {
1448+
// File f = wdComponent.getComponent().getFileFromField();
1449+
// boolean enabled = (f == null) || (f.equals(FileOps.NULL_FILE));
1450+
// stickyComponent.getComponent().setEnabled(enabled);
1451+
// return null;
1452+
// }
1453+
// };
1454+
// wdListener.value(wdComponent);
1455+
1456+
addOptionComponent(panel, new LabelComponent("<html>&nbsp;</html>", this, true));
1457+
addOptionComponent(panel, new LabelComponent("<html>&nbsp;</html>", this, true));
1458+
14281459
addOptionComponent(panel, new IntegerOptionComponent(OptionConstants.HISTORY_MAX_SIZE, "Size of Interactions History", this,
14291460
"The number of interactions to remember in the history."));
14301461
addOptionComponent(panel, new BooleanOptionComponent(OptionConstants.DIALOG_AUTOIMPORT_ENABLED,
@@ -1458,15 +1489,6 @@ protected boolean verify(String s) {
14581489
}
14591490
};
14601491
addOptionComponent(panel, autoImportClasses);
1461-
addOptionComponent(panel,
1462-
new BooleanOptionComponent(OptionConstants.STICKY_INTERACTIONS_DIRECTORY,
1463-
"<html><p align=\"right\">" +
1464-
StringOps.
1465-
splitStringAtWordBoundaries("Restore last working directory of the Interactions pane on start up",
1466-
33, "<br>", SEPS), this,
1467-
"<html>Whether to restore the last working directory of the Interaction pane on start up,<br>" +
1468-
"or to always use the value of the \"user.home\" Java property<br>"+
1469-
"(currently "+System.getProperty("user.home")+")."));
14701492

14711493
addOptionComponent(panel, new LabelComponent("<html>&nbsp;</html>", this, true));
14721494
addOptionComponent(panel, new LabelComponent("<html>&nbsp;</html>", this, true));

drjava/src/edu/rice/cs/drjava/ui/config/DirectoryOptionComponent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ else if (componentFile == null) {
9999
public void setValue(File value) { _component.setFileField(value); }
100100

101101
/** Return's this OptionComponent's configurable component. */
102-
public JComponent getComponent() { return _component; }
102+
public DirectorySelectorComponent getComponent() { return _component; }
103103

104104
/** Adds a filter to decide if a directory can be chosen. */
105105
public void addChoosableFileFilter(FileFilter filter) { _component.addChoosableFileFilter(filter); }

0 commit comments

Comments
 (0)