本文整理匯總了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();
}