當前位置: 首頁>>代碼示例>>Java>>正文


Java IClasspathEntry.getReferencingEntry方法代碼示例

本文整理匯總了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;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:40,代碼來源:JavaElementLabelComposer.java

示例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());
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:36,代碼來源:JavaElementLabelComposer.java


注:本文中的org.eclipse.jdt.core.IClasspathEntry.getReferencingEntry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。