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


Java JavaRuntime.computeUnresolvedRuntimeClasspath方法代碼示例

本文整理匯總了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);
		}
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:26,代碼來源:TestResourceGeneration.java

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

示例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));
					}
				}
			}
		}
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:27,代碼來源:JavadocStandardWizardPage.java

示例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()]);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:20,代碼來源:FatJarPackageWizardPage.java

示例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);		
}
 
開發者ID:JanKoehnlein,項目名稱:XRobot,代碼行數:22,代碼來源:LaunchEV3ClasspathProvider.java

示例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];
}
 
開發者ID:Microsoft,項目名稱:java-debug,代碼行數:43,代碼來源:JdtUtils.java


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