Search in sources :

Example 1 with DirectoryCopyPackagingElement

use of com.intellij.packaging.impl.elements.DirectoryCopyPackagingElement in project intellij-plugins by JetBrains.

the class FlashBCOutputSourceItem method createElements.

@NotNull
public List<? extends PackagingElement<?>> createElements(@NotNull final ArtifactEditorContext context) {
    final String outputFilePath = myBc.getActualOutputFilePath();
    final String outputFolderPath = PathUtil.getParentPath(outputFilePath);
    switch(myType) {
        case OutputFile:
            return Collections.singletonList(new FileCopyPackagingElement(outputFilePath));
        case OutputFileAndHtmlWrapper:
            final List<PackagingElement<?>> result = new ArrayList<>();
            result.add(new FileCopyPackagingElement(outputFilePath));
            result.add(new FileCopyPackagingElement(outputFolderPath + "/" + BCUtils.getWrapperFileName(myBc)));
            final VirtualFile wrapperDir = LocalFileSystem.getInstance().findFileByPath(myBc.getWrapperTemplatePath());
            if (wrapperDir != null && wrapperDir.isDirectory()) {
                for (VirtualFile file : wrapperDir.getChildren()) {
                    if (!FlexCommonUtils.HTML_WRAPPER_TEMPLATE_FILE_NAME.equals(file.getName())) {
                        if (file.isDirectory()) {
                            final DirectoryCopyPackagingElement packagingElement = new DirectoryCopyPackagingElement(outputFolderPath + "/" + file.getName());
                            result.add(PackagingElementFactory.getInstance().createParentDirectories(file.getName(), packagingElement));
                        } else {
                            result.add(new FileCopyPackagingElement(outputFolderPath + "/" + file.getName()));
                        }
                    }
                }
            }
            return result;
        case OutputFolderContents:
            return Collections.singletonList(new DirectoryCopyPackagingElement(outputFolderPath));
        default:
            assert false;
            return Collections.emptyList();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ArrayList(java.util.ArrayList) FileCopyPackagingElement(com.intellij.packaging.impl.elements.FileCopyPackagingElement) PackagingElement(com.intellij.packaging.elements.PackagingElement) DirectoryCopyPackagingElement(com.intellij.packaging.impl.elements.DirectoryCopyPackagingElement) DirectoryCopyPackagingElement(com.intellij.packaging.impl.elements.DirectoryCopyPackagingElement) FileCopyPackagingElement(com.intellij.packaging.impl.elements.FileCopyPackagingElement) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PackagingElement (com.intellij.packaging.elements.PackagingElement)1 DirectoryCopyPackagingElement (com.intellij.packaging.impl.elements.DirectoryCopyPackagingElement)1 FileCopyPackagingElement (com.intellij.packaging.impl.elements.FileCopyPackagingElement)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1