use of com.intellij.packaging.ui.PackagingSourceItem in project intellij-community by JetBrains.
the class LayoutTreeComponent method packInto.
public void packInto(@NotNull final List<? extends PackagingSourceItem> items, final String pathToJar) {
final List<PackagingElement<?>> toSelect = new ArrayList<>();
final CompositePackagingElement<?> rootElement = getArtifact().getRootElement();
editLayout(() -> {
final CompositePackagingElement<?> archive = PackagingElementFactory.getInstance().getOrCreateArchive(rootElement, pathToJar);
for (PackagingSourceItem item : items) {
final List<? extends PackagingElement<?>> elements = item.createElements(myContext);
archive.addOrFindChildren(elements);
}
toSelect.add(archive);
});
myArtifactsEditor.getSourceItemsTree().rebuildTree();
updateAndSelect(myTree.getRootPackagingNode(), toSelect);
}
use of com.intellij.packaging.ui.PackagingSourceItem in project intellij-plugins by JetBrains.
the class FlashPackagingSourceItemsProvider method createFlashBCOutputSourceItems.
private static Collection<? extends PackagingSourceItem> createFlashBCOutputSourceItems(final Module module) {
final List<PackagingSourceItem> result = new ArrayList<>();
int orderNumber = 0;
final FlexProjectConfigurationEditor configEditor = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor();
// because Project Structure is open
assert configEditor != null;
for (FlexBuildConfiguration bc : configEditor.getConfigurations(module)) {
final String outputFilePath = bc.getActualOutputFilePath().toLowerCase();
if (!outputFilePath.endsWith(".swf") && !outputFilePath.endsWith(".swc")) {
// BC is not configured properly yet
continue;
}
result.add(new FlashBCOutputSourceItem(bc, FlashBCOutputSourceItem.Type.OutputFile, orderNumber++));
if (bc.getOutputType() == OutputType.Application && bc.getTargetPlatform() == TargetPlatform.Web && bc.isUseHtmlWrapper()) {
result.add(new FlashBCOutputSourceItem(bc, FlashBCOutputSourceItem.Type.OutputFileAndHtmlWrapper, orderNumber++));
}
result.add(new FlashBCOutputSourceItem(bc, FlashBCOutputSourceItem.Type.OutputFolderContents, orderNumber++));
}
return result;
}
use of com.intellij.packaging.ui.PackagingSourceItem in project intellij-community by JetBrains.
the class ModulesAndLibrariesSourceItemsProvider method createModuleItems.
@NotNull
private static Collection<? extends PackagingSourceItem> createModuleItems(@NotNull ArtifactEditorContext editorContext, @NotNull List<String> groupPath) {
final List<PackagingSourceItem> items = new ArrayList<>();
ModuleGrouper grouper = ModuleGrouper.instanceFor(editorContext.getProject(), editorContext.getModifiableModuleModel());
Set<String> groups = new HashSet<>();
for (Module module : grouper.getAllModules()) {
List<String> path = grouper.getGroupPath(module);
if (Comparing.equal(path, groupPath)) {
items.add(new ModuleSourceItemGroup(module));
} else if (ContainerUtil.startsWith(path, groupPath)) {
groups.add(path.get(groupPath.size()));
}
}
for (String group : groups) {
items.add(0, new ModuleGroupItem(ContainerUtil.append(groupPath, group)));
}
return items;
}
use of com.intellij.packaging.ui.PackagingSourceItem in project intellij-community by JetBrains.
the class PutSourceItemIntoParentAndLinkViaManifestAction method update.
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
final Artifact artifact = myArtifactEditor.getArtifact();
final ParentElementsInfo parentInfo = findParentAndGrandParent(artifact);
if (parentInfo != null) {
presentation.setText("Put Into '" + parentInfo.getGrandparentArtifact().getName() + "' and link via manifest");
}
boolean enable = parentInfo != null;
boolean isProvideElements = false;
for (PackagingSourceItem item : mySourceItemsTree.getSelectedItems()) {
isProvideElements |= item.isProvideElements();
if (!item.getKindOfProducedElements().containsJarFiles()) {
enable = false;
break;
}
}
enable &= isProvideElements;
presentation.setVisible(enable);
presentation.setEnabled(enable);
}
use of com.intellij.packaging.ui.PackagingSourceItem in project intellij-community by JetBrains.
the class SourceItemFindUsagesAction method getSelectedElement.
@Override
protected ProjectStructureElement getSelectedElement() {
final List<SourceItemNode> nodes = myTree.getSelectedSourceItemNodes();
if (nodes.size() != 1)
return null;
ArtifactsTreeNode node = nodes.get(0);
if (!(node instanceof SourceItemNode)) {
return null;
}
PackagingSourceItem sourceItem = ((SourceItemNode) node).getSourceItem();
if (sourceItem == null)
return null;
final StructureConfigurableContext context = getContext();
if (sourceItem instanceof ModuleOutputSourceItem) {
return new ModuleProjectStructureElement(context, ((ModuleOutputSourceItem) sourceItem).getModule());
} else if (sourceItem instanceof LibrarySourceItem) {
return new LibraryProjectStructureElement(context, ((LibrarySourceItem) sourceItem).getLibrary());
} else if (sourceItem instanceof ArtifactSourceItem) {
return myArtifactContext.getOrCreateArtifactElement(((ArtifactSourceItem) sourceItem).getArtifact());
}
return null;
}
Aggregations