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


Java JavaRuntime.newRuntimeContainerClasspathEntry方法代码示例

本文整理汇总了Java中org.eclipse.jdt.launching.JavaRuntime.newRuntimeContainerClasspathEntry方法的典型用法代码示例。如果您正苦于以下问题:Java JavaRuntime.newRuntimeContainerClasspathEntry方法的具体用法?Java JavaRuntime.newRuntimeContainerClasspathEntry怎么用?Java JavaRuntime.newRuntimeContainerClasspathEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.launching.JavaRuntime的用法示例。


在下文中一共展示了JavaRuntime.newRuntimeContainerClasspathEntry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeUnresolvedClasspath

import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
@Override
public IRuntimeClasspathEntry[] computeUnresolvedClasspath(final ILaunchConfiguration configuration)
      throws CoreException {
    boolean useDefault = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true);
    if(useDefault) {
      IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
      IRuntimeClasspathEntry jreEntry = JavaRuntime.computeJREEntry(configuration);
      IRuntimeClasspathEntry projectEntry = JavaRuntime.newProjectRuntimeClasspathEntry(javaProject);
      IRuntimeClasspathEntry mavenEntry = JavaRuntime.newRuntimeContainerClasspathEntry(new Path(
          IClasspathManager.CONTAINER_ID), IRuntimeClasspathEntry.USER_CLASSES);

      if(jreEntry == null) {
        return new IRuntimeClasspathEntry[] {projectEntry, mavenEntry};
      }

      return new IRuntimeClasspathEntry[] {jreEntry, projectEntry, mavenEntry};
    }

    return recoverRuntimePath(configuration, IJavaLaunchConfigurationConstants.ATTR_CLASSPATH);
  }
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:21,代码来源:MavenRuntimeClasspathProvider.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: 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

示例5: launch

import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public void launch() throws CoreException{
	DerbyPlugin plugin = DerbyPlugin.getDefault();

	// constructs a classpath from the default JRE...
	IPath systemLibs = new Path(JavaRuntime.JRE_CONTAINER);
	IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(
		systemLibs, IRuntimeClasspathEntry.STANDARD_CLASSES);
	systemLibsEntry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
	//include com.pivotal.gemfirexd.internal.core plugin
	IRuntimeClasspathEntry derbyCPEntry = null;
	List classpath = new ArrayList();
	classpath.add(systemLibsEntry.getMemento());
	
	try {
		ManifestElement[] elements_core, elements_ui;
		elements_core = getElements(CommonNames.CORE_PATH);
		elements_ui=getElements(CommonNames.UI_PATH);
		
		Bundle bundle;
		URL pluginURL,jarURL,localURL;
		bundle=Platform.getBundle(CommonNames.CORE_PATH);
		pluginURL = bundle.getEntry("/");
		for(int i=0;i<elements_core.length;i++){
			if(!elements_core[i].getValue().toLowerCase().endsWith("derbynet.jar")){
				jarURL= new URL(pluginURL,elements_core[i].getValue());
				localURL=Platform.asLocalURL(jarURL);
				derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
				derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
				classpath.add(derbyCPEntry.getMemento());
			}
		}
		bundle=Platform.getBundle(CommonNames.CORE_PATH);
		pluginURL = bundle.getEntry("/");
		for(int i=0;i<elements_ui.length;i++){
			if(!elements_ui[i].getValue().toLowerCase().equals("ui.jar")){
				jarURL= new URL(pluginURL,elements_ui[i].getValue());
				localURL=Platform.asLocalURL(jarURL);
				derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
				derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
				classpath.add(derbyCPEntry.getMemento());
			}
		}
	}
	catch(Exception e) {
		e.printStackTrace();
		Logger.log("Error in launch() "+e,IStatus.ERROR);
	}

}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:50,代码来源:DerbyUtils.java

示例6: addProjectEntries

import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
protected void addProjectEntries(Set<IRuntimeClasspathEntry> resolved, IPath path, int scope, String classifier,
      ILaunchConfiguration launchConfiguration, final IProgressMonitor monitor) throws CoreException {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IProject project = root.getProject(path.segment(0));

    IMavenProjectFacade projectFacade = projectManager.create(project, monitor);
    if(projectFacade == null) {
      return;
    }

    ResolverConfiguration configuration = projectFacade.getResolverConfiguration();
    if(configuration == null) {
      return;
    }

    IJavaProject javaProject = JavaCore.create(project);

    boolean projectResolved = false;

    for(IClasspathEntry entry : javaProject.getRawClasspath()) {
      IRuntimeClasspathEntry rce = null;
      switch(entry.getEntryKind()) {
        case IClasspathEntry.CPE_SOURCE:
          if(!projectResolved) {

            IMavenClassifierManager mavenClassifierManager = MavenJdtPlugin.getDefault().getMavenClassifierManager();
            IClassifierClasspathProvider classifierClasspathProvider = mavenClassifierManager
                .getClassifierClasspathProvider(projectFacade, classifier);

            if(IClasspathManager.CLASSPATH_TEST == scope) {
              classifierClasspathProvider.setTestClasspath(resolved, projectFacade, monitor);
            } else {
              classifierClasspathProvider.setRuntimeClasspath(resolved, projectFacade, monitor);
            }

            projectResolved = true;
          }
          break;
        case IClasspathEntry.CPE_CONTAINER:
          IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject);
          if(container != null && !MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) {
            switch(container.getKind()) {
              case IClasspathContainer.K_APPLICATION:
                rce = JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(),
                    IRuntimeClasspathEntry.USER_CLASSES, javaProject);
                break;
//                case IClasspathContainer.K_DEFAULT_SYSTEM:
//                  unresolved.add(JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.STANDARD_CLASSES, javaProject));
//                  break;
//                case IClasspathContainer.K_SYSTEM:
//                  unresolved.add(JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.BOOTSTRAP_CLASSES, javaProject));
//                  break;
            }
          }
          break;
        case IClasspathEntry.CPE_LIBRARY:
          rce = JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath());
          break;
        case IClasspathEntry.CPE_VARIABLE:
          if(!JavaRuntime.JRELIB_VARIABLE.equals(entry.getPath().segment(0))) {
            rce = JavaRuntime.newVariableRuntimeClasspathEntry(entry.getPath());
          }
          break;
        case IClasspathEntry.CPE_PROJECT:
          IProject res = root.getProject(entry.getPath().segment(0));
          if(res != null) {
            IJavaProject otherProject = JavaCore.create(res);
            if(otherProject != null) {
              rce = JavaRuntime.newDefaultProjectClasspathEntry(otherProject);
            }
          }
          break;
        default:
          break;
      }
      if(rce != null) {
        addStandardClasspathEntries(resolved, rce, launchConfiguration);
      }
    }
  }
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:81,代码来源:MavenRuntimeClasspathProvider.java


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