use of com.intellij.packaging.impl.elements.FileCopyPackagingElement in project intellij-community by JetBrains.
the class ExtractIntoDefaultLocationAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final String pathForClasses = myArtifactEditor.getArtifact().getArtifactType().getDefaultPathFor(PackagingElementOutputKind.DIRECTORIES_WITH_CLASSES);
if (pathForClasses != null) {
final List<PackagingElement<?>> extracted = new ArrayList<>();
for (PackagingSourceItem item : mySourceItemsTree.getSelectedItems()) {
final ArtifactEditorContext context = myArtifactEditor.getContext();
final List<? extends PackagingElement<?>> elements = item.createElements(context);
ArtifactUtil.processElementsWithSubstitutions(elements, context, context.getArtifactType(), PackagingElementPath.EMPTY, new PackagingElementProcessor<PackagingElement<?>>() {
@Override
public boolean process(@NotNull PackagingElement<?> element, @NotNull PackagingElementPath path) {
if (element instanceof FileCopyPackagingElement) {
final VirtualFile file = ((FileCopyPackagingElement) element).findFile();
if (file != null) {
final VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(file);
if (jarRoot != null) {
extracted.add(PackagingElementFactory.getInstance().createExtractedDirectory(jarRoot));
}
}
}
return true;
}
});
}
myArtifactEditor.getLayoutTreeComponent().putElements(pathForClasses, extracted);
}
}
use of com.intellij.packaging.impl.elements.FileCopyPackagingElement 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();
}
}
Aggregations