本文整理汇总了Java中com.intellij.packaging.impl.artifacts.ArtifactUtil类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactUtil类的具体用法?Java ArtifactUtil怎么用?Java ArtifactUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactUtil类属于com.intellij.packaging.impl.artifacts包,在下文中一共展示了ArtifactUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getUsagesInElement
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的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
示例2: getNotAddedLibraries
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
private static List<? extends Library> getNotAddedLibraries(@NotNull final ArtifactEditorContext context, @NotNull Artifact artifact,
List<Library> librariesList) {
final Set<VirtualFile> roots = new HashSet<VirtualFile>();
ArtifactUtil.processPackagingElements(artifact, PackagingElementFactoryImpl.FILE_COPY_ELEMENT_TYPE, new Processor<FileCopyPackagingElement>() {
@Override
public boolean process(FileCopyPackagingElement fileCopyPackagingElement) {
final VirtualFile root = fileCopyPackagingElement.getLibraryRoot();
if (root != null) {
roots.add(root);
}
return true;
}
}, context, true);
final List<Library> result = new ArrayList<Library>();
for (Library library : librariesList) {
if (!roots.containsAll(Arrays.asList(library.getFiles(OrderRootType.CLASSES)))) {
result.add(library);
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ModulesAndLibrariesSourceItemsProvider.java
示例3: getSourceItems
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
@NotNull
@Override
public Collection<? extends PackagingSourceItem> getSourceItems(@NotNull ArtifactEditorContext editorContext, @NotNull Artifact artifact,
@Nullable PackagingSourceItem parent) {
if (parent instanceof ModuleSourceItemGroup) {
final Module module = ((ModuleSourceItemGroup)parent).getModule();
final Set<F> facets = new HashSet<F>(editorContext.getFacetsProvider().getFacetsByType(module, myFacetTypeId));
ArtifactUtil.processPackagingElements(artifact, myElementType, new Processor<E>() {
@Override
public boolean process(E e) {
F facet = getFacet(e);
if (facet != null) {
facets.remove(facet);
}
return true;
}
}, editorContext, true);
if (!facets.isEmpty()) {
return Collections.singletonList(new FacetBasedSourceItem<F>(this, facets.iterator().next()));
}
}
return Collections.emptyList();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:FacetBasedPackagingSourceItemsProvider.java
示例4: updateOutputPath
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
public void updateOutputPath(@NotNull String oldArtifactName, @NotNull final String newArtifactName) {
final String oldDefaultPath = ArtifactUtil.getDefaultArtifactOutputPath(oldArtifactName, myProject);
if (Comparing.equal(oldDefaultPath, getConfiguredOutputPath())) {
setOutputPath(ArtifactUtil.getDefaultArtifactOutputPath(newArtifactName, myProject));
}
final CompositePackagingElement<?> root = getRootElement();
if (root instanceof ArchivePackagingElement) {
String oldFileName = ArtifactUtil.suggestArtifactFileName(oldArtifactName);
final String name = ((ArchivePackagingElement)root).getArchiveFileName();
final String fileName = FileUtil.getNameWithoutExtension(name);
final String extension = FileUtilRt.getExtension(name);
if (fileName.equals(oldFileName) && extension.length() > 0) {
myLayoutTreeComponent.editLayout(new Runnable() {
@Override
public void run() {
((ArchivePackagingElement)getRootElement()).setArchiveFileName(ArtifactUtil.suggestArtifactFileName(newArtifactName) + "." + extension);
}
});
myLayoutTreeComponent.updateRootNode();
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ArtifactEditorImpl.java
示例5: collectIncludedArtifacts
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
private static void collectIncludedArtifacts(Artifact artifact, final PackagingElementResolvingContext context,
final Set<Artifact> processed, final Set<Artifact> result, final boolean withOutputPathOnly) {
if (!processed.add(artifact)) {
return;
}
if (!withOutputPathOnly || !StringUtil.isEmpty(artifact.getOutputPath())) {
result.add(artifact);
}
ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.ARTIFACT_ELEMENT_TYPE, new Processor<ArtifactPackagingElement>() {
@Override
public boolean process(ArtifactPackagingElement element) {
Artifact included = element.findArtifact(context);
if (included != null) {
collectIncludedArtifacts(included, context, processed, result, withOutputPathOnly);
}
return true;
}
}, context, false);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ArtifactCompileScope.java
示例6: findOrCreateWebArtifact
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
@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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AppEngineSupportProvider.java
示例7: findClass
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
@Override
protected PsiClass findClass(String className) {
final Set<Module> modules = ApplicationManager.getApplication().runReadAction(new Computable<Set<Module>>() {
@Override
public Set<Module> compute() {
return ArtifactUtil.getModulesIncludedInArtifacts(Collections.singletonList(myArtifact), getProject());
}
});
for (Module module : modules) {
final PsiClass aClass = JavaExecutionUtil.findMainClass(getProject(), className, GlobalSearchScope.moduleScope(module));
if (aClass != null) {
return aClass;
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaFxApplicationClassBrowser.java
示例8: findOrCreateWebArtifact
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
@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);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:20,代码来源:AppEngineStandardSupportProvider.java
示例9: findOneAppEngineStandardArtifact
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
/**
* Returns the only app engine standard artifact found for the given module or null if there
* aren't any or more than one.
*/
@Nullable
public static Artifact findOneAppEngineStandardArtifact(@NotNull Module module) {
Collection<Artifact> artifacts = ArtifactUtil.getArtifactsContainingModuleOutput(module);
Collection<Artifact> appEngineStandardArtifacts = Lists.newArrayList();
appEngineStandardArtifacts.addAll(
artifacts
.stream()
.filter(
artifact ->
AppEngineProjectService.getInstance().isAppEngineStandardArtifactType(artifact))
.collect(toList()));
return appEngineStandardArtifacts.size() == 1
? appEngineStandardArtifacts.iterator().next()
: null;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:21,代码来源:AppEngineUtil.java
示例10: updateOutputPath
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
public void updateOutputPath(@NotNull String oldArtifactName, @NotNull final String newArtifactName) {
final String oldDefaultPath = ArtifactUtil.getDefaultArtifactOutputPath(oldArtifactName, myProject);
if (Comparing.equal(oldDefaultPath, getConfiguredOutputPath())) {
setOutputPath(ArtifactUtil.getDefaultArtifactOutputPath(newArtifactName, myProject));
final CompositePackagingElement<?> root = getRootElement();
if (root instanceof ArchivePackagingElement) {
String oldFileName = ArtifactUtil.suggestArtifactFileName(oldArtifactName);
final String name = ((ArchivePackagingElement)root).getArchiveFileName();
final String fileName = FileUtil.getNameWithoutExtension(name);
final String extension = FileUtilRt.getExtension(name);
if (fileName.equals(oldFileName) && extension.length() > 0) {
myLayoutTreeComponent.editLayout(new Runnable() {
@Override
public void run() {
((ArchivePackagingElement)getRootElement()).setArchiveFileName(ArtifactUtil.suggestArtifactFileName(newArtifactName) + "." + extension);
}
});
myLayoutTreeComponent.updateRootNode();
}
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ArtifactEditorImpl.java
示例11: findOrCreateArtifact
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
@NotNull
private static Artifact findOrCreateArtifact(AppEngineFacet appEngineFacet) {
Module module = appEngineFacet.getModule();
ArtifactType artifactType = AppEngineWebIntegration.getInstance().getAppEngineTargetArtifactType();
final Collection<Artifact> artifacts = ArtifactUtil.getArtifactsContainingModuleOutput(module);
for (Artifact artifact : artifacts) {
if (artifactType.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(), artifactType, root);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:AppEngineSupportProvider.java
示例12: collectIncludedArtifacts
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
private static void collectIncludedArtifacts(Artifact artifact, final PackagingElementResolvingContext context,
final Set<Artifact> processed, final Set<Artifact> result, final boolean withOutputPathOnly) {
if (!processed.add(artifact)) {
return;
}
if (!withOutputPathOnly || !StringUtil.isEmpty(artifact.getOutputPath())) {
result.add(artifact);
}
ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.getInstance(), new Processor<ArtifactPackagingElement>() {
@Override
public boolean process(ArtifactPackagingElement element) {
Artifact included = element.findArtifact(context);
if (included != null) {
collectIncludedArtifacts(included, context, processed, result, withOutputPathOnly);
}
return true;
}
}, context, false);
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ArtifactCompileScope.java
示例13: getUsagesInElement
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的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(@Nonnull PackagingElement<?> packagingElement, @Nonnull 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:consulo,项目名称:consulo,代码行数:19,代码来源:ArtifactProjectStructureElement.java
示例14: getNotAddedLibraries
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
private static List<? extends Library> getNotAddedLibraries(@Nonnull final ArtifactEditorContext context,
@Nonnull Artifact artifact,
List<Library> librariesList) {
final Set<VirtualFile> roots = new HashSet<VirtualFile>();
ArtifactUtil
.processPackagingElements(artifact, FileCopyElementType.getInstance(), new Processor<FileCopyPackagingElement>() {
@Override
public boolean process(FileCopyPackagingElement fileCopyPackagingElement) {
final VirtualFile root = fileCopyPackagingElement.getLibraryRoot();
if (root != null) {
roots.add(root);
}
return true;
}
}, context, true);
final List<Library> result = new ArrayList<Library>();
for (Library library : librariesList) {
if (!roots.containsAll(Arrays.asList(library.getFiles(BinariesOrderRootType.getInstance())))) {
result.add(library);
}
}
return result;
}
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:ModulesAndLibrariesSourceItemsProvider.java
示例15: updateOutputPath
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
public void updateOutputPath(@Nonnull String oldArtifactName, @Nonnull final String newArtifactName) {
final String oldDefaultPath = ArtifactUtil.getDefaultArtifactOutputPath(oldArtifactName, myProject);
if (Comparing.equal(oldDefaultPath, getConfiguredOutputPath())) {
setOutputPath(ArtifactUtil.getDefaultArtifactOutputPath(newArtifactName, myProject));
final CompositePackagingElement<?> root = getRootElement();
if (root instanceof ArchivePackagingElement) {
String oldFileName = ArtifactUtil.suggestArtifactFileName(oldArtifactName);
final String name = ((ArchivePackagingElement)root).getArchiveFileName();
final String fileName = FileUtil.getNameWithoutExtension(name);
final String extension = FileUtilRt.getExtension(name);
if (fileName.equals(oldFileName) && extension.length() > 0) {
myLayoutTreeComponent.editLayout(new Runnable() {
@Override
public void run() {
((ArchivePackagingElement)getRootElement()).setArchiveFileName(ArtifactUtil.suggestArtifactFileName(newArtifactName) + "." + extension);
}
});
myLayoutTreeComponent.updateRootNode();
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ArtifactEditorImpl.java
示例16: PropertiesEditorInfo
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
private PropertiesEditorInfo(ArtifactPropertiesProvider provider) {
myProvider = provider;
myProperties = provider.createProperties(myOriginalArtifact.getArtifactType());
final ArtifactProperties<?> originalProperties = myOriginalArtifact.getProperties(provider);
if (originalProperties != null) {
ArtifactUtil.copyProperties(originalProperties, myProperties);
}
myEditor = myProperties.createEditor(myContext);
myEditor.reset();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ArtifactPropertiesEditors.java
示例17: actionPerformed
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的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
示例18: createPackagingElements
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
@Override
public List<PackagingElement<?>> createPackagingElements(ArtifactEditorContext context) {
final List<PackagingElement<?>> result = new ArrayList<PackagingElement<?>>();
for (PackagingElementNode<?> node : myNodes) {
final List<? extends PackagingElement<?>> elements = node.getPackagingElements();
for (PackagingElement<?> element : elements) {
result.add(ArtifactUtil.copyWithChildren(element, myArtifactsEditor.getContext().getProject()));
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:LayoutNodesDraggingObject.java
示例19: actionPerformed
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final String pathForClasses = myArtifactEditor.getArtifact().getArtifactType().getDefaultPathFor(PackagingElementOutputKind.DIRECTORIES_WITH_CLASSES);
if (pathForClasses != null) {
final List<PackagingElement<?>> extracted = new ArrayList<PackagingElement<?>>();
for (PackagingSourceItem item : mySourceItemsTree.getSelectedItems()) {
final ArtifactEditorContext context = myArtifactEditor.getContext();
final List<? extends PackagingElement<?>> elements = item.createElements(context);
ArtifactUtil.processElementsWithSubstitutions(elements, context, context.getArtifactType(), PackagingElementPath.EMPTY, new PackagingElementProcessor<PackagingElement<?>>() {
@Override
public boolean process(@NotNull PackagingElement<?> element, @NotNull PackagingElementPath path) {
if (element instanceof FileCopyPackagingElement) {
final VirtualFile file = ((FileCopyPackagingElement)element).findFile();
if (file != null) {
final VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(file);
if (jarRoot != null) {
extracted.add(PackagingElementFactory.getInstance().createExtractedDirectory(jarRoot));
}
}
}
return true;
}
});
}
myArtifactEditor.getLayoutTreeComponent().putElements(pathForClasses, extracted);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ExtractIntoDefaultLocationAction.java
示例20: getNotAddedModules
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入依赖的package包/类
@NotNull
private static List<? extends Module> getNotAddedModules(@NotNull final ArtifactEditorContext context, @NotNull Artifact artifact,
final Module... allModules) {
final Set<Module> modules = new HashSet<Module>(Arrays.asList(allModules));
ArtifactUtil.processPackagingElements(artifact, ProductionModuleOutputElementType.ELEMENT_TYPE, new Processor<ModuleOutputPackagingElement>() {
@Override
public boolean process(ModuleOutputPackagingElement moduleOutputPackagingElement) {
modules.remove(moduleOutputPackagingElement.findModule(context));
return true;
}
}, context, true);
return new ArrayList<Module>(modules);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ModulesAndLibrariesSourceItemsProvider.java
注:本文中的com.intellij.packaging.impl.artifacts.ArtifactUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论