本文整理汇总了Java中org.eclipse.jdt.core.IPackageFragment.containsJavaResources方法的典型用法代码示例。如果您正苦于以下问题:Java IPackageFragment.containsJavaResources方法的具体用法?Java IPackageFragment.containsJavaResources怎么用?Java IPackageFragment.containsJavaResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IPackageFragment
的用法示例。
在下文中一共展示了IPackageFragment.containsJavaResources方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: populatePackageNameFromSelectedJar
import org.eclipse.jdt.core.IPackageFragment; //导入方法依赖的package包/类
/**
* Populate packages for selected jar file
*
*/
public void populatePackageNameFromSelectedJar() {
sourcePackageList.removeAll();
IPackageFragmentRoot iPackageFragmentRoot = (IPackageFragmentRoot) comboJarList.getData(String
.valueOf(comboJarList.getSelectionIndex()));
if (iPackageFragmentRoot != null) {
try {
for (IJavaElement iJavaElement : iPackageFragmentRoot.getChildren()) {
if (iJavaElement instanceof IPackageFragment) {
IPackageFragment packageFragment = (IPackageFragment) iJavaElement;
if (packageFragment.containsJavaResources()) {
if(!isAlreadyPresentInTargetList(packageFragment.getElementName()))
sourcePackageList.add(packageFragment.getElementName());
}
}
}
} catch (JavaModelException javaModelException) {
LOGGER.warn("Error occurred while fetching packages from "
+ iPackageFragmentRoot.getElementName());
}
}
if(comboJarList.getSelectionIndex() ==0){
deleteButton.setEnabled(false);
}else{
deleteButton.setEnabled(true);
}
enableOrDisableAddLabelsOnComboSelection();
}