| java.lang.Object org.eclipse.jdt.testplugin.JavaProjectHelper
JavaProjectHelper | public class JavaProjectHelper (Code) | | Helper methods to set up a IJavaProject.
|
Method Summary | |
public static IPackageFragmentRoot | addClassFolder(IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot) Creates and adds a class folder to the class path. | public static IPackageFragmentRoot | addClassFolderWithImport(IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot, File zipFile) Creates and adds a class folder to the class path and imports all files
contained in the given ZIP file. | public static IPackageFragmentRoot | addLibrary(IJavaProject jproject, IPath path) Adds a library entry to a IJavaProject. | public static IPackageFragmentRoot | addLibrary(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) Adds a library entry with source attachment to a IJavaProject. | public static IPackageFragmentRoot | addLibraryWithImport(IJavaProject jproject, IPath jarPath, IPath sourceAttachPath, IPath sourceAttachRoot) Copies the library into the project and adds it as library entry. | public static IPackageFragmentRoot | addRTJar(IJavaProject jproject) Adds a library entry pointing to a JRE (stubs only)
and sets the right compiler options. | public static IPackageFragmentRoot | addRTJar13(IJavaProject jproject) | public static void | addRequiredProject(IJavaProject jproject, IJavaProject required) Adds a required project entry. | public static IPackageFragmentRoot | addSourceContainer(IJavaProject jproject, String containerName) Adds a source container to a IJavaProject. | public static IPackageFragmentRoot | addSourceContainer(IJavaProject jproject, String containerName, IPath[] exclusionFilters) Adds a source container to a IJavaProject. | public static IPackageFragmentRoot | addSourceContainer(IJavaProject jproject, String containerName, IPath[] inclusionFilters, IPath[] exclusionFilters) Adds a source container to a IJavaProject. | public static IPackageFragmentRoot | addSourceContainerWithImport(IJavaProject jproject, String containerName, File zipFile, String containerEncoding) Adds a source container to a IJavaProject and imports all files contained
in the given ZIP file. | public static IPackageFragmentRoot | addSourceContainerWithImport(IJavaProject jproject, String containerName, File zipFile, String containerEncoding, IPath[] exclusionFilters) Adds a source container to a IJavaProject and imports all files contained
in the given ZIP file. | public static void | addToClasspath(IJavaProject jproject, IClasspathEntry cpe) | public static IPackageFragmentRoot | addVariableEntry(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) Adds a variable entry with source attachment to a IJavaProject. | public static IPackageFragmentRoot | addVariableRTJar(IJavaProject jproject, String libVarName, String srcVarName, String srcrootVarName) Adds a variable entry pointing to a current JRE (stubs only)
and sets the compiler compliance level on the project accordingly.
The arguments specify the names of the variables to be used.
Currently, the compiler compliance level is set to 1.5.
Parameters: jproject - the project to add the variable RT JAR Parameters: libVarName - Name of the variable for the library Parameters: srcVarName - Name of the variable for the source attachment. | public static IPackageFragmentRoot | addVariableRTJar13(IJavaProject jproject, String libVarName, String srcVarName, String srcrootVarName) | public static void | clear(IJavaProject jproject, IClasspathEntry[] entries) | public static IJavaProject | createJavaProject(String projectName, String binFolderName) Creates a IJavaProject. | public static IJavaProject | createJavaProjectWithJUnitSource(String projectName, String srcContainerName, String outputFolderName) Creates a Java project with JUnit source and rt.jar from
JavaProjectHelper.addVariableRTJar(IJavaProject,String,String,String) . | public static void | delete(IJavaElement elem) | public static IPath[] | findRtJar(IPath rtStubsPath) | public static void | importResources(IContainer importTarget, String bundleSourcePath) Imports resources from bundleSourcePath to importTarget . | public static void | performDummySearch() | public static void | removeFromClasspath(IJavaProject jproject, IPath path) | public static void | removeSourceContainer(IJavaProject jproject, String containerName) Removes a source folder from a IJavaProject. | public static void | set13CompilerOptions(Map options) | public static void | set14CompilerOptions(IJavaProject project) Sets the compiler options to 1.4 for the given project. | public static void | set14CompilerOptions(Map options) | public static void | set15CompilerOptions(IJavaProject project) Sets the compiler options to 1.5 for the given project. | public static void | set15CompilerOptions(Map options) | public static boolean | setAutoBuilding(boolean state) Sets auto-building state for the test workspace. |
COUNT_CLASSES_JUNIT_SRC_381 | final public static int COUNT_CLASSES_JUNIT_SRC_381(Code) | | |
COUNT_CLASSES_MYLIB | final public static int COUNT_CLASSES_MYLIB(Code) | | |
COUNT_CLASSES_RT_STUBS_15 | final public static int COUNT_CLASSES_RT_STUBS_15(Code) | | |
COUNT_INTERFACES_JUNIT_SRC_381 | final public static int COUNT_INTERFACES_JUNIT_SRC_381(Code) | | |
COUNT_INTERFACES_RT_STUBS_15 | final public static int COUNT_INTERFACES_RT_STUBS_15(Code) | | |
JUNIT_SRC_381 | final public static IPath JUNIT_SRC_381(Code) | | |
JUNIT_SRC_ENCODING | final public static String JUNIT_SRC_ENCODING(Code) | | |
MYLIB | final public static IPath MYLIB(Code) | | |
NLS_LIB | final public static IPath NLS_LIB(Code) | | |
RT_STUBS_15 | final public static IPath RT_STUBS_15(Code) | | |
addClassFolder | public static IPackageFragmentRoot addClassFolder(IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot) throws CoreException(Code) | | Creates and adds a class folder to the class path.
Parameters: jproject - The parent project Parameters: containerName - Parameters: sourceAttachPath - The source attachment path Parameters: sourceAttachRoot - The source attachment root path The handle of the created root throws: CoreException - |
addClassFolderWithImport | public static IPackageFragmentRoot addClassFolderWithImport(IJavaProject jproject, String containerName, IPath sourceAttachPath, IPath sourceAttachRoot, File zipFile) throws IOException, CoreException, InvocationTargetException(Code) | | Creates and adds a class folder to the class path and imports all files
contained in the given ZIP file.
Parameters: jproject - The parent project Parameters: containerName - Parameters: sourceAttachPath - The source attachment path Parameters: sourceAttachRoot - The source attachment root path Parameters: zipFile - The handle of the created root throws: IOException - throws: CoreException - throws: InvocationTargetException - |
addLibrary | public static IPackageFragmentRoot addLibrary(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) throws JavaModelException(Code) | | Adds a library entry with source attachment to a IJavaProject.
Parameters: jproject - The parent project Parameters: path - The path of the library to add Parameters: sourceAttachPath - The source attachment path Parameters: sourceAttachRoot - The source attachment root path The handle of the created root throws: JavaModelException - |
addLibraryWithImport | public static IPackageFragmentRoot addLibraryWithImport(IJavaProject jproject, IPath jarPath, IPath sourceAttachPath, IPath sourceAttachRoot) throws IOException, CoreException(Code) | | Copies the library into the project and adds it as library entry.
Parameters: jproject - The parent project Parameters: jarPath - Parameters: sourceAttachPath - The source attachment path Parameters: sourceAttachRoot - The source attachment root path The handle of the created root throws: IOException - throws: CoreException - |
addRTJar | public static IPackageFragmentRoot addRTJar(IJavaProject jproject) throws CoreException(Code) | | Adds a library entry pointing to a JRE (stubs only)
and sets the right compiler options.
Currently, the compiler compliance level is 1.5.
Parameters: jproject - target the new package fragment root throws: CoreException - |
addSourceContainer | public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName) throws CoreException(Code) | | Adds a source container to a IJavaProject.
Parameters: jproject - The parent project Parameters: containerName - The name of the new source container The handle to the new source container throws: CoreException - Creation failed |
addSourceContainer | public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName, IPath[] exclusionFilters) throws CoreException(Code) | | Adds a source container to a IJavaProject.
Parameters: jproject - The parent project Parameters: containerName - The name of the new source container Parameters: exclusionFilters - Exclusion filters to set The handle to the new source container throws: CoreException - Creation failed |
addSourceContainer | public static IPackageFragmentRoot addSourceContainer(IJavaProject jproject, String containerName, IPath[] inclusionFilters, IPath[] exclusionFilters) throws CoreException(Code) | | Adds a source container to a IJavaProject.
Parameters: jproject - The parent project Parameters: containerName - The name of the new source container Parameters: inclusionFilters - Inclusion filters to set Parameters: exclusionFilters - Exclusion filters to set The handle to the new source container throws: CoreException - Creation failed |
addSourceContainerWithImport | public static IPackageFragmentRoot addSourceContainerWithImport(IJavaProject jproject, String containerName, File zipFile, String containerEncoding) throws InvocationTargetException, CoreException, IOException(Code) | | Adds a source container to a IJavaProject and imports all files contained
in the given ZIP file.
Parameters: jproject - The parent project Parameters: containerName - Name of the source container Parameters: zipFile - Archive to import Parameters: containerEncoding - encoding for the generated source container The handle to the new source container throws: InvocationTargetException - Creation failed throws: CoreException - Creation failed throws: IOException - Creation failed |
addSourceContainerWithImport | public static IPackageFragmentRoot addSourceContainerWithImport(IJavaProject jproject, String containerName, File zipFile, String containerEncoding, IPath[] exclusionFilters) throws InvocationTargetException, CoreException, IOException(Code) | | Adds a source container to a IJavaProject and imports all files contained
in the given ZIP file.
Parameters: jproject - The parent project Parameters: containerName - Name of the source container Parameters: zipFile - Archive to import Parameters: containerEncoding - encoding for the generated source container Parameters: exclusionFilters - Exclusion filters to set The handle to the new source container throws: InvocationTargetException - Creation failed throws: CoreException - Creation failed throws: IOException - Creation failed |
addVariableEntry | public static IPackageFragmentRoot addVariableEntry(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) throws JavaModelException(Code) | | Adds a variable entry with source attachment to a IJavaProject.
Can return null if variable can not be resolved.
Parameters: jproject - The parent project Parameters: path - The variable path Parameters: sourceAttachPath - The source attachment path (variable path) Parameters: sourceAttachRoot - The source attachment root path (variable path) The added package fragment root throws: JavaModelException - |
addVariableRTJar | public static IPackageFragmentRoot addVariableRTJar(IJavaProject jproject, String libVarName, String srcVarName, String srcrootVarName) throws CoreException(Code) | | Adds a variable entry pointing to a current JRE (stubs only)
and sets the compiler compliance level on the project accordingly.
The arguments specify the names of the variables to be used.
Currently, the compiler compliance level is set to 1.5.
Parameters: jproject - the project to add the variable RT JAR Parameters: libVarName - Name of the variable for the library Parameters: srcVarName - Name of the variable for the source attachment. Can be null . Parameters: srcrootVarName - name of the variable for the source attachment root. Can be null . the new package fragment root throws: CoreException - Creation failed |
clear | public static void clear(IJavaProject jproject, IClasspathEntry[] entries) throws CoreException(Code) | | Removes all files in the project and sets the given classpath
Parameters: jproject - The project to clear Parameters: entries - The default class path to set throws: CoreException - Clearing the project failed |
createJavaProject | public static IJavaProject createJavaProject(String projectName, String binFolderName) throws CoreException(Code) | | Creates a IJavaProject.
Parameters: projectName - The name of the project Parameters: binFolderName - Name of the output folder Returns the Java project handle throws: CoreException - Project creation failed |
findRtJar | public static IPath[] findRtJar(IPath rtStubsPath) throws CoreException(Code) | | Parameters: rtStubsPath - the path to the RT stubs a rt.jar (stubs only) throws: CoreException - |
importResources | public static void importResources(IContainer importTarget, String bundleSourcePath) throws CoreException, IOException(Code) | | Imports resources from bundleSourcePath to importTarget .
Parameters: importTarget - the parent container Parameters: bundleSourcePath - the path to a folder containing resources throws: CoreException - import failed throws: IOException - import failed |
removeSourceContainer | public static void removeSourceContainer(IJavaProject jproject, String containerName) throws CoreException(Code) | | Removes a source folder from a IJavaProject.
Parameters: jproject - The parent project Parameters: containerName - Name of the source folder to remove throws: CoreException - Remove failed |
set13CompilerOptions | public static void set13CompilerOptions(Map options)(Code) | | Sets the compiler options to 1.3
Parameters: options - The compiler options to configure |
set14CompilerOptions | public static void set14CompilerOptions(IJavaProject project)(Code) | | Sets the compiler options to 1.4 for the given project.
Parameters: project - the java project |
set14CompilerOptions | public static void set14CompilerOptions(Map options)(Code) | | Sets the compiler options to 1.4
Parameters: options - The compiler options to configure |
set15CompilerOptions | public static void set15CompilerOptions(IJavaProject project)(Code) | | Sets the compiler options to 1.5 for the given project.
Parameters: project - the java project |
set15CompilerOptions | public static void set15CompilerOptions(Map options)(Code) | | Sets the compiler options to 1.5
Parameters: options - The compiler options to configure |
setAutoBuilding | public static boolean setAutoBuilding(boolean state) throws CoreException(Code) | | Sets auto-building state for the test workspace.
Parameters: state - The new auto building state The previous state throws: CoreException - Change failed |
|
|