当前位置: 首页>>代码示例>>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;未经允许,请勿转载。