Search in sources :

Example 1 with PackagingSourceItem

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);
}
Also used : PackagingSourceItem(com.intellij.packaging.ui.PackagingSourceItem) PackagingElement(com.intellij.packaging.elements.PackagingElement) DirectoryPackagingElement(com.intellij.packaging.impl.elements.DirectoryPackagingElement) CompositePackagingElement(com.intellij.packaging.elements.CompositePackagingElement)

Example 2 with PackagingSourceItem

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;
}
Also used : PackagingSourceItem(com.intellij.packaging.ui.PackagingSourceItem) FlexProjectConfigurationEditor(com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)

Example 3 with PackagingSourceItem

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;
}
Also used : PackagingSourceItem(com.intellij.packaging.ui.PackagingSourceItem) ModuleGrouper(com.intellij.openapi.module.ModuleGrouper) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with PackagingSourceItem

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);
}
Also used : PackagingSourceItem(com.intellij.packaging.ui.PackagingSourceItem) Presentation(com.intellij.openapi.actionSystem.Presentation) Artifact(com.intellij.packaging.artifacts.Artifact)

Example 5 with PackagingSourceItem

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;
}
Also used : PackagingSourceItem(com.intellij.packaging.ui.PackagingSourceItem) ModuleProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement) StructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext) ArtifactsStructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurableContext) ArtifactsTreeNode(com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode) LibraryProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)

Aggregations

PackagingSourceItem (com.intellij.packaging.ui.PackagingSourceItem)10 PackagingElement (com.intellij.packaging.elements.PackagingElement)3 ArrayList (java.util.ArrayList)3 Presentation (com.intellij.openapi.actionSystem.Presentation)2 Module (com.intellij.openapi.module.Module)2 Artifact (com.intellij.packaging.artifacts.Artifact)2 CompositePackagingElement (com.intellij.packaging.elements.CompositePackagingElement)2 DirectoryPackagingElement (com.intellij.packaging.impl.elements.DirectoryPackagingElement)2 ArtifactEditorContext (com.intellij.packaging.ui.ArtifactEditorContext)2 NotNull (org.jetbrains.annotations.NotNull)2 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)1 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)1 ModuleGrouper (com.intellij.openapi.module.ModuleGrouper)1 Library (com.intellij.openapi.roots.libraries.Library)1 ArtifactEditorImpl (com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorImpl)1 ArtifactsStructureConfigurableContext (com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurableContext)1 ArtifactsTreeNode (com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode)1 StructureConfigurableContext (com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext)1 LibraryProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)1 ModuleProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement)1