/** * Copy the content in the directory with the given name located in the <code>test_data</code> * directory in the plug-in with the given id into the specified target directory. * * @param pluginId the id of the plug-in containing the project * @param projectName the name of the directory containing the project * @param targetDirectory the directory into which the content is copied. This directory is * created if it does not already exist * @throws IOException if a required file cannot be accessed */ public static void copyPluginRelativeContent( String pluginId, String projectName, File targetDirectory) throws IOException { URL pluginInstallUri = PluginUtilities.getInstallUrl(pluginId); URL sourceUrl = new URL(pluginInstallUri, PROJECT_DIRECTORY_NAME + "/" + projectName); IPath sourcePath = new Path(FileLocator.toFileURL(sourceUrl).getPath()); FileUtilities.copyDirectoryContents(sourcePath.toFile(), targetDirectory); }
/** * Return the absolute path to the resource within the specified plug-in with the given relative * path. * * @param pluginId the id of the plug-in containing the resource * @param relativePath the relative path of the resource within the project * @return the absolute path to the resource * @throws IOException if some portion of the path is invalid */ public static IPath getPluginRelativePath(String pluginId, IPath relativePath) throws IOException { IPath pluginPath = new Path(FileLocator.toFileURL(PluginUtilities.getInstallUrl(pluginId)).getPath()); return pluginPath.append(relativePath); }