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


Java IPackageFragmentRoot.getResource方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.IPackageFragmentRoot.getResource方法的典型用法代碼示例。如果您正苦於以下問題:Java IPackageFragmentRoot.getResource方法的具體用法?Java IPackageFragmentRoot.getResource怎麽用?Java IPackageFragmentRoot.getResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.IPackageFragmentRoot的用法示例。


在下文中一共展示了IPackageFragmentRoot.getResource方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findOldGraphFile

import org.eclipse.jdt.core.IPackageFragmentRoot; //導入方法依賴的package包/類
private void findOldGraphFile(IProgressMonitor monitor) throws JavaModelException, FileNotFoundException {
	AnnotationParsing ap = JDTManager.findAnnotationParsingInModelAnnotation(testInterface, "file");
	this.model = ap.getValue("file");
	IPackageFragmentRoot[] roots = testInterface.getJavaProject().getPackageFragmentRoots();
	for (int j = 0; j < roots.length; j++) {
		IPackageFragmentRoot root = roots[j];
		IFolder resource = (IFolder) root.getResource();
		if (resource==null) throw new FileNotFoundException (model);
		IFile graphFile = resource.getFile(model);
		if (graphFile.exists()) {
			oldGraphFile = graphFile;
			break;
		}
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:16,代碼來源:TestConvertor.java

示例2: getClassfilesLocation

import org.eclipse.jdt.core.IPackageFragmentRoot; //導入方法依賴的package包/類
private IResource getClassfilesLocation(IPackageFragmentRoot root)
    throws CoreException {

  // For binary roots the underlying resource directly points to class files:
  if (root.getKind() == IPackageFragmentRoot.K_BINARY) {
    return root.getResource();
  }

  // For source roots we need to find the corresponding output folder:
  IPath path = root.getRawClasspathEntry().getOutputLocation();
  if (path == null) {
    path = root.getJavaProject().getOutputLocation();
  }
  return root.getResource().getWorkspace().getRoot().findMember(path);
}
 
開發者ID:eclipse,項目名稱:eclemma,代碼行數:16,代碼來源:PackageFragementRootAnalyzer.java

示例3: appendInternalArchiveLabel

import org.eclipse.jdt.core.IPackageFragmentRoot; //導入方法依賴的package包/類
private void appendInternalArchiveLabel(IPackageFragmentRoot root, long flags) {
	IResource resource= root.getResource();
	boolean rootQualified= getFlag(flags, JavaElementLabels.ROOT_QUALIFIED);
	if (rootQualified) {
		fBuilder.append(root.getPath().makeRelative().toString());
	} else {
		fBuilder.append(root.getElementName());
		boolean referencedPostQualified= getFlag(flags, JavaElementLabels.REFERENCED_ROOT_POST_QUALIFIED);
		if (referencedPostQualified && isReferenced(root)) {
			fBuilder.append(JavaElementLabels.CONCAT_STRING);
			fBuilder.append(resource.getParent().getFullPath().makeRelative().toString());
		} else if (getFlag(flags, JavaElementLabels.ROOT_POST_QUALIFIED)) {
			fBuilder.append(JavaElementLabels.CONCAT_STRING);
			fBuilder.append(root.getParent().getPath().makeRelative().toString());
		}
		if (referencedPostQualified) {
			try {
				IClasspathEntry referencingEntry= JavaModelUtil.getClasspathEntry(root).getReferencingEntry();
				if (referencingEntry != null) {
					fBuilder.append(NLS.bind(" (from {0} of {1})", new Object[] { Name.CLASS_PATH.toString(), referencingEntry.getPath().lastSegment() }));
				}
			} catch (JavaModelException e) {
				// ignore
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:28,代碼來源:JavaElementLabelComposer.java

示例4: appendFolderLabel

import org.eclipse.jdt.core.IPackageFragmentRoot; //導入方法依賴的package包/類
private void appendFolderLabel(IPackageFragmentRoot root, long flags) {
	IResource resource= root.getResource();
	if (resource == null) {
		appendExternalArchiveLabel(root, flags);
		return;
	}

	boolean rootQualified= getFlag(flags, JavaElementLabels.ROOT_QUALIFIED);
	boolean referencedQualified= getFlag(flags, JavaElementLabels.REFERENCED_ROOT_POST_QUALIFIED) && isReferenced(root);
	if (rootQualified) {
		fBuilder.append(root.getPath().makeRelative().toString());
	} else {
		IPath projectRelativePath= resource.getProjectRelativePath();
		if (projectRelativePath.segmentCount() == 0) {
			fBuilder.append(resource.getName());
			referencedQualified= false;
		} else {
			fBuilder.append(projectRelativePath.toString());
		}

		if (referencedQualified) {
			fBuilder.append(JavaElementLabels.CONCAT_STRING);
			fBuilder.append(resource.getProject().getName());
		} else if (getFlag(flags, JavaElementLabels.ROOT_POST_QUALIFIED)) {
			fBuilder.append(JavaElementLabels.CONCAT_STRING);
			fBuilder.append(root.getParent().getElementName());
		} else {
			return;
		}
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:32,代碼來源:JavaElementLabelComposer.java

示例5: isReferenced

import org.eclipse.jdt.core.IPackageFragmentRoot; //導入方法依賴的package包/類
/**
 * Returns <code>true</code> if the given package fragment root is
 * referenced. This means it is a descendant of a different project but is referenced
 * by the root's parent. Returns <code>false</code> if the given root
 * doesn't have an underlying resource.
 *
 * @param root the package fragment root
 * @return returns <code>true</code> if the given package fragment root is referenced
 */
private boolean isReferenced(IPackageFragmentRoot root) {
	IResource resource= root.getResource();
	if (resource != null) {
		IProject jarProject= resource.getProject();
		IProject container= root.getJavaProject().getProject();
		return !container.equals(jarProject);
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:19,代碼來源:JavaElementLabelComposer.java


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