throws CoreException, InvocationTargetException, InterruptedException {
throws CoreException, InvocationTargetException {
	public void createSubproject(IProgressMonitor monitor)			throws CoreException, InvocationTargetException,			InterruptedException {		IFolder subprojectFolder = null;		switch (parentResource.getType()) {		case IResource.PROJECT:			subprojectFolder = ((IProject) parentResource)					.getFolder(subprojectName);			break;		case IResource.FOLDER:			subprojectFolder = ((IFolder) parentResource)					.getFolder(subprojectName);			break;		default:			throw new InvocationTargetException(new Exception(					"Wrong parent resource - check validation"));		}		subprojectFolder.create(false, true, monitor);		String path = subprojectFolder.getLocation().toOSString();		TemplateEngine templateEngine = new TemplateEngine();		try {			templateEngine.init();		} catch (Exception e) {			WizardsPlugin.getDefault().getPluginLogger().log(e);			throw new InvocationTargetException(e);		}		templateEngine.getWolipsContext().setProjectName(subprojectName);		templateEngine.addTemplate(new TemplateDefinition(				"subproject/PB.project.vm", path, "PB.project", "PB.project"));		try {			templateEngine.run(new NullProgressMonitor());		} catch (Exception e) {			WizardsPlugin.getDefault().getPluginLogger().log(e);			throw new InvocationTargetException(e);		}				subprojectFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);				IFolder sourceFolder;		sourceFolder = subprojectFolder.getFolder(IWOLipsModel.EXT_SRC);		if (!sourceFolder.exists()) {			// create source folder			try {				sourceFolder.create(true, true, monitor);			} catch (CoreException e) {				throw new InvocationTargetException(e);			}		}		IJavaProject javaProject = JavaCore.create(parentResource.getProject());		IClasspathEntry classpathEntry = JavaCore.newSourceEntry(sourceFolder.getFullPath());		IClasspathEntry[] classpathEntries = javaProject.getRawClasspath();		IClasspathEntry[] newClasspathEntries = new IClasspathEntry[classpathEntries.length + 1];		System.arraycopy(classpathEntries, 0, newClasspathEntries, 0, classpathEntries.length);		newClasspathEntries[classpathEntries.length] = classpathEntry;		javaProject.setRawClasspath(newClasspathEntries, monitor);	}