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


Java IRuntimeClasspathEntry类代码示例

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


IRuntimeClasspathEntry类属于org.eclipse.jdt.launching包,在下文中一共展示了IRuntimeClasspathEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
		}
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:26,代码来源:TestResourceGeneration.java

示例2: computeUnresolvedClasspath

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的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

示例3: 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()]);
}
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:22,代码来源:MavenRuntimeClasspathProvider.java

示例4: addMavenClasspathEntries

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的package包/类
private void addMavenClasspathEntries(Set<IRuntimeClasspathEntry> resolved,
      IRuntimeClasspathEntry runtimeClasspathEntry, ILaunchConfiguration configuration, int scope,
      IProgressMonitor monitor) throws CoreException {
    IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
    MavenJdtPlugin plugin = MavenJdtPlugin.getDefault();
    IClasspathManager buildpathManager = plugin.getBuildpathManager();
    IClasspathEntry[] cp = buildpathManager.getClasspath(javaProject.getProject(), scope, false, monitor);
    for(IClasspathEntry entry : cp) {
      switch(entry.getEntryKind()) {
        case IClasspathEntry.CPE_PROJECT:
          addProjectEntries(resolved, entry.getPath(), scope, getArtifactClassifier(entry), configuration, monitor);
          break;
        case IClasspathEntry.CPE_LIBRARY:
          resolved.add(JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath()));
          break;
//        case IClasspathEntry.CPE_SOURCE:
//          resolved.add(newSourceClasspathEntry(javaProject, cp[i]));
//          break;
      }
    }
  }
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:22,代码来源:MavenRuntimeClasspathProvider.java

示例5: getRuntimeClasspaths

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的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

示例6: computeSourceContainers

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的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

示例7: fromJavaRuntimeResolver

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的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

示例8: fromMavenSourcePathProvider

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的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

示例9: resolveClasspath

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的package包/类
@Override
public IRuntimeClasspathEntry[] resolveClasspath(IRuntimeClasspathEntry[] entries,
    ILaunchConfiguration configuration) throws CoreException {

  IRuntimeClasspathEntry[] resolvedEntries = super.resolveClasspath(entries, configuration);

  IJavaProject proj = JavaRuntime.getJavaProject(configuration);
  if (proj == null) {
    return resolvedEntries;
  }

  List<IRuntimeClasspathEntry> resolvedEntriesList =
      new ArrayList<IRuntimeClasspathEntry>(Arrays.asList(resolvedEntries));

  return resolvedEntriesList.toArray(new IRuntimeClasspathEntry[resolvedEntriesList.size()]);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:17,代码来源:MavenClasspathProvider.java

示例10: createClassLoader

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的package包/类
@Override
public URLClassLoader createClassLoader() throws SdkException, MalformedURLException {
  IJavaProject userProject = findUserProject();
  if (userProject != null) {
    IRuntimeClasspathEntry outputEntry = JavaRuntime.newDefaultProjectClasspathEntry(userProject);
    try {
      IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry =
          JavaRuntime.resolveRuntimeClasspathEntry(outputEntry, userProject);
      List<URL> urls = new ArrayList<URL>();
      for (IRuntimeClasspathEntry entry : resolveRuntimeClasspathEntry) {
        urls.add(new File(entry.getLocation()).toURI().toURL());
      }

      return new URLClassLoader(urls.toArray(NO_URLS), null);

    } catch (CoreException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }

  // TODO Auto-generated method stub
  return null;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:GWTProjectsRuntime.java

示例11: computeClasspath

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的package包/类
private static String computeClasspath(GwtSdk gwtRuntime, String[] extraClassPath)
    throws CoreException {
  List<String> cpPaths = new ArrayList<String>();
  for (IClasspathEntry c : gwtRuntime.getClasspathEntries()) {
    if (c.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
      IJavaProject javaProject = JavaProjectUtilities.findJavaProject(c.getPath().toOSString());
      IRuntimeClasspathEntry projectRuntimeEntry = JavaRuntime.newDefaultProjectClasspathEntry(javaProject);
      IRuntimeClasspathEntry[] resolvedEntries = JavaRuntime.resolveRuntimeClasspathEntry(
          projectRuntimeEntry, javaProject);
      for (IRuntimeClasspathEntry resolvedEntry : resolvedEntries) {
        cpPaths.add(resolvedEntry.getLocation());
      }
    } else {
      cpPaths.add(c.getPath().toFile().getAbsolutePath());
    }
  }
  if (extraClassPath != null) {
    cpPaths.addAll(Arrays.asList(extraClassPath));
  }
  return ProcessUtilities.buildClasspathString(cpPaths);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:22,代码来源:WebAppProjectCreatorRunner.java

示例12: resolveClasspathEntries

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的package包/类
/**
 * Given a list of IClasspathEntry, produce an array of IRuntimeClasspathEntry based on that list.
 */
private IRuntimeClasspathEntry[] resolveClasspathEntries(List<IClasspathEntry> classpathEntries)
    throws CoreException {
  LinkedHashSet<IRuntimeClasspathEntry> runtimeClasspathEntries = new LinkedHashSet<IRuntimeClasspathEntry>();

  for (IClasspathEntry classpathEntry : classpathEntries) {
    if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
      String projectName = classpathEntry.getPath().lastSegment();
      IJavaProject theproject = JavaProjectUtilities.findJavaProject(projectName);

      IRuntimeClasspathEntry projectEntry = JavaRuntime.newProjectRuntimeClasspathEntry(theproject);
      runtimeClasspathEntries.add(projectEntry);
      runtimeClasspathEntries.addAll(dependenciesForProject(theproject));
    } else {
      runtimeClasspathEntries.add(JavaRuntime.newArchiveRuntimeClasspathEntry(classpathEntry.getPath()));
    }
  }

  return runtimeClasspathEntries.toArray(NO_ENTRIES);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:23,代码来源:RuntimeClasspathEntryResolver.java

示例13: prependClasspath

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的package包/类
@Override
public LaunchConfiguration prependClasspath(final String classPathEntry) {
	final IRuntimeClasspathEntry newEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(classPathEntry));
	try {
		this.workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
		final List<String> entries =
			this.workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, new ArrayList<>());
		if (entries.isEmpty()) {
			entries.add(JavaRuntime.newDefaultProjectClasspathEntry(this.launchedProject).getMemento());
		}
		entries.add(0, newEntry.getMemento());
		this.workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, entries);
	} catch (final CoreException coreException) {
		final FailureReport<LaunchConfiguration> failure =
			new FailureReport<LaunchConfiguration>().cause(coreException);
		return FAILURE_HANDLER.handle(failure);
	}
	return this;
}
 
开发者ID:Beagle-PSE,项目名称:Beagle,代码行数:20,代码来源:EclipseLaunchConfiguration.java

示例14: 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));
					}
				}
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:JavadocStandardWizardPage.java

示例15: getClasspath

import org.eclipse.jdt.launching.IRuntimeClasspathEntry; //导入依赖的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


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