workaround in keyword search panel for node being set twice sometimes

This commit is contained in:
adam-m 2013-05-23 17:33:50 -04:00
parent a4a34d3f3c
commit e7b67e5eb8

View File

@ -51,7 +51,7 @@ public class ExtractedContentViewer implements DataContentViewer {
private static final Logger logger = Logger.getLogger(ExtractedContentViewer.class.getName());
private ExtractedContentPanel panel;
private Node currentNode = null;
private volatile Node currentNode = null;
private MarkupSource currentSource = null;
private final IsDirVisitor isDirVisitor = new IsDirVisitor();
//keep last content cached
@ -65,8 +65,6 @@ public class ExtractedContentViewer implements DataContentViewer {
@Override
public void setNode(final Node selectedNode) {
//TODO why setNode() is called twice for the same node each time
// to clear the viewer
if (selectedNode == null) {
currentNode = null;
@ -74,7 +72,14 @@ public class ExtractedContentViewer implements DataContentViewer {
return;
}
this.currentNode = selectedNode;
//TODO why setNode() is called twice for the same node sometimes (when selected in dir tree first)
//for now, do not update second time
if (selectedNode == currentNode) {
return;
}
else {
currentNode = selectedNode;
}
// sources are custom markup from the node (if available) and default
// markup is fetched from solr