Skip to content

Commit a13a055

Browse files
author
mgricken
committed
Fixes the bug
[ 1992497 ] Folders and Bins Cannot Be Selected http://sourceforge.net/tracker/index.php?func=detail&aid=1992497&group_id=44253&atid=438935 Folders and bins now can be selected. If a folder is closed, the selection in the navigator is moved to the document shown in the Definitions Pane, thus making sure that something is selected in the navigator, and that the selection is visible and not in a collapsed subtree. M src/edu/rice/cs/drjava/ui/MainFrame.java M src/edu/rice/cs/util/docnavigation/JTreeSortNavigator.java git-svn-id: file:///tmp/test-svn/trunk@4514 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent fdb0eba commit a13a055

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,11 @@ public void actionPerformed(ActionEvent ae) {
530530
public void actionPerformed(ActionEvent ae) {
531531
_closeFolder();
532532
_findReplace.updateFirstDocInSearch();
533+
// set the document currently visible in the definitions pane as active
534+
// document in the document navigator
535+
// this makes sure that something is selected in the navigator after the
536+
// folder was closed
537+
_model.getDocumentNavigator().setActiveDoc(_currentDefPane.getOpenDefDocument());
533538
}
534539
};
535540

drjava/src/edu/rice/cs/util/docnavigation/JTreeSortNavigator.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,9 @@ public ItemT getCurrent() {
805805
/** Returns the model lock. */
806806
public Object getModelLock() { return _model; }
807807

808+
// This visitor is executed in getCurrent(). The case methods for files and strings return
809+
// null, which caused DrJava to revert to the previous selection in requestSelectionUpdate().
810+
// That code has now been commented out; this note is only for documentation purposes.
808811
private final NodeDataVisitor<ItemT, ItemT> _leafVisitor = new NodeDataVisitor<ItemT, ItemT>() {
809812
public ItemT fileCase(File f, Object... p){ return null; }
810813
public ItemT stringCase(String s, Object... p){ return null; }
@@ -943,9 +946,12 @@ public String generatePathString(TreePath tp) {
943946
/** If the currently selected item is not an INavigatorItem, select the one given. Only runs in event thread. */
944947
public void requestSelectionUpdate(ItemT ini) {
945948
// synchronized (_model) {
946-
if (getCurrent() == null) { // the currently selected node is not a leaf
947-
setActiveDoc(ini);
948-
}
949+
// This code checked if the selected node was a leaf, i.e. a Java source file,
950+
// and if it wasn't, reverts the selection. The code was commented out to allow
951+
// selection of file nodes (i.e. folders) and string nodes (i.e. [ Source Files ], etc.)
952+
// if (getCurrent() == null) { // the currently selected node is not a leaf
953+
// setActiveDoc(ini);
954+
// }
949955
// }
950956
}
951957

0 commit comments

Comments
 (0)