本文整理汇总了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);
}
}
示例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);
}
示例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());
}
示例4: getSelection
import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
@Override
public IClasspathEntry getSelection()
{
return JavaCore.newContainerEntry(JPFClasspathPlugin.CONTAINER_PATH);
}