return null;
}
DataObject dataObject = activeTC.getLookup().lookup(DataObject.class);
Project project = activeTC.getLookup().lookup(Project.class);
Node node = activeTC.getLookup().lookup(Node.class);
FileObject fileObject = activeTC.getLookup().lookup(FileObject.class);
// showInStatusBar(project);
String projectName = null;
String projectDir = null;
String fileName = null;
if (null != project) {
projectName = getProjectName(project);
projectDir = getProjectDirectory(project);
}
if (null != dataObject || null != fileObject) {
final FileObject primaryFile;
if (null != dataObject) {
primaryFile = getFileObjectWithShadowSupport(dataObject);
} else {
primaryFile = fileObject;
}
projectDir = getProjectDirectory(primaryFile);
projectName = getProjectName(primaryFile);
if (null != primaryFile.getPath()) {
fileName = primaryFile.getPath();
}
//support selected items in jars
if (null != FileUtil.getArchiveFile(primaryFile)) {
String fullJARPath = FileUtil.getArchiveFile(primaryFile).getPath();
String archiveFileName = primaryFile.getPath();
boolean hasFileName = null != archiveFileName && !"".equals(archiveFileName);
if (hasFileName) {
fileName = fullJARPath + "/" + archiveFileName;
} else {
fileName = fullJARPath;
}
}
}
// create title
Set<String> list = new LinkedHashSet<String>();
if (options.showProjectGroup) {
String activeProjectGroup = new ProjectGroupUtil().getActiveProjectGroup();
list.add(activeProjectGroup);
}
if (options.showProjectName) {
list.add(projectName);
}
if (options.showFileName) {
//show relative path, when project dir is in selected path
//show no relative path, when project dir equals selected path
boolean isRelativePath = null != fileName && null != projectDir && fileName.startsWith(projectDir) && !fileName.equals(projectDir);
if (options.showRelativeFilename && isRelativePath) {
//create and use relative file name
String reducedFileName = fileName.substring(projectDir.length());
fileName = reducedFileName;
}
if (null == fileName && null != projectDir) {
//show projectDir as fallback
fileName = projectDir;
}
if (null == fileName && null != node) {
//show node label as further fallback
fileName = (node.getDisplayName());
}
list.add(fileName);
}