KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > launching > Standard11xVMType


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.launching;
12
13
14 import java.io.File JavaDoc;
15
16 import org.eclipse.core.runtime.IPath;
17 import org.eclipse.core.runtime.Path;
18 import org.eclipse.jdt.launching.IVMInstall;
19 import org.eclipse.jdt.launching.LibraryLocation;
20
21 /**
22  * A VM install type for VMs the conform to the 1.1.x standard
23  * JDK installion layout, and command line options.
24  */

25 public class Standard11xVMType extends StandardVMType {
26         
27     /**
28      * @see org.eclipse.jdt.internal.launching.StandardVMType#getDefaultSystemLibrary(java.io.File)
29      */

30     protected IPath getDefaultSystemLibrary(File JavaDoc installLocation) {
31         return new Path(installLocation.getPath()).append("lib").append("classes.zip"); //$NON-NLS-2$ //$NON-NLS-1$
32
}
33
34     /**
35      * @see org.eclipse.jdt.launching.AbstractVMInstallType#doCreateVMInstall(java.lang.String)
36      */

37     protected IVMInstall doCreateVMInstall(String JavaDoc id) {
38         return new Standard11xVM(this, id);
39     }
40     
41     /**
42      * @see org.eclipse.jdt.internal.launching.StandardVMType#getDefaultSystemLibrarySource(java.io.File)
43      */

44     protected IPath getDefaultSystemLibrarySource(File JavaDoc libLocation) {
45         setDefaultRootPath(""); //$NON-NLS-1$
46
return Path.EMPTY;
47     }
48     
49     /* (non-Javadoc)
50      * @see org.eclipse.jdt.launching.IVMInstallType#getName()
51      */

52     public String JavaDoc getName() {
53         return LaunchingMessages.Standard11xVMType_Standard_1_1_x_VM_1;
54     }
55     
56     /**
57      * Returns <code>null</code> - not supported.
58      *
59      * @see StandardVMType#getDefaultExtensionDirectory(File)
60      */

61     protected File JavaDoc getDefaultExtensionDirectory(File JavaDoc installLocation) {
62         return null;
63     }
64     
65     /**
66      * @see org.eclipse.jdt.internal.launching.StandardVMType#getDefaultEndorsedDirectory(java.io.File)
67      */

68     protected File JavaDoc getDefaultEndorsedDirectory(File JavaDoc installLocation) {
69         return null;
70     }
71
72     /**
73      * @see org.eclipse.jdt.launching.IVMInstallType#getDefaultLibraryLocations(java.io.File)
74      */

75     public LibraryLocation[] getDefaultLibraryLocations(File JavaDoc installLocation) {
76         IPath libPath = getDefaultSystemLibrary(installLocation);
77         File JavaDoc lib = libPath.toFile();
78         if (lib.exists()) {
79             return new LibraryLocation[] {new LibraryLocation(libPath, getDefaultSystemLibrarySource(lib), getDefaultPackageRootPath())};
80         }
81         return new LibraryLocation[0];
82     }
83
84     /**
85      * Return <code>true</code> if the appropriate system libraries can be found for the
86      * specified java executable, <code>false</code> otherwise.
87      */

88     protected boolean canDetectDefaultSystemLibraries(File JavaDoc javaHome, File JavaDoc javaExecutable) {
89         LibraryLocation[] locations = getDefaultLibraryLocations(javaHome);
90         String JavaDoc version = getVMVersion(javaHome, javaExecutable);
91         return locations.length > 0 && version.startsWith("1.1"); //$NON-NLS-1$
92
}
93 }
94
Popular Tags