本文整理匯總了Java中org.eclipse.jdt.launching.JavaRuntime.getDefaultJREContainerEntry方法的典型用法代碼示例。如果您正苦於以下問題:Java JavaRuntime.getDefaultJREContainerEntry方法的具體用法?Java JavaRuntime.getDefaultJREContainerEntry怎麽用?Java JavaRuntime.getDefaultJREContainerEntry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.launching.JavaRuntime
的用法示例。
在下文中一共展示了JavaRuntime.getDefaultJREContainerEntry方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createClasspathEntries
import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
private IClasspathEntry[] createClasspathEntries(IJavaProject javaProject) {
IPath srcPath1 = javaProject.getPath().append("src/main/java");
IPath srcPath2 = javaProject.getPath().append("src/main/resources");
IPath srcPath3 = javaProject.getPath().append("src/test/java");
IPath srcPath4 = javaProject.getPath().append("src/test/resources");
IPath[] javaPath = new IPath[] { new Path("**/*.java") };
IPath testOutputLocation = javaProject.getPath().append("target/test-classes");
IPath srcPathUserLibrary = new Path(ActivitiPlugin.DESIGNER_EXTENSIONS_USER_LIB_PATH);
IClasspathEntry[] entries = { JavaCore.newSourceEntry(srcPath1, javaPath, null, null),
JavaCore.newSourceEntry(srcPath2, javaPath),
JavaCore.newSourceEntry(srcPath3, javaPath, null, testOutputLocation),
JavaCore.newSourceEntry(srcPath4, javaPath, testOutputLocation),
JavaRuntime.getDefaultJREContainerEntry(), JavaCore.newContainerEntry(srcPathUserLibrary) };
return entries;
}
示例2: createClasspathEntries
import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
private IClasspathEntry[] createClasspathEntries(IJavaProject javaProject) {
IPath srcPath1 = javaProject.getPath().append("src/main/java");
IPath srcPath2 = javaProject.getPath().append("src/main/resources");
IPath srcPath3 = javaProject.getPath().append("src/test/java");
IPath srcPath4 = javaProject.getPath().append("src/test/resources");
IPath[] javaPath = new IPath[] { new Path("**/*.java") };
IPath testOutputLocation = javaProject.getPath().append("target/test-classes");
IPath srcPathUserLibrary = new Path(ActivitiPlugin.DESIGNER_EXTENSIONS_USER_LIB_PATH);
IClasspathEntry[] entries = { JavaCore.newSourceEntry(srcPath1, javaPath, null, null), JavaCore.newSourceEntry(srcPath2, javaPath),
JavaCore.newSourceEntry(srcPath3, javaPath, null, testOutputLocation), JavaCore.newSourceEntry(srcPath4, javaPath, testOutputLocation),
JavaRuntime.getDefaultJREContainerEntry(), JavaCore.newContainerEntry(srcPathUserLibrary) };
return entries;
}
示例3: getJavaProject
import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
private IJavaProject getJavaProject() throws CoreException {
if (_javaProject == null) {
_javaProject = JavaCore.create(getProject());
IClasspathEntry[] buildPath = {
JavaRuntime.getDefaultJREContainerEntry(),
JavaCore.newContainerEntry(JUnitCore.JUNIT3_CONTAINER_PATH),
// JavaCore.newLibraryEntry(path, null, null)
JavaCore.newSourceEntry(getProject().getFullPath().append(srcFolderName))
};
_javaProject.setRawClasspath(buildPath, getProject().getFullPath().append(binFolderName), null);
}
return _javaProject;
}
示例4: createJavaProject
import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
public IProject createJavaProject(IProject project, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
if (project.exists()) {
return project;
}
JavaLanguageServerPlugin.logInfo("Creating the default Java project");
//Create project
project.create(monitor);
project.open(monitor);
//Turn into Java project
IProjectDescription description = project.getDescription();
description.setNatureIds(new String[] { JavaCore.NATURE_ID });
project.setDescription(description, monitor);
IJavaProject javaProject = JavaCore.create(project);
//Add build output folder
IFolder output = project.getFolder("bin");
if (!output.exists()) {
output.create(true, true, monitor);
}
javaProject.setOutputLocation(output.getFullPath(), monitor);
//Add source folder
IFolder source = project.getFolder("src");
if (!source.exists()) {
source.create(true, true, monitor);
}
IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(source);
IClasspathEntry src = JavaCore.newSourceEntry(root.getPath());
//Find default JVM
IClasspathEntry jre = JavaRuntime.getDefaultJREContainerEntry();
//Add JVM to project class path
javaProject.setRawClasspath(new IClasspathEntry[] { jre, src }, monitor);
JavaLanguageServerPlugin.logInfo("Finished creating the default Java project");
return project;
}
示例5: addSystemLibraries
import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
private void addSystemLibraries() throws JavaModelException {
final IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
final IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
newEntries[oldEntries.length] = JavaRuntime.getDefaultJREContainerEntry();
javaProject.setRawClasspath(newEntries, null);
}
示例6: createFakeCompiltationUnit
import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
/**
* Creates a fake compilation unit.
*
* @param editorInput the URI editor input
* @return the fake compilation unit
* @since 3.3
*/
private ICompilationUnit createFakeCompiltationUnit(IURIEditorInput editorInput) {
try {
final URI uri= editorInput.getURI();
final IFileStore fileStore= EFS.getStore(uri);
final IPath path= URIUtil.toPath(uri);
String fileStoreName= fileStore.getName();
if (fileStoreName == null || path == null)
return null;
WorkingCopyOwner woc= new WorkingCopyOwner() {
/*
* @see org.eclipse.jdt.core.WorkingCopyOwner#createBuffer(org.eclipse.jdt.core.ICompilationUnit)
* @since 3.2
*/
@Override
public IBuffer createBuffer(ICompilationUnit workingCopy) {
return new DocumentAdapter(workingCopy, fileStore, path);
}
};
IClasspathEntry[] cpEntries= null;
IJavaProject jp= findJavaProject(path);
if (jp != null)
cpEntries= jp.getResolvedClasspath(true);
if (cpEntries == null || cpEntries.length == 0)
cpEntries= new IClasspathEntry[] { JavaRuntime.getDefaultJREContainerEntry() };
final ICompilationUnit cu= woc.newWorkingCopy(fileStoreName, cpEntries, getProgressMonitor());
if (!isModifiable(editorInput))
JavaModelUtil.reconcile(cu);
return cu;
} catch (CoreException ex) {
return null;
}
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:46,代碼來源:CompilationUnitDocumentProvider.java