Fix DataContent bug

This commit is contained in:
Peter J. Martel 2011-12-13 14:04:04 -05:00
parent 987465cc6b
commit ad841ccffc

View File

@ -225,12 +225,20 @@ public final class DataContentTopComponent extends TopComponent implements DataC
// change the cursor to "waiting cursor" for this operation // change the cursor to "waiting cursor" for this operation
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try { try {
String defaultName = NbBundle.getMessage(DataContentTopComponent.class, "CTL_DataContentTopComponent");
// set the file path // set the file path
if (selectedNode == null) { if (selectedNode == null) {
setName(NbBundle.getMessage(DataContentTopComponent.class, "CTL_DataContentTopComponent")); setName(defaultName);
} else { } else {
String path = DataConversion.getformattedPath(ContentUtils.getDisplayPath(selectedNode.getLookup().lookup(Content.class)), 0); Content content = selectedNode.getLookup().lookup(Content.class);
setName(path); if (content != null) {
String path = DataConversion.getformattedPath(ContentUtils.getDisplayPath(selectedNode.getLookup().lookup(Content.class)), 0);
setName(path);
} else {
setName(defaultName);
}
} }
currentNode = selectedNode; currentNode = selectedNode;