當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。