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


Java JavaRuntime.getSourceContainers方法代码示例

本文整理汇总了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);
}
 
开发者ID:eclipse,项目名称:cft,代码行数:27,代码来源:CloudFoundryDebugSourceLocator.java

示例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[] {};
}
 
开发者ID:bjmi,项目名称:m2e.sourcelookup,代码行数:18,代码来源:MyMvnSourceContainer.java

示例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);
  }
 
开发者ID:bjmi,项目名称:m2e.sourcelookup,代码行数:21,代码来源:MyMvnSourceContainer.java

示例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);
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:8,代码来源:JettySourcePathComputerDelegate.java

示例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( )] );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:33,代码来源:ScriptSourcePathComputerDelegate.java


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