Set default DataResult viewer active when selection in directory tree is changed

This commit is contained in:
Dick Fickling 2012-03-12 17:42:48 -04:00
parent 0e844f00d2
commit edb851e132

View File

@ -567,6 +567,8 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
logger.log(Level.WARNING, "Error resetting node", ex); logger.log(Level.WARNING, "Error resetting node", ex);
} }
} }
final Node[] oldNodes = (Node[])oldValue;
final Node[] newNodes = (Node[])newValue;
// Some lock that prevents certain Node operations is set during the // Some lock that prevents certain Node operations is set during the
// ExplorerManager selection-change, so we must handle changes after the // ExplorerManager selection-change, so we must handle changes after the
// selection-change event is processed. // selection-change event is processed.
@ -610,7 +612,15 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
} }
// set the directory listing to be active // set the directory listing to be active
//dataResult.requestActive(); if(oldNodes != null && newNodes != null &&
(oldNodes.length == newNodes.length)) {
boolean sameNodes = true;
for(int i = 0; i < oldNodes.length; i++) {
sameNodes = sameNodes && oldNodes[i].getName().equals(newNodes[i].getName());
}
if(!sameNodes)
dataResult.requestActive();
}
} finally { } finally {
DirectoryTreeTopComponent.this.setCursor(null); DirectoryTreeTopComponent.this.setCursor(null);
} }