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