本文整理汇总了Java中org.eclipse.jdt.launching.JavaRuntime.computeUnresolvedRuntimeClasspath方法的典型用法代码示例。如果您正苦于以下问题:Java JavaRuntime.computeUnresolvedRuntimeClasspath方法的具体用法?Java JavaRuntime.computeUnresolvedRuntimeClasspath怎么用?Java JavaRuntime.computeUnresolvedRuntimeClasspath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.launching.JavaRuntime
的用法示例。
在下文中一共展示了JavaRuntime.computeUnresolvedRuntimeClasspath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectClassPath
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public static void getProjectClassPath(IJavaProject project, List<File> dst) throws Exception {
IRuntimeClasspathEntry [] rentries = JavaRuntime.computeUnresolvedRuntimeClasspath(project);
for (IRuntimeClasspathEntry entry : rentries) {
switch (entry.getType()) {
case IClasspathEntry.CPE_SOURCE:
break;
case IClasspathEntry.CPE_PROJECT:
break;
case IClasspathEntry.CPE_LIBRARY:
break;
case IClasspathEntry.CPE_VARIABLE:
// JRE like entries
IRuntimeClasspathEntry [] variableEntries = JavaRuntime.resolveRuntimeClasspathEntry(entry, project);
break;
case IClasspathEntry.CPE_CONTAINER:
IRuntimeClasspathEntry [] containerEntries = JavaRuntime.resolveRuntimeClasspathEntry(entry, project);
for (IRuntimeClasspathEntry containerentry : containerEntries) {
dst.add(new File (containerentry.getLocation()));
}
break;
default:
throw new Exception("unsupported classpath entry "+entry);
}
}
}
示例2: getRuntimeClasspaths
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
protected IPath[] getRuntimeClasspaths(ILaunchConfiguration configuration)
throws CoreException {
IRuntimeClasspathEntry[] entries = JavaRuntime
.computeUnresolvedRuntimeClasspath(configuration);
entries = JavaRuntime.resolveRuntimeClasspath(entries, configuration);
ArrayList<IPath> userEntries = new ArrayList<IPath>(entries.length);
for (int i = 0; i < entries.length; i++) {
if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
String location = entries[i].getLocation();
if (location != null) {
IPath entry = Path.fromOSString(location);
if (!userEntries.contains(entry)) {
userEntries.add(entry);
}
}
}
}
return userEntries.toArray(new IPath[userEntries.size()]);
}
示例3: collectReferencedElements
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private void collectReferencedElements(IJavaProject project, HashSet<JavadocLinkRef> result) throws CoreException {
IRuntimeClasspathEntry[] unresolved = JavaRuntime.computeUnresolvedRuntimeClasspath(project);
for (int i= 0; i < unresolved.length; i++) {
IRuntimeClasspathEntry curr= unresolved[i];
if (curr.getType() == IRuntimeClasspathEntry.PROJECT) {
result.add(new JavadocLinkRef(JavaCore.create((IProject) curr.getResource())));
} else {
IRuntimeClasspathEntry[] entries= JavaRuntime.resolveRuntimeClasspathEntry(curr, project);
for (int k = 0; k < entries.length; k++) {
IRuntimeClasspathEntry entry= entries[k];
if (entry.getType() == IRuntimeClasspathEntry.PROJECT) {
result.add(new JavadocLinkRef(JavaCore.create((IProject) entry.getResource())));
} else if (entry.getType() == IRuntimeClasspathEntry.ARCHIVE) {
IClasspathEntry classpathEntry= entry.getClasspathEntry();
if (classpathEntry != null) {
IPath containerPath= null;
if (curr.getType() == IRuntimeClasspathEntry.CONTAINER) {
containerPath= curr.getPath();
}
result.add(new JavadocLinkRef(containerPath, classpathEntry, project));
}
}
}
}
}
}
示例4: getClasspath
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private static IPath[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
IRuntimeClasspathEntry[] entries= JavaRuntime.computeUnresolvedRuntimeClasspath(configuration);
entries= JavaRuntime.resolveRuntimeClasspath(entries, configuration);
ArrayList<IPath> userEntries= new ArrayList<IPath>(entries.length);
for (int i= 0; i < entries.length; i++) {
if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
String location= entries[i].getLocation();
if (location != null) {
IPath entry= Path.fromOSString(location);
if (!userEntries.contains(entry)) {
userEntries.add(entry);
}
}
}
}
return userEntries.toArray(new IPath[userEntries.size()]);
}
示例5: computeUnresolvedClasspath
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
@Override
public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException
{
boolean useDefault = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true);
if (!useDefault)
{
// recover persisted classpath
return recoverRuntimePath(configuration, IJavaLaunchConfigurationConstants.ATTR_CLASSPATH);
}
Path lcp = new Path(LeJOSEV3LibContainer.ID+"/"+LeJOSEV3Util.LIBSUBDIR_EV3);
IJavaProject proj = JavaRuntime.getJavaProject(configuration);
if (proj == null)
{
IRuntimeClasspathEntry rte = JavaRuntime.newRuntimeContainerClasspathEntry(lcp, IRuntimeClasspathEntry.STANDARD_CLASSES);
return new IRuntimeClasspathEntry[] { rte };
}
return JavaRuntime.computeUnresolvedRuntimeClasspath(proj);
}
示例6: getSourceContainers
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private static ISourceContainer[] getSourceContainers(IJavaProject project, Set<IRuntimeClasspathEntry> calculated) {
if (project == null || !project.exists()) {
return new ISourceContainer[0];
}
try {
IRuntimeClasspathEntry[] unresolved = JavaRuntime.computeUnresolvedRuntimeClasspath(project);
List<IRuntimeClasspathEntry> resolved = new ArrayList<>();
for (IRuntimeClasspathEntry entry : unresolved) {
for (IRuntimeClasspathEntry resolvedEntry : JavaRuntime.resolveRuntimeClasspathEntry(entry, project)) {
if (!calculated.contains(resolvedEntry)) {
calculated.add(resolvedEntry);
resolved.add(resolvedEntry);
}
}
}
Set<ISourceContainer> containers = new LinkedHashSet<>();
containers.addAll(Arrays.asList(
JavaRuntime.getSourceContainers(resolved.toArray(new IRuntimeClasspathEntry[0]))));
// Due to a known jdt java 9 support bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=525840,
// it would miss some JRE libraries source containers when the debugger is running on JDK9.
// As a workaround, recompute the possible source containers for JDK9 jrt-fs.jar libraries.
IRuntimeClasspathEntry jrtFs = resolved.stream().filter(entry -> {
return entry.getType() == IRuntimeClasspathEntry.ARCHIVE && entry.getPath().lastSegment().equals("jrt-fs.jar");
}).findFirst().orElse(null);
if (jrtFs != null && project.isOpen()) {
IPackageFragmentRoot[] allRoots = project.getPackageFragmentRoots();
for (IPackageFragmentRoot root : allRoots) {
if (root.getPath().equals(jrtFs.getPath()) && isSourceAttachmentEqual(root, jrtFs)) {
containers.add(new PackageFragmentRootSourceContainer(root));
}
}
}
return containers.toArray(new ISourceContainer[0]);
} catch (CoreException ex) {
// do nothing.
}
return new ISourceContainer[0];
}