use of com.intellij.packaging.elements.PackagingElementFactory in project intellij-community by JetBrains.
the class ExtractedDirectoryElementType method chooseAndCreate.
@NotNull
public List<? extends PackagingElement<?>> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact, @NotNull CompositePackagingElement<?> parent) {
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, true, false, true, true) {
@Override
public boolean isFileSelectable(VirtualFile file) {
if (file.isInLocalFileSystem() && file.isDirectory())
return false;
return super.isFileSelectable(file);
}
};
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, context.getProject(), null);
final List<PackagingElement<?>> list = new ArrayList<>();
final PackagingElementFactory factory = PackagingElementFactory.getInstance();
for (VirtualFile file : files) {
list.add(factory.createExtractedDirectory(file));
}
return list;
}
use of com.intellij.packaging.elements.PackagingElementFactory in project intellij-community by JetBrains.
the class AppEngineSupportProvider method findOrCreateWebArtifact.
@NotNull
private static Artifact findOrCreateWebArtifact(AppEngineFacet appEngineFacet) {
Module module = appEngineFacet.getModule();
ArtifactType webArtifactType = AppEngineWebIntegration.getInstance().getAppEngineWebArtifactType();
final Collection<Artifact> artifacts = ArtifactUtil.getArtifactsContainingModuleOutput(module);
for (Artifact artifact : artifacts) {
if (webArtifactType.equals(artifact.getArtifactType())) {
return artifact;
}
}
ArtifactManager artifactManager = ArtifactManager.getInstance(module.getProject());
PackagingElementFactory elementFactory = PackagingElementFactory.getInstance();
ArtifactRootElement<?> root = elementFactory.createArtifactRootElement();
elementFactory.getOrCreateDirectory(root, "WEB-INF/classes").addOrFindChild(elementFactory.createModuleOutput(module));
return artifactManager.addArtifact(module.getName(), webArtifactType, root);
}
use of com.intellij.packaging.elements.PackagingElementFactory in project intellij-community by JetBrains.
the class ModuleSourceItemGroup method createElements.
@Override
@NotNull
public List<? extends PackagingElement<?>> createElements(@NotNull ArtifactEditorContext context) {
final Set<Module> modules = new LinkedHashSet<>();
collectDependentModules(myModule, modules, context);
final Artifact artifact = context.getArtifact();
final ArtifactType artifactType = artifact.getArtifactType();
Set<PackagingSourceItem> items = new LinkedHashSet<>();
for (Module module : modules) {
for (PackagingSourceItemsProvider provider : PackagingSourceItemsProvider.EP_NAME.getExtensions()) {
final ModuleSourceItemGroup parent = new ModuleSourceItemGroup(module);
for (PackagingSourceItem sourceItem : provider.getSourceItems(context, artifact, parent)) {
if (artifactType.isSuitableItem(sourceItem) && sourceItem.isProvideElements()) {
items.add(sourceItem);
}
}
}
}
List<PackagingElement<?>> result = new ArrayList<>();
final PackagingElementFactory factory = PackagingElementFactory.getInstance();
for (PackagingSourceItem item : items) {
final String path = artifactType.getDefaultPathFor(item.getKindOfProducedElements());
if (path != null) {
result.addAll(factory.createParentDirectories(path, item.createElements(context)));
}
}
return result;
}
use of com.intellij.packaging.elements.PackagingElementFactory in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineStandardSupportProvider method findOrCreateWebArtifact.
@NotNull
static Artifact findOrCreateWebArtifact(AppEngineStandardFacet appEngineStandardFacet) {
Module module = appEngineStandardFacet.getModule();
ArtifactType webArtifactType = AppEngineStandardWebIntegration.getInstance().getAppEngineWebArtifactType();
final Collection<Artifact> artifacts = ArtifactUtil.getArtifactsContainingModuleOutput(module);
for (Artifact artifact : artifacts) {
if (webArtifactType.equals(artifact.getArtifactType())) {
return artifact;
}
}
ArtifactManager artifactManager = ArtifactManager.getInstance(module.getProject());
PackagingElementFactory elementFactory = PackagingElementFactory.getInstance();
ArtifactRootElement<?> root = elementFactory.createArtifactRootElement();
elementFactory.getOrCreateDirectory(root, "WEB-INF/classes").addOrFindChild(elementFactory.createModuleOutput(module));
return artifactManager.addArtifact(module.getName(), webArtifactType, root);
}
Aggregations