本文整理汇总了Java中org.eclipse.jdt.launching.JavaRuntime.getSourceContainers方法的典型用法代码示例。如果您正苦于以下问题:Java JavaRuntime.getSourceContainers方法的具体用法?Java JavaRuntime.getSourceContainers怎么用?Java JavaRuntime.getSourceContainers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.launching.JavaRuntime
的用法示例。
在下文中一共展示了JavaRuntime.getSourceContainers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeSourceContainers
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor)
throws CoreException {
List<IRuntimeClasspathEntry> entries = new ArrayList<IRuntimeClasspathEntry>();
IRuntimeClasspathEntry jreEntry = JavaRuntime.computeJREEntry(configuration);
if (jreEntry != null) {
entries.add(jreEntry);
}
String projectName = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
if (projectName == null) {
return null;
}
for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
IJavaProject javaProject = JavaCore.create(project);
if (javaProject != null && javaProject.isOpen() && ("".equals(projectName) || projectName.equals(javaProject.getElementName()))) { //$NON-NLS-1$
entries.add(JavaRuntime.newDefaultProjectClasspathEntry(javaProject));
}
}
IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath( //
entries.toArray(new IRuntimeClasspathEntry[entries.size()]), configuration);
return JavaRuntime.getSourceContainers(resolved);
}
示例2: fromJavaRuntimeResolver
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private ISourceContainer[] fromJavaRuntimeResolver() throws CoreException {
for (final IClasspathEntry cpe : jp.getRawClasspath()) {
if (IClasspathEntry.CPE_CONTAINER == cpe.getEntryKind() && //
IClasspathManager.CONTAINER_ID.equals(cpe.getPath().toString())) {
final IRuntimeClasspathEntry newRuntimeContainerClasspathEntry = JavaRuntime.newRuntimeContainerClasspathEntry(cpe.getPath(),
IRuntimeClasspathEntry.USER_CLASSES, jp);
final IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry = JavaRuntime.resolveRuntimeClasspathEntry(
newRuntimeContainerClasspathEntry, jp);
// there is only one maven2 classpath container in a project return
return JavaRuntime.getSourceContainers(resolveRuntimeClasspathEntry);
}
}
return new ISourceContainer[] {};
}
示例3: fromMavenSourcePathProvider
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private ISourceContainer[] fromMavenSourcePathProvider() throws CoreException {
final IRuntimeClasspathEntry mavenEntry = JavaRuntime.newRuntimeContainerClasspathEntry(new Path(IClasspathManager.CONTAINER_ID),
IRuntimeClasspathEntry.USER_CLASSES);
final ILaunchConfiguration launchConfiguration = getDirector().getLaunchConfiguration();
// final ILaunchConfigurationWorkingCopy wc = launchConfiguration.getWorkingCopy();
// wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, getProjectName());
// final ILaunchConfiguration doSave = wc.doSave();
final ILaunchConfiguration javaProjectLaunchConfiguration = new JavaProjectLaunchConfiguration(launchConfiguration, this);
final IRuntimeClasspathEntry[] resolved = mavenRuntimeClasspathProvider.resolveClasspath(new IRuntimeClasspathEntry[] {
mavenEntry
}, javaProjectLaunchConfiguration);
// final IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedSourceLookupPath(doSave);
// final IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath(entries, doSave);
return JavaRuntime.getSourceContainers(resolved);
}
示例4: getSourceContainers
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
ISourceContainer[] getSourceContainers() throws CoreException
{
runtimeClasspath.addAll(Arrays.asList(JavaRuntime.computeUnresolvedSourceLookupPath(configuration)));
IRuntimeClasspathEntry[] entries = (IRuntimeClasspathEntry[])runtimeClasspath.toArray(new IRuntimeClasspathEntry[runtimeClasspath.size()]);
IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath(entries,configuration);
return JavaRuntime.getSourceContainers(resolved);
}
示例5: computeSourceContainers
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public ISourceContainer[] computeSourceContainers(
ILaunchConfiguration configuration, IProgressMonitor monitor )
throws CoreException
{
List containers = new ArrayList( );
String path = getPath( configuration );
if ( path != null )
{
containers.add( new ScriptDirectorySourceContainer( new File( path ),
false ) );
}
// always use standard source path provider to avoid PDE setting overwritten
IRuntimeClasspathProvider scp = new StandardSourcePathProvider( );
IRuntimeClasspathEntry[] entries = scp.computeUnresolvedClasspath( configuration );
IRuntimeClasspathEntry[] resolved = scp.resolveClasspath( entries,
configuration );
ISourceContainer[] cts = JavaRuntime.getSourceContainers( resolved );
if ( cts != null )
{
for ( int i = 0; i < cts.length; i++ )
{
containers.add( cts[i] );
}
}
return (ISourceContainer[]) containers.toArray( new ISourceContainer[containers.size( )] );
}