protected IFolder getNewFolder() { if (outputFolder != null && outputFolder.exists()) { String[] pathSegments = StringHelper.withoutExtension((new File(editor.getStringValue())).getName()).split("-"); IFolder importFolder = outputFolder; for (String pathSegment : pathSegments) { importFolder = importFolder.getFolder(convertToJavaCompliantName(pathSegment)); } folderName = importFolder.getName(); return importFolder; } return null; }
public void deleteNewFolder() { if (outputFolder != null && outputFolder.exists()) { String[] pathSegments = StringHelper.withoutExtension((new File(editor.getStringValue())).getName()).split("-"); IFolder importFolder = outputFolder; for (String pathSegment : pathSegments) { importFolder = importFolder.getFolder(convertToJavaCompliantName(pathSegment)); } try { while (importFolder != outputFolder && importFolder.getParent() instanceof IFolder) { if (importFolder.members().length == 0) { importFolder.delete(false, null); } importFolder = (IFolder) importFolder.getParent(); } } catch (CoreException e) { OfsCore.getDefault() .logWarning("Could not delete empty import folder '" + importFolder + "'", e); e.printStackTrace(); } } }