本文整理汇总了Java中org.eclipse.jdt.core.IPackageFragmentRoot.getRawClasspathEntry方法的典型用法代码示例。如果您正苦于以下问题:Java IPackageFragmentRoot.getRawClasspathEntry方法的具体用法?Java IPackageFragmentRoot.getRawClasspathEntry怎么用?Java IPackageFragmentRoot.getRawClasspathEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IPackageFragmentRoot
的用法示例。
在下文中一共展示了IPackageFragmentRoot.getRawClasspathEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterJREEntries
import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
/**
* Remove all JRE runtime entries from the given set
*
* @param scope
* set to filter
* @return filtered set without JRE runtime entries
*/
public static Set<IPackageFragmentRoot> filterJREEntries(
Collection<IPackageFragmentRoot> scope) throws JavaModelException {
final Set<IPackageFragmentRoot> filtered = new HashSet<IPackageFragmentRoot>();
for (final IPackageFragmentRoot root : scope) {
final IClasspathEntry entry = root.getRawClasspathEntry();
switch (entry.getEntryKind()) {
case IClasspathEntry.CPE_SOURCE:
case IClasspathEntry.CPE_LIBRARY:
case IClasspathEntry.CPE_VARIABLE:
filtered.add(root);
break;
case IClasspathEntry.CPE_CONTAINER:
IClasspathContainer container = JavaCore.getClasspathContainer(
entry.getPath(), root.getJavaProject());
if (container != null
&& container.getKind() == IClasspathContainer.K_APPLICATION) {
filtered.add(root);
}
break;
}
}
return filtered;
}
示例2: appendVariableLabel
import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
private boolean appendVariableLabel(IPackageFragmentRoot root, long flags) {
try {
IClasspathEntry rawEntry= root.getRawClasspathEntry();
if (rawEntry.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
IClasspathEntry entry= JavaModelUtil.getClasspathEntry(root);
if (entry.getReferencingEntry() != null) {
return false; // not the variable entry itself, but a referenced entry
}
IPath path= rawEntry.getPath().makeRelative();
if (getFlag(flags, JavaElementLabels.REFERENCED_ROOT_POST_QUALIFIED)) {
int segements= path.segmentCount();
if (segements > 0) {
fBuilder.append(path.segment(segements - 1));
if (segements > 1) {
fBuilder.append(JavaElementLabels.CONCAT_STRING);
fBuilder.append(path.removeLastSegments(1).toOSString());
}
} else {
fBuilder.append(path.toString());
}
} else {
fBuilder.append(path.toString());
}
fBuilder.append(JavaElementLabels.CONCAT_STRING);
if (root.isExternal()) {
fBuilder.append(root.getPath().toOSString());
} else {
fBuilder.append(root.getPath().makeRelative().toString());
}
return true;
}
} catch (JavaModelException e) {
// problems with class path, ignore (bug 202792)
return false;
}
return false;
}