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


Java IPackageFragment.getKind方法代码示例

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


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

示例1: build

import org.eclipse.jdt.core.IPackageFragment; //导入方法依赖的package包/类
/**
 * @see IBuilder#build
 */
@Override
public void build(Measure measure, ItemMeasured item) {
	IPackageFragment[] packages;
	ItemMeasured packageMeasured; 
	String packageName = "";
	try {
		packages = project.getPackageFragments();
		for (IPackageFragment myPackage : packages) {
			if ((myPackage.getKind() == IPackageFragmentRoot.K_SOURCE) && myPackage.hasChildren()) {
				
				packageName = myPackage.isDefaultPackage() ? "(default)" : myPackage.getElementName();
				packageMeasured = new ItemMeasured(packageName, item);
				addClassBuilder(measure, myPackage, packageMeasured);
				item.addChild(packageMeasured);
				item.setMax(packageMeasured.getMax());
				item.setClassWithMax(packageMeasured.getClassWithMax());
				item.addValue(packageMeasured.getValue());
				item.addMean(packageMeasured.getMean());
			}
		}
	} catch (JavaModelException exception) {
		logger.error(exception);
	}
}
 
开发者ID:mariazevedo88,项目名称:o3smeasures-tool,代码行数:28,代码来源:PackageBuilder.java

示例2: getTopLevelPackages

import org.eclipse.jdt.core.IPackageFragment; //导入方法依赖的package包/类
public static Collection<IPackageFragment> getTopLevelPackages(IJavaProject javaProject) {
	Set<IPackageFragment> packages = new LinkedHashSet<>();
	try {
		if (javaProject == null || !javaProject.getProject().isAccessible()) {
			return packages;
		}
		for (IPackageFragment f : javaProject.getPackageFragments()){
			if (f.getKind() != IPackageFragmentRoot.K_SOURCE || f.isDefaultPackage() ) {
			  continue;
			}
			if (f.containsJavaResources() || f.getChildren().length > 1) {
				packages.add(f);
			}
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return packages;
}
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:20,代码来源:HotClassReloaderUtil.java

示例3: processPackageFragment

import org.eclipse.jdt.core.IPackageFragment; //导入方法依赖的package包/类
private void processPackageFragment(ITypeVisitor visitor,
    IPackageFragment fragment, IProgressMonitor monitor)
    throws JavaModelException {
  switch (fragment.getKind()) {
  case IPackageFragmentRoot.K_SOURCE:
    final ICompilationUnit[] units = fragment.getCompilationUnits();
    monitor.beginTask("", units.length); //$NON-NLS-1$
    for (final ICompilationUnit unit : units) {
      if (monitor.isCanceled()) {
        break;
      }
      processCompilationUnit(visitor, unit, monitor);
      monitor.worked(1);
    }
    break;
  case IPackageFragmentRoot.K_BINARY:
    final IClassFile[] classfiles = fragment.getClassFiles();
    monitor.beginTask("", classfiles.length); //$NON-NLS-1$
    for (final IClassFile classfile : classfiles) {
      if (monitor.isCanceled()) {
        break;
      }
      processClassFile(visitor, classfile, monitor);
      monitor.worked(1);
    }
    break;
  }
  monitor.done();
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:30,代码来源:TypeTraverser.java

示例4: getProjectCompilationUnits

import org.eclipse.jdt.core.IPackageFragment; //导入方法依赖的package包/类
public Set<ICompilationUnit> getProjectCompilationUnits(IJavaProject project) throws JavaModelException {
	Set<ICompilationUnit> compilationUnits = new HashSet<ICompilationUnit>();
	for (IPackageFragment packageFragment : project.getPackageFragments()) {
		if (packageFragment.getKind() == IPackageFragmentRoot.K_SOURCE)
			Collections.addAll(compilationUnits, packageFragment.getCompilationUnits());
	}
	return compilationUnits;
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:9,代码来源:PrepareAnalysis.java


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