private void addFileToDir(TreeNode<File> dir, File file) { final TreeNode<File> fileNode = new TreeNode<File>(file.getName()); fileNode.setContent(file); dir.addChild(fileNode); }
private void addFileToDir(TreeNode<File> dir, File file) { final TreeNode<File> fileNode = new TreeNode<File>(file.getName()); fileNode.setContent(file); dir.addChild(fileNode); }
private TreeNode<T> getChildForId(String id, boolean create) { if (id.equals("") || id.equals(".")) { return this; } if (id.equals("..")) { return getParent(); } if (children != null) { for (TreeNode<T> child : children) { if (child.getId().equals(id)) { return child; } } } if (create) { TreeNode<T> proxyChild = new TreeNode<T>(id); addChild(proxyChild); return proxyChild; } return null; } }
@Override public TreeNode<File> getProductComponents() { try { final File headerFile = EnviProductReaderPlugIn.getInputFile(getInput()); File parentDir = headerFile.getParentFile(); final TreeNode<File> root = new TreeNode<>(parentDir.getCanonicalPath()); root.setContent(parentDir); final TreeNode<File> header = new TreeNode<>(headerFile.getName()); header.setContent(headerFile); root.addChild(header); if (productZip == null) { final File imageFile = getEnviImageFile(headerFile); final TreeNode<File> image = new TreeNode<>(imageFile.getName()); image.setContent(imageFile); root.addChild(image); } return root; } catch (IOException ignored) { return null; } }
result.addChild(productFile); return result;
TreeNode<File> getProductComponents() { try { File parentDir = baseDir.getParentFile(); if (parentDir == null) { throw new IllegalStateException("Could not retrieve the parent directory of '" + baseDir.getAbsolutePath() + "'."); } final TreeNode<File> root = new TreeNode<File>(parentDir.getCanonicalPath()); root.setContent(parentDir); final TreeNode<File> dir = new TreeNode<File>(baseDir.getName()); dir.setContent(baseDir); root.addChild(dir); File volumeFile = CeosHelper.getVolumeFile(baseDir); addFileToDir(dir, volumeFile); addFileToDir(dir, new File(volumeDirectoryFile.getLeaderFileName())); addFileToDir(dir, new File(volumeDirectoryFile.getTrailerFileName())); String supplemental = volumeDirectoryFile.getSupplementalFileName(); if (StringUtils.isNotNullAndNotEmpty(supplemental)) { addFileToDir(dir, new File(supplemental)); } final String[] imageFileNames = volumeDirectoryFile.getImageFileNames(); for (String imageFileName : imageFileNames) { addFileToDir(dir, new File(imageFileName)); } return root; } catch (IOException e) { return null; } }
root.addChild(dir);
if (childNode == null) { childNode = new TreeNode<>(helpSetId, helpSet); parentNode.addChild(childNode); } else if (childNode.getContent() == null) { childNode.setContent(helpSet);