• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DirectoryPackagingElement类的典型用法和代码示例

java 2次浏览

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

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

示例1: getOrCreateModifiableParent

点赞 3

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

示例2: printToString

点赞 3

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

示例3: printToString

点赞 3

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

示例4: checkCanAdd

点赞 2

import com.intellij.packaging.impl.elements.DirectoryPackagingElement; //导入依赖的package包/类
public boolean checkCanAdd(CompositePackagingElement<?> parentElement, PackagingElementNode<?> parentNode) {
  boolean allParentsAreDirectories = true;
  PackagingElementNode<?> current = parentNode;
  while (current != null && !(current instanceof ArtifactRootNode)) {
    final PackagingElement<?> element = current.getFirstElement();
    if (!(element instanceof DirectoryPackagingElement)) {
      allParentsAreDirectories = false;
      break;
    }
    current = current.getParentNode();
  }

  return allParentsAreDirectories || checkCanModify(parentElement, parentNode);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:15,
代码来源:LayoutTreeComponent.java

示例5: DirectoryElementPropertiesPanel

点赞 2

import com.intellij.packaging.impl.elements.DirectoryPackagingElement; //导入依赖的package包/类
public DirectoryElementPropertiesPanel(DirectoryPackagingElement element, ArtifactEditorContext context) {
  super(element, context);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:4,
代码来源:DirectoryElementPropertiesPanel.java

示例6: DirectoryElementPresentation

点赞 2

import com.intellij.packaging.impl.elements.DirectoryPackagingElement; //导入依赖的package包/类
public DirectoryElementPresentation(DirectoryPackagingElement element) {
  myElement = element;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:4,
代码来源:DirectoryElementPresentation.java

示例7: doCreateArtifactTemplate

点赞 2

import com.intellij.packaging.impl.elements.DirectoryPackagingElement; //导入依赖的package包/类
@NotNull
@RequiredReadAction
public static NewArtifactConfiguration doCreateArtifactTemplate(Module module, PackagingElementResolvingContext packagingElementResolvingContext)
{
	ModulesProvider modulesProvider = packagingElementResolvingContext.getModulesProvider();

	Project project = module.getProject();
	CompositePackagingElement<?> root = ExplodedWarArtifactType.getInstance().createRootElement(module.getName());

	DirectoryPackagingElement webInfDir = DirectoryElementType.getInstance().createEmpty(project);
	webInfDir.setDirectoryName(JavaWebConstants.WEB_INF);
	root.addFirstChild(webInfDir);

	DirectoryPackagingElement libDir = DirectoryElementType.getInstance().createEmpty(project);
	libDir.setDirectoryName("lib");
	webInfDir.addFirstChild(libDir);

	Set<Library> libraries = new ArrayListSet<>();
	Set<Module> modules = new ArrayListSet<>();

	collectInfo(modules, libraries, modulesProvider, module);

	for(Module toAddModule : modules)
	{
		NamedPointer<Module> pointer = ModuleUtilCore.createPointer(toAddModule);
		ModuleRootModel rootModel = modulesProvider.getRootModel(toAddModule);

		ZipArchivePackagingElement zipArchivePackagingElement = ZipArchiveElementType.getInstance().createEmpty(project);
		zipArchivePackagingElement.setArchiveFileName(toAddModule.getName() + ".jar");

		if(rootModel.getContentFolders(ContentFolderScopes.of(ProductionContentFolderTypeProvider.getInstance())).length > 0)
		{
			zipArchivePackagingElement.addFirstChild(ProductionModuleOutputElementType.getInstance().createElement(project, pointer));
		}

		if(rootModel.getContentFolders(ContentFolderScopes.of(ProductionResourceContentFolderTypeProvider.getInstance())).length > 0)
		{
			zipArchivePackagingElement.addFirstChild(ProductionResourceModuleOutputElementType.getInstance().createElement(project, pointer));
		}

		libDir.addFirstChild(zipArchivePackagingElement);

		if(rootModel.getContentFolders(ContentFolderScopes.of(WebResourcesFolderTypeProvider.getInstance())).length > 0)
		{
			root.addFirstChild(WebResourceModuleOutputElementType.getInstance().createElement(project, pointer));
		}
	}

	for(Library library : libraries)
	{
		LibraryPackagingElement libraryPackagingElement = LibraryElementType.getInstance().createEmpty(project);
		libraryPackagingElement.setLibraryName(library.getName());

		LibraryTable table = library.getTable();

		String tableLevel = table == null ? null : table.getTableLevel();
		libraryPackagingElement.setLevel(tableLevel);

		if(LibraryTableImplUtil.MODULE_LEVEL.equals(tableLevel))
		{
			libraryPackagingElement.setModuleName(((ModuleLibraryTable) table).getModule().getName());
		}

		libDir.addFirstChild(libraryPackagingElement);
	}

	return new NewArtifactConfiguration(root, ExplodedWarArtifactType.getInstance().getPresentableName() + ": " + module.getName(), ExplodedWarArtifactType.getInstance());
}
 

开发者ID:consulo,
项目名称:consulo-javaee,
代码行数:69,
代码来源:ExplodedWarArtifactTemplate.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)