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


Java JavaCore.newContainerEntry方法代码示例

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


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

示例1: addJunit4Libraries

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
/**
 * Add JUnit libraries to the passed project
 * 
 * @param project
 * @throws JavaModelException
 */
private static void addJunit4Libraries(IProject project) throws JavaModelException {
	IClasspathEntry entry = JavaCore.newContainerEntry(JUnitCore.JUNIT4_CONTAINER_PATH);
	IJavaProject javaProject = JavaCore.create(project);
	IClasspathEntry[] entries = javaProject.getRawClasspath();
	boolean junitFound = false;
	String s = entry.getPath().toString();
	for (int i = 0; i < entries.length; i++) {
		if (entries[i].getPath().toString().indexOf(s) != -1) {
			junitFound = true;
			break;
		}
	}
	if (!junitFound) {
		IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
		System.arraycopy(entries, 0, newEntries, 0, entries.length);
		newEntries[entries.length] = entry;
		javaProject.setRawClasspath(newEntries, null);
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:26,代码来源:ClasspathManager.java

示例2: addGW4EClassPathContainer

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
/**
 * Add GraphWalker libraries to the passed project
 * 
 * @param project
 * @throws JavaModelException
 */
public static void addGW4EClassPathContainer(IProject project) throws JavaModelException {
	if (hasGW4EClassPathContainer(project)) {
		return;
	}
	IJavaProject javaProject = JavaCore.create(project); 
	IClasspathEntry[] entries = javaProject.getRawClasspath();
	IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
	System.arraycopy(entries, 0, newEntries, 0, entries.length);
	Path lcp = new Path(GW4ELibrariesContainer.ID);
	IClasspathEntry libEntry = JavaCore.newContainerEntry(lcp, true);
	newEntries[entries.length] = JavaCore.newContainerEntry(libEntry.getPath(), true);
	javaProject.setRawClasspath(newEntries, null);
	 
  	addJunit4Libraries(project);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:22,代码来源:ClasspathManager.java

示例3: addGWClassPathEntry

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
public static void addGWClassPathEntry(IJavaProject javaProject) throws JavaModelException {
	IClasspathEntry[] entries = javaProject.getRawClasspath();
	IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
	System.arraycopy(entries, 0, newEntries, 0, entries.length);
	Path lcp = new Path(GW4ELibrariesContainer.ID);
	IClasspathEntry libEntry = JavaCore.newContainerEntry(lcp, true);
	newEntries[entries.length] = JavaCore.newContainerEntry(libEntry.getPath(), true);
	javaProject.setRawClasspath(newEntries, new NullProgressMonitor());
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:10,代码来源:ProjectHelper.java

示例4: getSelection

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
@Override
public IClasspathEntry getSelection()
{
	return JavaCore.newContainerEntry(JPFClasspathPlugin.CONTAINER_PATH);
}
 
开发者ID:equella,项目名称:Equella,代码行数:6,代码来源:JPFClasspathContainerPage.java


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