本文整理汇总了Java中org.eclipse.jdt.core.IClasspathEntry.getReferencingEntry方法的典型用法代码示例。如果您正苦于以下问题:Java IClasspathEntry.getReferencingEntry方法的具体用法?Java IClasspathEntry.getReferencingEntry怎么用?Java IClasspathEntry.getReferencingEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IClasspathEntry
的用法示例。
在下文中一共展示了IClasspathEntry.getReferencingEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendVariableLabel
import org.eclipse.jdt.core.IClasspathEntry; //导入方法依赖的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;
}
示例2: appendExternalArchiveLabel
import org.eclipse.jdt.core.IClasspathEntry; //导入方法依赖的package包/类
private void appendExternalArchiveLabel(IPackageFragmentRoot root, long flags) {
IPath path;
IClasspathEntry classpathEntry= null;
try {
classpathEntry= JavaModelUtil.getClasspathEntry(root);
IPath rawPath= classpathEntry.getPath();
if (classpathEntry.getEntryKind() != IClasspathEntry.CPE_CONTAINER && !rawPath.isAbsolute()) {
path= rawPath;
} else {
path= root.getPath();
}
} catch (JavaModelException e) {
path= root.getPath();
}
if (getFlag(flags, JavaElementLabels.REFERENCED_ROOT_POST_QUALIFIED)) {
int segments= path.segmentCount();
if (segments > 0) {
fBuilder.append(path.segment(segments - 1));
if (segments > 1 || path.getDevice() != null) {
fBuilder.append(JavaElementLabels.CONCAT_STRING);
fBuilder.append(path.removeLastSegments(1).toOSString());
}
if (classpathEntry != null) {
IClasspathEntry referencingEntry= classpathEntry.getReferencingEntry();
if (referencingEntry != null) {
fBuilder.append(NLS.bind(" (from {0} of {1})", new Object[] { Name.CLASS_PATH.toString(), referencingEntry.getPath().lastSegment() }));
}
}
} else {
fBuilder.append(path.toOSString());
}
} else {
fBuilder.append(path.toOSString());
}
}