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

Java PackagingElement类代码示例

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

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



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

示例1: findNodes

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
public List<PackagingElementNode<?>> findNodes(final Collection<? extends PackagingElement<?>> elements) {
  final List<PackagingElementNode<?>> nodes = new ArrayList<PackagingElementNode<?>>();
  TreeUtil.traverseDepth(getRootNode(), new TreeUtil.Traverse() {
    @Override
    public boolean accept(Object node) {
      final Object userObject = ((DefaultMutableTreeNode)node).getUserObject();
      if (userObject instanceof PackagingElementNode) {
        final PackagingElementNode<?> packagingNode = (PackagingElementNode<?>)userObject;
        final List<? extends PackagingElement<?>> nodeElements = packagingNode.getPackagingElements();
        if (ContainerUtil.intersects(nodeElements, elements)) {
          nodes.add(packagingNode);
        }
      }
      return true;
    }
  });
  return nodes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LayoutTree.java


示例2: registerProblem

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
private void registerProblem(@NotNull String message, @Nullable List<PackagingElement<?>> pathToPlace,
                             final ProjectStructureProblemType problemType, @NotNull ArtifactProblemQuickFix... quickFixes) {
  String parentPath;
  PackagingElement<?> element;
  if (pathToPlace != null && !pathToPlace.isEmpty()) {
    parentPath = PackagingElementPath.createPath(pathToPlace.subList(1, pathToPlace.size()-1)).getPathString();
    element = pathToPlace.get(pathToPlace.size() - 1);
  }
  else {
    parentPath = null;
    element = null;
  }
  final Artifact artifact = myContext.getArtifactModel().getArtifactByOriginal(myOriginalArtifact);
  final PlaceInArtifact place = new PlaceInArtifact(artifact, myContext, parentPath, element);
  myProblemsHolder.registerProblem(new ArtifactProblemDescription(message, problemType, pathToPlace, place, convertQuickFixes(quickFixes)));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ArtifactProblemsHolderImpl.java


示例3: isEnabled

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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


示例4: addNewPackagingElement

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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


示例5: getOrCreateModifiableParent

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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


示例6: selectNode

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
public void selectNode(@NotNull String parentPath, @NotNull PackagingElement<?> element) {
  final PackagingElementNode<?> parent = myTree.findCompositeNodeByPath(parentPath);
  if (parent == null) return;

  for (SimpleNode node : parent.getChildren()) {
    if (node instanceof PackagingElementNode) {
      final List<? extends PackagingElement<?>> elements = ((PackagingElementNode<?>)node).getPackagingElements();
      for (PackagingElement<?> packagingElement : elements) {
        if (packagingElement.isEqualTo(element)) {
          myBuilder.select(node);
          return;
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LayoutTreeComponent.java


示例7: update

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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


示例8: packInto

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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


示例9: getUsagesInElement

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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


示例10: LayoutTreeSelection

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
public LayoutTreeSelection(@NotNull LayoutTree tree) {
  final TreePath[] paths = tree.getSelectionPaths();
  if (paths == null) {
    return;
  }

  for (TreePath path : paths) {
    final SimpleNode node = tree.getNodeFor(path);
    if (node instanceof PackagingElementNode) {
      final PackagingElementNode<?> elementNode = (PackagingElementNode<?>)node;
      mySelectedNodes.add(elementNode);
      myNode2Path.put(elementNode, path);
      for (PackagingElement<?> element : elementNode.getPackagingElements()) {
        mySelectedElements.add(element);
        myElement2Node.put(element, elementNode);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:LayoutTreeSelection.java


示例11: computeFileToArtifactsMap

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
private MultiValuesMap<VirtualFile, Artifact> computeFileToArtifactsMap() {
  final MultiValuesMap<VirtualFile, Artifact> result = new MultiValuesMap<VirtualFile, Artifact>();
  final ArtifactManager artifactManager = ArtifactManager.getInstance(myProject);
  for (final Artifact artifact : artifactManager.getArtifacts()) {
    final PackagingElementResolvingContext context = artifactManager.getResolvingContext();
    ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
      @Override
      public boolean process(@NotNull PackagingElement<?> element, @NotNull PackagingElementPath path) {
        if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
          final VirtualFile root = ((FileOrDirectoryCopyPackagingElement)element).findFile();
          if (root != null) {
            result.put(root, artifact);
          }
        }
        else if (element instanceof ModuleOutputPackagingElement) {
          for (VirtualFile sourceRoot : ((ModuleOutputPackagingElement)element).getSourceRoots(context)) {
            result.put(sourceRoot, artifact);
          }
        }
        return true;
      }
    }, context, true);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ArtifactBySourceFileFinderImpl.java


示例12: printToString

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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


示例13: printToString

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:18,代码来源:ArtifactsTestUtil.java


示例14: addArtifactToLayout

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
public static void addArtifactToLayout(
    final Project project, final Artifact parent, final Artifact toAdd) {
  new WriteAction() {
    @Override
    protected void run(@NotNull final Result result) {
      final ModifiableArtifactModel model =
          ArtifactManager.getInstance(project).createModifiableModel();
      final PackagingElement<?> artifactElement =
          PackagingElementFactory.getInstance().createArtifactElement(toAdd, project);
      model
          .getOrCreateModifiableArtifact(parent)
          .getRootElement()
          .addOrFindChild(artifactElement);
      model.commit();
    }
  }.execute();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:18,代码来源:ArtifactsTestUtil.java


示例15: putIntoDefaultLocations

import com.intellij.packaging.elements.PackagingElement; //导入依赖的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<?> directory = PackagingElementFactory.getInstance().getOrCreateDirectory(rootElement, path);
          final List<? extends PackagingElement<?>> elements = item.createElements(myContext);
          toSelect.addAll(directory.addOrFindChildren(elements));
        }
      }
    }
  });

  myArtifactsEditor.getSourceItemsTree().rebuildTree();
  updateAndSelect(myTree.getRootPackagingNode(), toSelect);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:LayoutTreeComponent.java


示例16: createComposite

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
@Override
public CompositePackagingElement<?> createComposite(CompositePackagingElement<?> parent,
                                                    @Nullable String baseName,
                                                    @Nonnull ArtifactEditorContext context) {
  final String initialValue = PackagingElementFactoryImpl.suggestFileName(parent, baseName != null ? baseName : "archive", ".zip");
  String path =
    Messages.showInputDialog(context.getProject(), "Enter archive name: ", "New Archive", null, initialValue, new FilePathValidator());
  if (path == null) {
    return null;
  }
  path = FileUtil.toSystemIndependentName(path);
  final String parentPath = PathUtil.getParentPath(path);
  final String fileName = PathUtil.getFileName(path);
  final PackagingElement<?> element = new ZipArchivePackagingElement(fileName);
  return (CompositePackagingElement<?>)PackagingElementFactory.getInstance().createParentDirectories(parentPath, element);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ZipArchiveElementType.java


示例17: createComposite

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
@Override
public CompositePackagingElement<?> createComposite(CompositePackagingElement<?> parent,
                                                    String baseName,
                                                    @Nonnull ArtifactEditorContext context) {
  final String initialValue = PackagingElementFactoryImpl.suggestFileName(parent, baseName != null ? baseName : "folder", "");
  String path = Messages
    .showInputDialog(context.getProject(), "Enter directory name: ", "New Directory", null, initialValue, new FilePathValidator());
  if (path == null) {
    return null;
  }
  path = FileUtil.toSystemIndependentName(path);
  final String parentPath = PathUtil.getParentPath(path);
  final String fileName = PathUtil.getFileName(path);
  final PackagingElement<?> element = new DirectoryPackagingElement(fileName);
  return (CompositePackagingElement<?>)PackagingElementFactoryImpl.getInstance().createParentDirectories(parentPath, element);

}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:DirectoryElementType.java


示例18: computeFileToArtifactsMap

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
private MultiValuesMap<VirtualFile, Artifact> computeFileToArtifactsMap() {
  final MultiValuesMap<VirtualFile, Artifact> result = new MultiValuesMap<VirtualFile, Artifact>();
  final ArtifactManager artifactManager = ArtifactManager.getInstance(myProject);
  for (final Artifact artifact : artifactManager.getArtifacts()) {
    final PackagingElementResolvingContext context = artifactManager.getResolvingContext();
    ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
      @Override
      public boolean process(@Nonnull PackagingElement<?> element, @Nonnull PackagingElementPath path) {
        if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
          final VirtualFile root = ((FileOrDirectoryCopyPackagingElement)element).findFile();
          if (root != null) {
            result.put(root, artifact);
          }
        }
        else if (element instanceof ModuleOutputPackagingElement) {
          for (VirtualFile sourceRoot : ((ModuleOutputPackagingElement)element).getSourceRoots(context)) {
            result.put(sourceRoot, artifact);
          }
        }
        return true;
      }
    }, context, true);
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ArtifactBySourceFileFinderImpl.java


示例19: registerProblem

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
private void registerProblem(@Nonnull String message, @Nullable List<PackagingElement<?>> pathToPlace,
                             final ProjectStructureProblemType problemType, @Nonnull ArtifactProblemQuickFix... quickFixes) {
  String parentPath;
  PackagingElement<?> element;
  if (pathToPlace != null && !pathToPlace.isEmpty()) {
    parentPath = PackagingElementPath.createPath(pathToPlace.subList(1, pathToPlace.size()-1)).getPathString();
    element = pathToPlace.get(pathToPlace.size() - 1);
  }
  else {
    parentPath = null;
    element = null;
  }
  final Artifact artifact = myContext.getArtifactModel().getArtifactByOriginal(myOriginalArtifact);
  final PlaceInArtifact place = new PlaceInArtifact(artifact, myContext, parentPath, element);
  myProblemsHolder.registerProblem(new ArtifactProblemDescription(message, problemType, pathToPlace, place, convertQuickFixes(quickFixes)));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ArtifactProblemsHolderImpl.java


示例20: addNewPackagingElement

import com.intellij.packaging.elements.PackagingElement; //导入依赖的package包/类
public void addNewPackagingElement(@Nonnull 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:consulo,项目名称:consulo,代码行数:27,代码来源:LayoutTreeComponent.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java LocalResolver类代码示例发布时间:2022-05-23
下一篇:
Java NotAppliedException类代码示例发布时间: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