• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CompositePackagingElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.packaging.elements.CompositePackagingElement的典型用法代码示例。如果您正苦于以下问题:Java CompositePackagingElement类的具体用法?Java CompositePackagingElement怎么用?Java CompositePackagingElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CompositePackagingElement类属于com.intellij.packaging.elements包,在下文中一共展示了CompositePackagingElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: isEnabled

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
private boolean isEnabled() {
  if (myLayoutTreeComponent.isSortElements()) {
    return false;
  }
  final PackagingElementNode<?> node = myLayoutTreeComponent.getSelection().getNodeIfSingle();
  if (node == null) {
    return false;
  }
  final CompositePackagingElementNode parent = node.getParentNode();
  if (parent == null) return false;

  final PackagingElement<?> element = node.getElementIfSingle();
  final CompositePackagingElement<?> parentElement = parent.getElementIfSingle();
  if (parentElement == null || element == null) return false;
  final List<PackagingElement<?>> children = parentElement.getChildren();
  final int index = children.indexOf(element);
  return index != -1 && 0 <= index + myDirection && index + myDirection < children.size();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MovePackagingElementAction.java


示例2: addNewPackagingElement

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
public void addNewPackagingElement(@NotNull PackagingElementType<?> type) {
  PackagingElementNode<?> parentNode = getParentNode(myTree.getSelection());
  final PackagingElement<?> element = parentNode.getFirstElement();
  final CompositePackagingElement<?> parent;
  if (element instanceof CompositePackagingElement<?>) {
    parent = (CompositePackagingElement<?>)element;
  }
  else {
    parent = getArtifact().getRootElement();
    parentNode = myTree.getRootPackagingNode();
  }
  if (!checkCanAdd(parent, parentNode)) return;

  final List<? extends PackagingElement<?>> children = type.chooseAndCreate(myContext, getArtifact(), parent);
  final PackagingElementNode<?> finalParentNode = parentNode;
  editLayout(new Runnable() {
    @Override
    public void run() {
      CompositePackagingElement<?> actualParent = getOrCreateModifiableParent(parent, finalParentNode);
      for (PackagingElement<?> child : children) {
        actualParent.addOrFindChild(child);
      }
    }
  });
  updateAndSelect(parentNode, children);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:LayoutTreeComponent.java


示例3: getOrCreateModifiableParent

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
private static CompositePackagingElement<?> getOrCreateModifiableParent(CompositePackagingElement<?> parentElement, PackagingElementNode<?> node) {
  PackagingElementNode<?> current = node;
  List<String> dirNames = new ArrayList<String>();
  while (current != null && !(current instanceof ArtifactRootNode)) {
    final PackagingElement<?> packagingElement = current.getFirstElement();
    if (!(packagingElement instanceof DirectoryPackagingElement)) {
      return parentElement;
    }
    dirNames.add(((DirectoryPackagingElement)packagingElement).getDirectoryName());
    current = current.getParentNode();
  }

  if (current == null) return parentElement;
  final PackagingElement<?> rootElement = current.getElementIfSingle();
  if (!(rootElement instanceof CompositePackagingElement<?>)) return parentElement;

  Collections.reverse(dirNames);
  String path = StringUtil.join(dirNames, "/");
  return PackagingElementFactory.getInstance().getOrCreateDirectory((CompositePackagingElement<?>)rootElement, path);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LayoutTreeComponent.java


示例4: update

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.setDropPossible(false);
  aEvent.hideHighlighter();
  final Object object = aEvent.getAttachedObject();
  if (object instanceof PackagingElementDraggingObject) {
    final DefaultMutableTreeNode parent = findParentCompositeElementNode(aEvent.getRelativePoint().getPoint(myTree));
    if (parent != null) {
      final PackagingElementDraggingObject draggingObject = (PackagingElementDraggingObject)object;
      final PackagingElementNode node = getNode(parent);
      if (node != null && draggingObject.canDropInto(node)) {
        final PackagingElement element = node.getFirstElement();
        if (element instanceof CompositePackagingElement) {
          draggingObject.setTargetNode(node);
          draggingObject.setTargetElement((CompositePackagingElement<?>)element);
          final Rectangle bounds = myTree.getPathBounds(TreeUtil.getPathFromRoot(parent));
          aEvent.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
          aEvent.setDropPossible(true);
        }
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:LayoutTreeComponent.java


示例5: packInto

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
public void packInto(@NotNull final List<? extends PackagingSourceItem> items, final String pathToJar) {
  final List<PackagingElement<?>> toSelect = new ArrayList<PackagingElement<?>>();
  final CompositePackagingElement<?> rootElement = getArtifact().getRootElement();
  editLayout(new Runnable() {
    @Override
    public void run() {
      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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LayoutTreeComponent.java


示例6: getManifestFile

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Nullable 
public ManifestFileConfiguration getManifestFile(CompositePackagingElement<?> element, ArtifactType artifactType,
                                                 final PackagingElementResolvingContext context) {
  final VirtualFile manifestFile = ManifestFileUtil.findManifestFile(element, context, artifactType);
  if (manifestFile == null) {
    return null;
  }

  ManifestFileConfiguration configuration = myManifestFiles.get(manifestFile);
  if (configuration == null) {
    configuration = ManifestFileUtil.createManifestFileConfiguration(manifestFile);
    myOriginalManifestFiles.put(manifestFile, new ManifestFileConfiguration(configuration));
    myManifestFiles.put(manifestFile, configuration);
  }
  return configuration;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ManifestFilesInfo.java


示例7: getUsagesInElement

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Override
public List<ProjectStructureElementUsage> getUsagesInElement() {
  final Artifact artifact = myArtifactsStructureContext.getArtifactModel().getArtifactByOriginal(myOriginalArtifact);
  final List<ProjectStructureElementUsage> usages = new ArrayList<ProjectStructureElementUsage>();
  final CompositePackagingElement<?> rootElement = myArtifactsStructureContext.getRootElement(artifact);
  ArtifactUtil.processPackagingElements(rootElement, null, new PackagingElementProcessor<PackagingElement<?>>() {
    @Override
    public boolean process(@NotNull PackagingElement<?> packagingElement, @NotNull PackagingElementPath path) {
      ProjectStructureElement element = getProjectStructureElementFor(packagingElement, ArtifactProjectStructureElement.this.myContext,
                                                                      ArtifactProjectStructureElement.this.myArtifactsStructureContext);
      if (element != null) {
        usages.add(createUsage(packagingElement, element, path.getPathStringFrom("/", rootElement)));
      }
      return true;
    }
  }, myArtifactsStructureContext, false, artifact.getArtifactType());
  return usages;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ArtifactProjectStructureElement.java


示例8: getPathStringFrom

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@NotNull
public String getPathStringFrom(String separator, @Nullable CompositePackagingElement<?> ancestor) {
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    final List<CompositePackagingElement<?>> parents = getParentsFrom(ancestor);
    for (int i = parents.size() - 1; i >= 0; i--) {
      builder.append(parents.get(i).getName());
      if (i > 0) {
        builder.append(separator);
      }
    }
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PackagingElementPath.java


示例9: copyFile

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
private void copyFile(String outputPath, List<CompositePackagingElement<?>> parents) throws IOException {
  if (parents.isEmpty()) {
    final String fullOutputPath = DeploymentUtil.appendToPath(outputPath, myRelativeOutputPath);
    File target = new File(fullOutputPath);
    if (FileUtil.filesEqual(myFile, target)) {
      LOG.debug("  skipping copying file to itself");
    }
    else {
      LOG.debug("  copying to " + fullOutputPath);
      FileUtil.copy(myFile, target);
    }
    return;
  }

  final CompositePackagingElement<?> element = parents.get(0);
  final String nextOutputPath = outputPath + "/" + element.getName();
  final List<CompositePackagingElement<?>> parentsTrail = parents.subList(1, parents.size());
  if (element instanceof ArchivePackagingElement) {
    if (myPackIntoArchives) {
      packFile(nextOutputPath, "", parentsTrail);
    }
  }
  else {
    copyFile(nextOutputPath, parentsTrail);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PackageFileWorker.java


示例10: printToString

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
public static String printToString(PackagingElement element, int level) {
  StringBuilder builder = new StringBuilder(StringUtil.repeatSymbol(' ', level));
  if (element instanceof ArchivePackagingElement) {
    builder.append(((ArchivePackagingElement)element).getArchiveFileName());
  }
  else if (element instanceof DirectoryPackagingElement) {
    builder.append(((DirectoryPackagingElement)element).getDirectoryName()).append("/");
  }
  else {
    builder.append(element.toString());
  }
  builder.append("\n");
  if (element instanceof CompositePackagingElement) {
    for (PackagingElement<?> child : ((CompositePackagingElement<?>)element).getChildren()) {
      builder.append(printToString(child, level + 1));
    }
  }
  return builder.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ArtifactsTestUtil.java


示例11: actionPerformed

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent event) {
    Project project = event.getProject();
    if (project == null) {
        show("There isn't a project!", NotificationType.ERROR);
        return;
    }

    Module module = findModule(event);
    if (module == null) return;
    String name = module.getName();
    ArtifactManager manager = ArtifactManager.getInstance(project);
    Artifact searchArtifact = manager.findArtifact(name);
    if (searchArtifact != null) {
        show("An artifact with this name already exists!", NotificationType.ERROR);
        return;
    }
    ArtifactType type = ArtifactType.findById("jar");
    if (type == null) {
        show("Error: Cannot find artifact type!", NotificationType.ERROR);
        return;
    }

    PackagingElementFactory elementFactory = PackagingElementFactory.getInstance();
    CompositePackagingElement<?> packagingElement = elementFactory.createArchive(name + ".jar");
    packagingElement.addOrFindChild(elementFactory.createModuleOutput(module));

    Artifact artifact = manager.addArtifact(name, type, packagingElement);

    if (artifact instanceof ModifiableArtifact) {
        ModifiableArtifact modArtifact = (ModifiableArtifact) artifact;
        modArtifact.setBuildOnMake(true);
    }

    show("Artifact with name \"" + name + "\" created!");
}
 
开发者ID:LukWebsForge,项目名称:FastArtifact,代码行数:37,代码来源:CreateArtifact.java


示例12: getFilePath

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Override
public String getFilePath() {
  final Artifact artifact = getArtifact();
  if (artifact != null) {
    String outputPath = artifact.getOutputPath();
    if (outputPath != null) {
      final CompositePackagingElement<?> rootElement = artifact.getRootElement();
      if (!(rootElement instanceof ArtifactRootElement<?>)) {
        outputPath += "/" + rootElement.getName();
      }
      return FileUtil.toSystemDependentName(outputPath);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ArtifactDeploymentSourceImpl.java


示例13: actionPerformed

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final PackagingElementNode<?> node = myLayoutTreeComponent.getSelection().getNodeIfSingle();
  if (node == null) return;
  final CompositePackagingElementNode parent = node.getParentNode();
  if (parent == null) return;

  final PackagingElement<?> element = node.getElementIfSingle();
  final CompositePackagingElement<?> parentElement = parent.getElementIfSingle();
  if (parentElement == null || element == null) return;


  if (!myLayoutTreeComponent.checkCanModifyChildren(parentElement, parent, Arrays.asList(node))) return;

  final List<PackagingElement<?>> toSelect = new ArrayList<PackagingElement<?>>();
  myLayoutTreeComponent.editLayout(new Runnable() {
    @Override
    public void run() {
      final int index = parentElement.getChildren().indexOf(element);
      final PackagingElement<?> moved = parentElement.moveChild(index, myDirection);
      if (moved != null) {
        toSelect.add(moved);
      }
    }
  });
  if (!toSelect.isEmpty()) {
    myLayoutTreeComponent.updateAndSelect(parent, toSelect);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:MovePackagingElementAction.java


示例14: actionPerformed

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final LayoutTreeComponent treeComponent = myEditor.getLayoutTreeComponent();
  final LayoutTreeSelection selection = treeComponent.getSelection();
  final PackagingElement<?> element = selection.getElementIfSingle();
  final PackagingElementNode<?> node = selection.getNodeIfSingle();
  if (node == null || !(element instanceof ArtifactPackagingElement)) return;

  final CompositePackagingElement<?> parent = node.getParentElement(element);
  final CompositePackagingElementNode parentNode = node.getParentNode();
  if (parent == null || parentNode == null) {
    return;
  }
  if (!treeComponent.checkCanModifyChildren(parent, parentNode, Collections.singletonList(node))) return;

  treeComponent.editLayout(new Runnable() {
    @Override
    public void run() {
      parent.removeChild(element);
      final ArtifactEditorContext context = myEditor.getContext();
      final Artifact artifact = ((ArtifactPackagingElement)element).findArtifact(context);
      if (artifact != null) {
        final CompositePackagingElement<?> rootElement = artifact.getRootElement();
        if (rootElement instanceof ArtifactRootElement<?>) {
          for (PackagingElement<?> child : rootElement.getChildren()) {
            parent.addOrFindChild(ArtifactUtil.copyWithChildren(child, context.getProject()));
          }
        }
        else {
          parent.addOrFindChild(ArtifactUtil.copyWithChildren(rootElement, context.getProject()));
        }
      }
    }
  });
  treeComponent.rebuildTree();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:InlineArtifactAction.java


示例15: removeNodes

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
public void removeNodes(final List<PackagingElementNode<?>> nodes) {
  Set<PackagingElement<?>> parents = new HashSet<PackagingElement<?>>();
  for (PackagingElementNode<?> node : nodes) {
    final List<? extends PackagingElement<?>> toDelete = node.getPackagingElements();
    for (PackagingElement<?> element : toDelete) {
      final Collection<PackagingNodeSource> nodeSources = node.getNodeSource(element);
      if (nodeSources.isEmpty()) {
        final CompositePackagingElement<?> parent = node.getParentElement(element);
        if (parent != null) {
          parents.add(parent);
          parent.removeChild(element);
        }
      }
      else {
        Collection<PackagingNodeSource> rootSources = getRootNodeSources(nodeSources);
        for (PackagingNodeSource source : rootSources) {
          parents.add(source.getSourceParentElement());
          source.getSourceParentElement().removeChild(source.getSourceElement());
        }
      }
    }
  }
  final List<PackagingElementNode<?>> parentNodes = myTree.findNodes(parents);
  for (PackagingElementNode<?> parentNode : parentNodes) {
    myTree.addSubtreeToUpdate(parentNode);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:LayoutTreeComponent.java


示例16: getParentNode

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
private PackagingElementNode<?> getParentNode(final LayoutTreeSelection selection) {
  final PackagingElementNode<?> node = selection.getNodeIfSingle();
  if (node != null) {
    if (node.getFirstElement() instanceof CompositePackagingElement) {
      return node;
    }
    final PackagingElementNode<?> parent = node.getParentNode();
    if (parent != null) {
      return parent;
    }
  }
  return myTree.getRootPackagingNode();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:LayoutTreeComponent.java


示例17: drop

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Override
public void drop(DnDEvent aEvent) {
  final Object object = aEvent.getAttachedObject();
  if (object instanceof PackagingElementDraggingObject) {
    final PackagingElementDraggingObject draggingObject = (PackagingElementDraggingObject)object;
    final PackagingElementNode<?> targetNode = draggingObject.getTargetNode();
    final CompositePackagingElement<?> targetElement = draggingObject.getTargetElement();
    if (targetElement == null || targetNode == null || !draggingObject.checkCanDrop()) return;
    if (!checkCanAdd(targetElement, targetNode)) {
      return;
    }
    final List<PackagingElement<?>> toSelect = new ArrayList<PackagingElement<?>>();
    editLayout(new Runnable() {
      @Override
      public void run() {
        draggingObject.beforeDrop();
        final CompositePackagingElement<?> parent = getOrCreateModifiableParent(targetElement, targetNode);
        for (PackagingElement<?> element : draggingObject.createPackagingElements(myContext)) {
          toSelect.add(element);
          parent.addOrFindChild(element);
        }
      }
    });
    updateAndSelect(targetNode, toSelect);
    myArtifactsEditor.getSourceItemsTree().rebuildTree();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:LayoutTreeComponent.java


示例18: findParentCompositeElementNode

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
@Nullable
private DefaultMutableTreeNode findParentCompositeElementNode(Point point) {
  TreePath path = myTree.getPathForLocation(point.x, point.y);
  while (path != null) {
    final PackagingElement<?> element = myTree.getElementByPath(path);
    if (element instanceof CompositePackagingElement) {
      return (DefaultMutableTreeNode)path.getLastPathComponent();
    }
    path = path.getParentPath();
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:LayoutTreeComponent.java


示例19: setRootElement

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
public void setRootElement(CompositePackagingElement<?> rootElement) {
  myContext.getOrCreateModifiableArtifactModel().getOrCreateModifiableArtifact(myOriginalArtifact).setRootElement(rootElement);
  myTreeStructure.updateRootElement();
  final DefaultMutableTreeNode node = myTree.getRootNode();
  node.setUserObject(myTreeStructure.getRootElement());
  myBuilder.updateNode(node);
  rebuildTree();
  myArtifactsEditor.getSourceItemsTree().rebuildTree();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:LayoutTreeComponent.java


示例20: putIntoDefaultLocations

import com.intellij.packaging.elements.CompositePackagingElement; //导入依赖的package包/类
public void putIntoDefaultLocations(@NotNull final List<? extends PackagingSourceItem> items) {
  final List<PackagingElement<?>> toSelect = new ArrayList<PackagingElement<?>>();
  editLayout(new Runnable() {
    @Override
    public void run() {
      final CompositePackagingElement<?> rootElement = getArtifact().getRootElement();
      final ArtifactType artifactType = getArtifact().getArtifactType();
      for (PackagingSourceItem item : items) {
        final String path = artifactType.getDefaultPathFor(item);
        if (path != null) {
          final CompositePackagingElement<?> parent;
          if (path.endsWith(URLUtil.JAR_SEPARATOR)) {
            parent = PackagingElementFactory.getInstance().getOrCreateArchive(rootElement, StringUtil.trimEnd(path, URLUtil.JAR_SEPARATOR));
          }
          else {
            parent = PackagingElementFactory.getInstance().getOrCreateDirectory(rootElement, path);
          }
          final List<? extends PackagingElement<?>> elements = item.createElements(myContext);
          toSelect.addAll(parent.addOrFindChildren(elements));
        }
      }
    }
  });

  myArtifactsEditor.getSourceItemsTree().rebuildTree();
  updateAndSelect(myTree.getRootPackagingNode(), toSelect);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:LayoutTreeComponent.java



注:本文中的com.intellij.packaging.elements.CompositePackagingElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NClass类代码示例发布时间:2022-05-23
下一篇:
Java AssignementTestable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap