本文整理匯總了Java中org.eclipse.jdt.core.IPackageFragment.getClassFiles方法的典型用法代碼示例。如果您正苦於以下問題:Java IPackageFragment.getClassFiles方法的具體用法?Java IPackageFragment.getClassFiles怎麽用?Java IPackageFragment.getClassFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.IPackageFragment
的用法示例。
在下文中一共展示了IPackageFragment.getClassFiles方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createClassRepo
import org.eclipse.jdt.core.IPackageFragment; //導入方法依賴的package包/類
public void createClassRepo(String jarFileName, String Package) {
ClassRepo.INSTANCE.flusRepo();
try {
IPackageFragmentRoot iPackageFragmentRoot = getIPackageFragment(jarFileName);
if (iPackageFragmentRoot != null) {
IPackageFragment fragment = iPackageFragmentRoot.getPackageFragment(Package);
if (fragment != null) {
for (IClassFile element : fragment.getClassFiles()) {
ClassRepo.INSTANCE.addClass(element,"","",false);
}
} else {
new CustomMessageBox(SWT.ERROR, Package + " Package not found in jar "
+ iPackageFragmentRoot.getElementName(), "ERROR").open();
}
}
} catch (JavaModelException e) {
LOGGER.error("Error occurred while loading class from jar {}", jarFileName, e);
}
loadClassesFromSettingsFolder();
}
示例2: 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();
}