当前位置: 首页>>代码示例>>Java>>正文


Java IPackageFragmentRoot.getPath方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.IPackageFragmentRoot.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java IPackageFragmentRoot.getPath方法的具体用法?Java IPackageFragmentRoot.getPath怎么用?Java IPackageFragmentRoot.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.IPackageFragmentRoot的用法示例。


在下文中一共展示了IPackageFragmentRoot.getPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: analyzeExternal

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
private AnalyzedNodes analyzeExternal(final IPackageFragmentRoot root)
    throws CoreException {
  IPath location = null;
  try {
    location = root.getPath();

    AnalyzedNodes nodes = cache.get(location);
    if (nodes != null) {
      return nodes;
    }

    final CoverageBuilder builder = new CoverageBuilder();
    final Analyzer analyzer = new Analyzer(executiondata, builder);
    new ResourceTreeWalker(analyzer).walk(location);
    nodes = new AnalyzedNodes(builder.getClasses(), builder.getSourceFiles());
    cache.put(location, nodes);
    return nodes;
  } catch (Exception e) {
    throw new CoreException(EclEmmaStatus.BUNDLE_ANALYSIS_ERROR.getStatus(
        root.getElementName(), location, e));
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:23,代码来源:PackageFragementRootAnalyzer.java

示例2: hasSources

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
public static boolean hasSources(IPackageFragmentRoot fragment) throws CoreException {
  if (fragment == null || fragment.getSourceAttachmentPath() == null) {
    return false;
  }
  IPath filePath = fragment.getPath();
  IPath sourcePath = fragment.getSourceAttachmentPath();
  if (isBinaryFragment(fragment)) {
    if (!Files.isRegularFile(Paths.get(sourcePath.toOSString()))) {
      return false;
    }
    return !Objects.equals(sourcePath, filePath);
  }
  return true;
}
 
开发者ID:fbricon,项目名称:pde.source.lookup,代码行数:15,代码来源:ClasspathUtils.java

示例3: getPathLabel

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
/**
 * Calculates a label for the class path of the given package fragment root.
 * For external entries this is the full path, otherwise it is the project
 * relative path.
 *
 * @param root
 *          package fragment root
 * @return label for the class path entry
 */
private static String getPathLabel(IPackageFragmentRoot root) {
  final IPath path = root.getPath();
  try {
    if (root.getKind() == IPackageFragmentRoot.K_BINARY) {
      return path.lastSegment();
    }
  } catch (JavaModelException e) {
    EclEmmaUIPlugin.log(e);
  }
  return path.removeFirstSegments(1).toString();
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:21,代码来源:ScopeViewer.java

示例4: getName

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
String getName(IPackageFragmentRoot root) {
  IPath path = root.getPath();
  if (!root.isExternal() && path.segmentCount() > 1) {
    return path.removeFirstSegments(1).toString();
  } else {
    return path.lastSegment();
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:9,代码来源:SessionAnalyzer.java

示例5: appendExternalArchiveLabel

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的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

示例6: packageChanged

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
protected IStatus packageChanged() {
	StatusInfo status = new StatusInfo();
	IPackageFragmentRoot root = getPackageFragmentRoot();
	IJavaProject project = root != null ? root.getJavaProject() : null;

	String packName = getPackageText().getText();
	if (packName.length() > 0) {
		IStatus val = validatePackageName(packName, project);
		if (val.getSeverity() == IStatus.ERROR) {
			status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
			return status;
		} else if (val.getSeverity() == IStatus.WARNING) {
			status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
			// continue
		}
	} else {
		status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged);
	}

	if (project != null) {
		if (project.exists() && packName.length() > 0) {
			try {
				IPath rootPath = root.getPath();
				IPath outputPath = project.getOutputLocation();
				if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
					// if the bin folder is inside of our root, don't allow
					// to name a package
					// like the bin folder
					IPath packagePath = rootPath.append(packName.replace('.', '/'));
					if (outputPath.isPrefixOf(packagePath)) {
						status.setError(NewWizardMessages.NewTypeWizardPage_error_ClashOutputLocation);
						return status;
					}
				}
			} catch (JavaModelException e) {
				JavaPlugin.log(e);
				// let pass
			}
		}

		fCurrPackage = root.getPackageFragment(packName);
		IResource resource = fCurrPackage.getResource();
		if (resource != null) {
			if (resource.isVirtual()) {
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageIsVirtual);
				return status;
			}
			if (!ResourcesPlugin.getWorkspace().validateFiltered(resource).isOK()) {
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageNameFiltered);
				return status;
			}
		}
	} else {
		status.setError("");
	}
	return status;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:58,代码来源:ExportToJavaBeanWizardPage.java

示例7: isOnClasspath

import org.eclipse.jdt.core.IPackageFragmentRoot; //导入方法依赖的package包/类
/**
 * This methods checks whether the given package fragment root is still on the
 * classpath. This check is required as the user might change the classpath
 * and old coverage sessions afterwards (SF #1836551).
 *
 * @param root
 *          package fragment root
 * @return true, if the classpath entry still exists
 * @throws JavaModelException
 */
private boolean isOnClasspath(IPackageFragmentRoot root)
    throws JavaModelException {
  IPath path = root.getPath();
  IJavaProject project = root.getJavaProject();
  return project.findPackageFragmentRoot(path) != null;
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:17,代码来源:TypeTraverser.java


注:本文中的org.eclipse.jdt.core.IPackageFragmentRoot.getPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。