本文整理汇总了Java中org.eclipse.jdt.launching.JavaRuntime.getVMInstall方法的典型用法代码示例。如果您正苦于以下问题:Java JavaRuntime.getVMInstall方法的具体用法?Java JavaRuntime.getVMInstall怎么用?Java JavaRuntime.getVMInstall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.launching.JavaRuntime
的用法示例。
在下文中一共展示了JavaRuntime.getVMInstall方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fixRuntimeEnvironment
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
protected void fixRuntimeEnvironment( String platformDir )
{
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( "platform" );
IJavaProject javaProject = JavaCore.create( project );
IVMInstall javaInstall = null;
try
{
if(javaProject.isOpen())
{
javaInstall = JavaRuntime.getVMInstall( javaProject );
}
}
catch( CoreException e )
{
throw new IllegalStateException( e );
}
if( javaInstall != null )
{
setHeapSize( javaInstall );
}
}
示例2: is50OrHigherJRE
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
* Checks if the JRE of the given project or workspace default JRE have source compliance 1.5 or
* greater.
*
* @param project the project to test or <code>null</code> to test the workspace JRE
* @return <code>true</code> if the JRE of the given project or workspace default JRE have
* source compliance 1.5 or greater.
* @throws CoreException if unable to determine the project's VM install
*/
public static boolean is50OrHigherJRE(IJavaProject project) throws CoreException {
IVMInstall vmInstall;
if (project == null) {
vmInstall= JavaRuntime.getDefaultVMInstall();
} else {
vmInstall= JavaRuntime.getVMInstall(project);
}
if (!(vmInstall instanceof IVMInstall2))
return true; // assume 1.5.
String compliance= getCompilerCompliance((IVMInstall2) vmInstall, null);
if (compliance == null)
return true; // assume 1.5
return is50OrHigher(compliance);
}
示例3: is50OrHigherJRE
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
* Checks if the JRE of the given project or workspace default JRE have source compliance 1.5 or
* greater.
*
* @param project the project to test or <code>null</code> to test the workspace JRE
* @return <code>true</code> if the JRE of the given project or workspace default JRE have
* source compliance 1.5 or greater.
* @throws CoreException if unable to determine the project's VM install
*/
public static boolean is50OrHigherJRE(IJavaProject project) throws CoreException {
IVMInstall vmInstall;
if (project == null) {
vmInstall= JavaRuntime.getDefaultVMInstall();
} else {
vmInstall= JavaRuntime.getVMInstall(project);
}
if (!(vmInstall instanceof IVMInstall2))
return true; // assume 1.5.
String compliance= getCompilerCompliance((IVMInstall2) vmInstall, null);
if (compliance == null)
return true; // assume 1.5
return compliance.startsWith(JavaCore.VERSION_1_5)
|| compliance.startsWith(JavaCore.VERSION_1_6)
|| compliance.startsWith(JavaCore.VERSION_1_7);
}
示例4: getJavaHome
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
* Returns the project Java home path.
* @param project the target project
* @return the project Java home path, or {@code null} if it is not defined
*/
public static File getJavaHome(IProject project) {
if (isJavaProject(project) == false) {
return getJavaHome();
}
IJavaProject javaProject = JavaCore.create(project);
try {
IVMInstall install = JavaRuntime.getVMInstall(javaProject);
if (install == null) {
return null;
}
return toJavaHome(install);
} catch (CoreException e) {
LogUtil.log(e.getStatus());
return null;
}
}
示例5: buildOfflineShellFile
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public static File buildOfflineShellFile(IJavaProject jproject, IFile graphModel, String pathGenerator,
String startElement) throws CoreException, IOException {
IRuntimeClasspathEntry e = JavaRuntime.computeJREEntry(jproject);
IVMInstall intall = JavaRuntime.getVMInstall(e.getPath());
StringBuilder sb = new StringBuilder();
File javaLocation = intall.getInstallLocation();
sb.append(javaLocation.getAbsolutePath()).append(File.separator).append("bin").append(File.separator)
.append("java").append(" -cp ").append("\"");
String cpSeparator = "";
String[] classpath = JavaRuntime.computeDefaultRuntimeClassPath(jproject);
for (String cpElement : classpath) {
sb.append(cpSeparator).append(cpElement);
cpSeparator = System.getProperty("path.separator");
}
sb.append("\"").append(" org.graphwalker.cli.CLI ").append(" offline ").append(" -m ")
.append(ResourceManager.toFile(graphModel.getFullPath()).getAbsolutePath()).append(" \"")
.append(pathGenerator).append("\" ").append(" -e ").append(startElement).append(" --verbose ");
String extension = isWindows() ? "bat" : "sh";
Path path = Files.createTempFile("offlineShellRunner", "." + extension);
Files.write(path, sb.toString().getBytes(StandardCharsets.UTF_8));
File file = path.toFile();
ResourceManager.logInfo(jproject.getProject().getName(), "Shell file : " + file.getAbsolutePath());
return file;
}
示例6: getProjectVm
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private static Path getProjectVm(IProject project) {
try {
IJavaProject javaProject = JavaCore.create(project);
IVMInstall vmInstall = JavaRuntime.getVMInstall(javaProject);
if (vmInstall != null) {
return vmInstall.getInstallLocation().toPath();
}
} catch (CoreException ex) {
// Give up.
}
return null;
}
示例7: computeJavaExecutableFullyQualifiedPath
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
* Computes the fully qualified path to the java executable for the JRE/JDK used by this project.
*
* @param javaProject
* @return the path to the JRE/JDK java (executable) used on this project
* @throws CoreException
*/
public static String computeJavaExecutableFullyQualifiedPath(IJavaProject javaProject) throws CoreException {
IVMInstall projectVMInstall = JavaRuntime.getVMInstall(javaProject);
if (projectVMInstall == null) {
throw new CoreException(new Status(Status.ERROR, CorePlugin.PLUGIN_ID, "Unable to locate the JVM for project "
+ javaProject.getElementName()
+ ". Please verify that you have a project-level JVM installed by inspecting your project's build path."));
}
return getJavaExecutableForVMInstall(projectVMInstall);
}
示例8: getAdditionalProposalInfo
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
@Override
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
StringBuffer message= new StringBuffer();
if (fChangeOnWorkspace) {
message.append(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_required_compliance_changeworkspace_description, fRequiredVersion));
} else {
message.append(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_required_compliance_changeproject_description, fRequiredVersion));
}
try {
IVMInstall install= JavaRuntime.getVMInstall(fProject); // can be null
if (fChangeOnWorkspace) {
IVMInstall vmInstall= findRequiredOrGreaterVMInstall();
if (vmInstall != null) {
IVMInstall defaultVM= JavaRuntime.getDefaultVMInstall(); // can be null
if (defaultVM != null && !defaultVM.equals(install)) {
message.append(CorrectionMessages.ReorgCorrectionsSubProcessor_50_compliance_changeProjectJREToDefault_description);
}
if (defaultVM == null || !isRequiredOrGreaterVMInstall(defaultVM)) {
message.append(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_50_compliance_changeWorkspaceJRE_description, vmInstall.getName()));
}
}
} else {
IExecutionEnvironment bestEE= findBestMatchingEE();
if (bestEE != null) {
if (install == null || !isEEOnClasspath(bestEE)) {
message.append(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_50_compliance_changeProjectJRE_description, bestEE.getId()));
}
}
}
} catch (CoreException e) {
// ignore
}
return message.toString();
}
示例9: validateComplianceStatus
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private void validateComplianceStatus() {
if (fJRE50InfoText != null && !fJRE50InfoText.isDisposed()) {
boolean isVisible= false;
String compliance= getStoredValue(PREF_COMPLIANCE); // get actual value
IVMInstall install= null;
if (fProject != null) { // project specific settings: only test if a 50 JRE is installed
try {
install= JavaRuntime.getVMInstall(JavaCore.create(fProject));
} catch (CoreException e) {
JavaPlugin.log(e);
}
} else {
install= JavaRuntime.getDefaultVMInstall();
}
if (install instanceof IVMInstall2) {
String compilerCompliance= JavaModelUtil.getCompilerCompliance((IVMInstall2) install, compliance);
if (!compilerCompliance.equals(compliance)) { // Discourage using compiler with version other than compliance
String[] args= { getVersionLabel(compliance), getVersionLabel(compilerCompliance) };
if (fProject == null) {
fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info, args));
} else {
fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info_project, args));
}
isVisible= true;
}
}
// String source= getValue(PREF_SOURCE_COMPATIBILITY);
// if (VERSION_1_8.equals(source)) {
// fJRE50InfoText.setText("This is an implementation of an early-draft specification developed under the Java Community Process (JCP) and is made available for testing and evaluation purposes only. The code is not compatible with any specification of the JCP."); //$NON-NLS-1$
// isVisible= true;
// }
fJRE50InfoText.setVisible(isVisible);
fJRE50InfoImage.setImage(isVisible ? JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING) : null);
fJRE50InfoImage.getParent().layout();
}
}
示例10: validateComplianceStatus
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private void validateComplianceStatus() {
if (fJRE50InfoText != null && !fJRE50InfoText.isDisposed()) {
boolean isVisible= false;
String compliance= getStoredValue(PREF_COMPLIANCE); // get actual value
IVMInstall install= null;
if (fProject != null) { // project specific settings: only test if a 50 JRE is installed
try {
install= JavaRuntime.getVMInstall(JavaCore.create(fProject));
} catch (CoreException e) {
JavaPlugin.log(e);
}
} else {
install= JavaRuntime.getDefaultVMInstall();
}
if (install instanceof IVMInstall2) {
String compilerCompliance= JavaModelUtil.getCompilerCompliance((IVMInstall2) install, compliance);
if (!compilerCompliance.equals(compliance)) { // Discourage using compiler with version other than compliance
String[] args= { getVersionLabel(compliance), getVersionLabel(compilerCompliance) };
if (fProject == null) {
fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info, args));
} else {
fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info_project, args));
}
isVisible= true;
}
}
fJRE50InfoText.setVisible(isVisible);
fJRE50InfoImage.setImage(isVisible ? JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING) : null);
fJRE50InfoImage.getParent().layout();
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:32,代码来源:ComplianceConfigurationBlock.java