本文整理汇总了Java中org.eclipse.jdt.launching.IRuntimeClasspathEntry.getType方法的典型用法代码示例。如果您正苦于以下问题:Java IRuntimeClasspathEntry.getType方法的具体用法?Java IRuntimeClasspathEntry.getType怎么用?Java IRuntimeClasspathEntry.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.launching.IRuntimeClasspathEntry
的用法示例。
在下文中一共展示了IRuntimeClasspathEntry.getType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectClassPath
import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入方法依赖的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: resolveClasspath0
import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入方法依赖的package包/类
IRuntimeClasspathEntry[] resolveClasspath0(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration,
IProgressMonitor monitor) throws CoreException {
int scope = getArtifactScope(configuration);
Set<IRuntimeClasspathEntry> all = new LinkedHashSet<>(entries.length);
for(IRuntimeClasspathEntry entry : entries) {
if(entry.getType() == IRuntimeClasspathEntry.CONTAINER
&& MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) {
addMavenClasspathEntries(all, entry, configuration, scope, monitor);
} else if(entry.getType() == IRuntimeClasspathEntry.PROJECT) {
IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
if(javaProject.getPath().equals(entry.getPath())) {
addProjectEntries(all, entry.getPath(), scope, THIS_PROJECT_CLASSIFIER, configuration, monitor);
} else {
addStandardClasspathEntries(all, entry, configuration);
}
} else {
addStandardClasspathEntries(all, entry, configuration);
}
}
return all.toArray(new IRuntimeClasspathEntry[all.size()]);
}
示例3: collectReferencedElements
import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入方法依赖的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: resolveRuntimeClasspathEntry
import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入方法依赖的package包/类
public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry,
IJavaProject project) throws CoreException {
if (!(entry instanceof IRuntimeClasspathEntry2)) {
if (entry.getType() == IRuntimeClasspathEntry.CONTAINER) {
return computeDefaultContainerEntries(entry, project);
}
return new IRuntimeClasspathEntry[] {entry};
}
IRuntimeClasspathEntry[] entries = ((IRuntimeClasspathEntry2) entry).getRuntimeClasspathEntries(null);
List<IRuntimeClasspathEntry> resolved = new ArrayList<>();
for (IRuntimeClasspathEntry ent : entries) {
IRuntimeClasspathEntry[] temp = JavaRuntime.resolveRuntimeClasspathEntry(ent, project);
Collections.addAll(resolved, temp);
}
return resolved.toArray(new IRuntimeClasspathEntry[resolved.size()]);
}
示例5: findGWTSdk
import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入方法依赖的package包/类
private GwtSdk findGWTSdk(IRuntimeClasspathEntry entry) {
GwtSdk gwtSdk = GWTPreferences.getSdkManager().findSdkForPath(entry.getPath());
if (gwtSdk != null) {
return gwtSdk;
}
/*
* If the project for which we're trying to resolve these entries is a GWT runtime project, and
* the entry that we're trying to resolve is actually the the GWT Runtime project itself, then
* we'll synthesize a contributor SDK and return that.
*/
if (entry.getType() != IRuntimeClasspathEntry.PROJECT) {
return null;
}
String entryProjectName = entry.getPath().lastSegment();
IJavaProject entryJavaProject = JavaProjectUtilities.findJavaProject(entryProjectName);
if (entryJavaProject != null && GWTProjectsRuntime.isGWTRuntimeProject(entryJavaProject)) {
gwtSdk = GWTProjectsRuntime.syntheziseContributorRuntime();
if (gwtSdk.validate().isOK()) {
return gwtSdk;
}
}
return null;
}