当前位置: 首页>>代码示例>>Java>>正文


Java XImportSection.getImportDeclarations方法代码示例

本文整理汇总了Java中org.eclipse.xtext.xtype.XImportSection.getImportDeclarations方法的典型用法代码示例。如果您正苦于以下问题:Java XImportSection.getImportDeclarations方法的具体用法?Java XImportSection.getImportDeclarations怎么用?Java XImportSection.getImportDeclarations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.xtype.XImportSection的用法示例。


在下文中一共展示了XImportSection.getImportDeclarations方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RewritableImportSection

import org.eclipse.xtext.xtype.XImportSection; //导入方法依赖的package包/类
public RewritableImportSection(XtextResource resource, IImportsConfiguration importsConfiguration, XImportSection originalImportSection,
		String lineSeparator, ImportSectionRegionUtil regionUtil, IValueConverter<String> nameConverter) {
	this.importsConfiguration = importsConfiguration;
	this.resource = resource;
	this.lineSeparator = lineSeparator;
	this.regionUtil = regionUtil;
	this.nameValueConverter = nameConverter;
	this.implicitlyImportedPackages = importsConfiguration.getImplicitlyImportedPackages(resource);
	this.importRegion = regionUtil.computeRegion(resource);
	if (originalImportSection != null) {
		for (XImportDeclaration originalImportDeclaration : originalImportSection.getImportDeclarations()) {
			this.originalImportDeclarations.add(originalImportDeclaration);
			JvmDeclaredType importedType = originalImportDeclaration.getImportedType();
			if (originalImportDeclaration.isStatic()) {
				String memberName = originalImportDeclaration.getMemberName();
				if (originalImportDeclaration.isExtension()) {
					Maps2.putIntoSetMap(importedType, memberName, staticExtensionImports);
				} else {
					Maps2.putIntoSetMap(importedType, memberName, staticImports);
				}
			} else if (importedType != null) {
				Maps2.putIntoListMap(importedType.getSimpleName(), importedType, plainImports);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:27,代码来源:RewritableImportSection.java

示例2: update

import org.eclipse.xtext.xtype.XImportSection; //导入方法依赖的package包/类
public void update() {
	XImportSection importSection = importsConfiguration.getImportSection(resource);
	if (importSection == null && importsConfiguration instanceof IMutableImportsConfiguration) {
		importSection = XtypeFactory.eINSTANCE.createXImportSection();

		IMutableImportsConfiguration mutableImportsConfiguration = (IMutableImportsConfiguration) importsConfiguration;
		mutableImportsConfiguration.setImportSection(resource, importSection);
	}
	if (importSection == null) {
		return;
	}
	removeObsoleteStaticImports();

	List<XImportDeclaration> allImportDeclarations = newArrayList();
	allImportDeclarations.addAll(originalImportDeclarations);
	allImportDeclarations.addAll(addedImportDeclarations);
	allImportDeclarations.removeAll(removedImportDeclarations);

	List<XImportDeclaration> importDeclarations = importSection.getImportDeclarations();
	importDeclarations.clear();
	importDeclarations.addAll(allImportDeclarations);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:23,代码来源:RewritableImportSection.java

示例3: getImportedNamespaceResolvers

import org.eclipse.xtext.xtype.XImportSection; //导入方法依赖的package包/类
protected List<ImportNormalizer> getImportedNamespaceResolvers(XImportSection importSection, boolean ignoreCase) {
	List<XImportDeclaration> importDeclarations = importSection.getImportDeclarations();
	List<ImportNormalizer> result = Lists.newArrayListWithExpectedSize(importDeclarations.size());
	for (XImportDeclaration imp: importDeclarations) {
		if (!imp.isStatic()) {
			String value = imp.getImportedNamespace();
			if(value == null)
				value = imp.getImportedTypeName();
			ImportNormalizer resolver = createImportedNamespaceResolver(value, ignoreCase);
			if (resolver != null)
				result.add(resolver);
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:16,代码来源:XImportSectionNamespaceScopeProvider.java

示例4: _format

import org.eclipse.xtext.xtype.XImportSection; //导入方法依赖的package包/类
protected void _format(final XImportSection section, @Extension final IFormattableDocument format) {
  EList<XImportDeclaration> _importDeclarations = section.getImportDeclarations();
  for (final XImportDeclaration imp : _importDeclarations) {
    {
      format.<XImportDeclaration>format(imp);
      XImportDeclaration _last = IterableExtensions.<XImportDeclaration>last(section.getImportDeclarations());
      boolean _notEquals = (!Objects.equal(imp, _last));
      if (_notEquals) {
        format.<XImportDeclaration>append(imp, XbaseFormatterPreferenceKeys.blankLinesBetweenImports);
      } else {
        format.<XImportDeclaration>append(imp, XbaseFormatterPreferenceKeys.blankLinesAfterImports);
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:16,代码来源:XtypeFormatter.java


注:本文中的org.eclipse.xtext.xtype.XImportSection.getImportDeclarations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。