本文整理汇总了Java中org.eclipse.jdt.launching.IVMInstall类的典型用法代码示例。如果您正苦于以下问题:Java IVMInstall类的具体用法?Java IVMInstall怎么用?Java IVMInstall使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IVMInstall类属于org.eclipse.jdt.launching包,在下文中一共展示了IVMInstall类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAllVMs
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
/**
* This method will fetch and set All Available JVMs in Dropdown
*/
private void setAllVMs() {
final List<IVMInstall> allVMs = new ArrayList<>();
final IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
for (final IVMInstallType vmType : vmTypes) {
final IVMInstall[] vms = vmType.getVMInstalls();
for (final IVMInstall vm : vms) {
allVMs.add(vm);
}
}
this.jvmNamesAndValues = new String[allVMs.size()][2];
for (int i = 0; i < allVMs.size(); i++) {
this.jvmNamesAndValues[i][0] = allVMs.get(i).getName();
this.jvmNamesAndValues[i][1] = allVMs.get(i).getId();
}
}
示例2: fixRuntimeEnvironment
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的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 );
}
}
示例3: getVMInstall
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
protected IVMInstall getVMInstall() {
IVMInstall vmInstall = null;
// Try using the very same VM the Toolbox is running with (e.g.
// this avoids problems when the Toolbox runs with a 64bit VM, but
// the nested VM is a 32bit one).
final String javaHome = System.getProperty("java.home");
if (javaHome != null) {
final IVMInstallType installType = new StandardVMType();
vmInstall = installType.createVMInstall("TLCModelCheckerNestedVM");
vmInstall.setInstallLocation(new File(javaHome));
return vmInstall;
}
// get OS default VM (determined by path) not necessarily the same
// the toolbox is running with.
return JavaRuntime.getDefaultVMInstall();
}
示例4: getVMInstall
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
public IVMInstall getVMInstall() {
if (getVMInstallTypeId() == null)
return JavaRuntime.getDefaultVMInstall();
try {
IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
int size = vmInstalls.length;
String id = getVMInstallId();
for (int i = 0; i < size; i++) {
if (id.equals(vmInstalls[i].getId()))
return vmInstalls[i];
}
}
catch (Exception e) {
// ignore
}
return null;
}
示例5: getJavaExecutableForVMInstall
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
public static String getJavaExecutableForVMInstall(IVMInstall vmInstall) throws CoreException {
assert vmInstall != null;
File vmInstallLocation = vmInstall.getInstallLocation();
if (vmInstallLocation == null) {
throw new CoreException(new Status(Status.ERROR, CorePlugin.PLUGIN_ID,
"Unable to determine the path for the JVM " + vmInstall.getName()
+ ". Please verify that this JVM is installed properly by inspecting your project's build path."));
}
File javaExecutable = StandardVMType.findJavaExecutable(vmInstallLocation);
if (javaExecutable == null || !javaExecutable.exists()) {
throw new CoreException(new Status(Status.ERROR, CorePlugin.PLUGIN_ID,
"Unable to find a java executable for the JVM " + vmInstall.getName() + " located at "
+ vmInstallLocation.getAbsolutePath()
+ ". Please verify that this JVM is installed properly by inspecting your project's build path."));
}
return javaExecutable.getAbsolutePath();
}
示例6: eclipseAndJvmSupportedJavaVersion
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
/** TopCoder supports java 1.8. */
private static String eclipseAndJvmSupportedJavaVersion() {
boolean jvm18Installed = false;
for(IVMInstallType vm : JavaRuntime.getVMInstallTypes()) {
for(IVMInstall inst : vm.getVMInstalls()) {
if(inst instanceof IVMInstall2) {
String jvmVersion = ((IVMInstall2) inst).getJavaVersion();
String[] jvmVersionParts = jvmVersion.split("\\.");
int major = Integer.parseInt(jvmVersionParts[0]);
int minor = Integer.parseInt(jvmVersionParts[1]);
if((major == 1 && minor >= 8) || major >=2) {
jvm18Installed = true;
}
}
}
}
Version jdtVersion = JavaCore.getJavaCore().getBundle().getVersion();
boolean jdtSupports18 = jdtVersion.getMajor() >= 4
|| (jdtVersion.getMajor() == 3 && jdtVersion.getMinor() >= 10)
|| (jdtVersion.getMajor() == 3 && jdtVersion.getMinor() >= 9 && jdtVersion.getMicro() >= 50);
return jvm18Installed && jdtSupports18 ? "1.8" : "1.7";
}
示例7: processVMInstallType
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
private void processVMInstallType(IVMInstallType installType, List locations, List labels) {
if (installType != null) {
IVMInstall[] installs= installType.getVMInstalls();
boolean isMac= Platform.OS_MACOSX.equals(Platform.getOS());
final String HOME_SUFFIX= "/Home"; //$NON-NLS-1$
for (int i= 0; i < installs.length; i++) {
String label= getFormattedLabel(installs[i].getName());
LibraryLocation[] libLocations= installs[i].getLibraryLocations();
if (libLocations != null) {
processLibraryLocation(libLocations, label);
} else {
String filePath= installs[i].getInstallLocation().getAbsolutePath();
// on MacOS X install locations end in an additional "/Home" segment; remove it
if (isMac && filePath.endsWith(HOME_SUFFIX))
filePath= filePath.substring(0, filePath.length()- HOME_SUFFIX.length() + 1);
locations.add(filePath);
labels.add(label);
}
}
}
}
示例8: is50OrHigherJRE
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的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);
}
示例9: getDefaultEEName
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
private String getDefaultEEName() {
IVMInstall defaultVM= JavaRuntime.getDefaultVMInstall();
IExecutionEnvironment[] environments= JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments();
if (defaultVM != null) {
for (int i= 0; i < environments.length; i++) {
IVMInstall eeDefaultVM= environments[i].getDefaultVM();
if (eeDefaultVM != null && defaultVM.getId().equals(eeDefaultVM.getId()))
return environments[i].getId();
}
}
String defaultCC=JavaModelUtil.VERSION_LATEST;
if (defaultVM instanceof IVMInstall2)
defaultCC= JavaModelUtil.getCompilerCompliance((IVMInstall2)defaultVM, defaultCC);
for (int i= 0; i < environments.length; i++) {
String eeCompliance= JavaModelUtil.getExecutionEnvironmentCompliance(environments[i]);
if (defaultCC.endsWith(eeCompliance))
return environments[i].getId();
}
return "JavaSE-1.7"; //$NON-NLS-1$
}
示例10: findRequiredOrGreaterVMInstall
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
private IVMInstall findRequiredOrGreaterVMInstall() {
String bestMatchingCompliance= null;
IVMInstall bestMatchingVMInstall= null;
IVMInstallType[] installTypes= JavaRuntime.getVMInstallTypes();
for (int i= 0; i < installTypes.length; i++) {
IVMInstall[] installs= installTypes[i].getVMInstalls();
for (int k= 0; k < installs.length; k++) {
String vmInstallCompliance= getVMInstallCompliance(installs[k]);
if (fRequiredVersion.equals(vmInstallCompliance)) {
return installs[k]; // perfect match
} else if (JavaModelUtil.isVersionLessThan(vmInstallCompliance, fRequiredVersion)) {
continue; // no match
} else if (bestMatchingVMInstall != null) {
if (JavaModelUtil.isVersionLessThan(bestMatchingCompliance, vmInstallCompliance)) {
continue; // the other one is the least matching
}
}
bestMatchingCompliance= vmInstallCompliance;
bestMatchingVMInstall= installs[k];
}
}
return null;
}
示例11: processVMInstallType
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
private void processVMInstallType(IVMInstallType installType, List<IPath> locations, List<String> labels) {
if (installType != null) {
IVMInstall[] installs= installType.getVMInstalls();
boolean isMac= Platform.OS_MACOSX.equals(Platform.getOS());
for (int i= 0; i < installs.length; i++) {
String label= getFormattedLabel(installs[i].getName());
LibraryLocation[] libLocations= installs[i].getLibraryLocations();
if (libLocations != null) {
processLibraryLocation(libLocations, label);
} else {
IPath filePath= Path.fromOSString(installs[i].getInstallLocation().getAbsolutePath());
// On MacOS X, install locations end in an additional "/Home" segment; remove it.
if (isMac && "Home".equals(filePath.lastSegment())) //$NON-NLS-1$
filePath= filePath.removeLastSegments(1);
locations.add(filePath);
labels.add(label);
}
}
}
}
示例12: getVMInstall
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
public IVMInstall getVMInstall()
{
if (getVMInstallTypeId() == null)
return JavaRuntime.getDefaultVMInstall();
try
{
IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
int size = vmInstalls.length;
String id = getVMInstallId();
for (int i = 0; i < size; i++)
{
if (id.equals(vmInstalls[i].getId()))
return vmInstalls[i];
}
}
catch (Exception e)
{
JettyPlugin.log(e);
}
return null;
}
示例13: is50OrHigherJRE
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的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);
}
示例14: processVMInstallType
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
private void processVMInstallType(IVMInstallType installType, List<String> locations, List<String> labels) {
if (installType != null) {
IVMInstall[] installs= installType.getVMInstalls();
boolean isMac= Platform.OS_MACOSX.equals(Platform.getOS());
final String HOME_SUFFIX= "/Home"; //$NON-NLS-1$
for (int i= 0; i < installs.length; i++) {
String label= getFormattedLabel(installs[i].getName());
LibraryLocation[] libLocations= installs[i].getLibraryLocations();
if (libLocations != null) {
processLibraryLocation(libLocations, label);
} else {
String filePath= installs[i].getInstallLocation().getAbsolutePath();
// on MacOS X install locations end in an additional
// "/Home" segment; remove it
if (isMac && filePath.endsWith(HOME_SUFFIX))
filePath= filePath.substring(0, filePath.length() - HOME_SUFFIX.length() + 1);
locations.add(filePath);
labels.add(label);
}
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:23,代码来源:FilteredTypesSelectionDialog.java
示例15: addClassPathEntries
import org.eclipse.jdt.launching.IVMInstall; //导入依赖的package包/类
public void addClassPathEntries() {
try {
final ArrayList<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
final IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
LibraryLocation[] _libraryLocations = JavaRuntime.getLibraryLocations(vmInstall);
final Consumer<LibraryLocation> _function = new Consumer<LibraryLocation>() {
@Override
public void accept(final LibraryLocation eachLocation) {
IPath _systemLibraryPath = eachLocation.getSystemLibraryPath();
IClasspathEntry _newLibraryEntry = JavaCore.newLibraryEntry(_systemLibraryPath, null, null);
entries.add(_newLibraryEntry);
}
};
((List<LibraryLocation>)Conversions.doWrapArray(_libraryLocations)).forEach(_function);
int _size = entries.size();
IClasspathEntry[] _newArrayOfSize = new IClasspathEntry[_size];
IClasspathEntry[] _array = entries.<IClasspathEntry>toArray(_newArrayOfSize);
this.javaProject.setRawClasspath(_array, null);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}