WOLipsProject woLipsProject = new WOLipsProject(newProjectHandle); woLipsProject.getNaturesAccessor().callConfigure();
	private void configNewProject(String[] natureIds, IProgressMonitor monitor)		throws InvocationTargetException {		switch (parentResource.getType()) {			// application project or framework project			case IResource.PROJECT :				final IProject newProjectHandle = (IProject) parentResource;				try {					IWorkspace workspace = ResourcesPlugin.getWorkspace();					final IProjectDescription description =						workspace.newProjectDescription(							newProjectHandle.getName());					description.setLocation(locationPath);					description.setNatureIds(natureIds);					if (!newProjectHandle.exists()) {						// set description only in this way						// to ensure project location is set						newProjectHandle.create(							description,							new SubProgressMonitor(monitor, 1000));					}					if (!newProjectHandle.isOpen()) {						newProjectHandle.open(null);					}					WOLipsProject woLipsProject = new WOLipsProject(newProjectHandle);					woLipsProject.getNaturesAccessor().callConfigure();				} catch (CoreException e) {					throw new InvocationTargetException(e);				}								// add wo classpath entries				IJavaProject myJavaProject = JavaCore.create(newProjectHandle);				try {					ProjectHelper.installBuilder(						myJavaProject.getProject(),						JavaCore.BUILDER_ID);				} catch (Exception anException) {					WOLipsLog.log(anException);				}				NodeList classpathNodeList =					elementForTemplate.getElementsByTagName("classpathentry");				ArrayList allClasspathEntriesResolved =					new ArrayList(classpathNodeList.getLength());				if (classpathNodeList.getLength() > 0) {					StringBuffer currentResolvedClassPath = null;					String currentRawPath = null;					String currentRawSourcePath = null;					String currentRawRootPath = null;					String variableToExpand = null;					String classpathKind = null;					IPath newClasspath = null;					IPath newSourcepath = null;					IPath newRootpath = null;					int index = -1;					for (int i = 0; i < classpathNodeList.getLength(); i++) {						classpathKind =							classpathNodeList								.item(i)								.getAttributes()								.getNamedItem("kind")								.getNodeValue();						currentRawPath =							classpathNodeList								.item(i)								.getAttributes()								.getNamedItem("path")								.getNodeValue();						if (classpathNodeList							.item(i)							.getAttributes()							.getNamedItem("sourcepath")							!= null) {							currentRawSourcePath =								classpathNodeList									.item(i)									.getAttributes()									.getNamedItem("sourcepath")									.getNodeValue();						}						if (classpathNodeList							.item(i)							.getAttributes()							.getNamedItem("rootpath")							!= null) {							currentRawRootPath =								classpathNodeList									.item(i)									.getAttributes()									.getNamedItem("rootpath")									.getNodeValue();						}						////////////////// kind "src"						if (IWOLipsPluginConstants							.EXT_SRC							.equals(classpathKind)) {							// set source path extension							if (!".".equals(currentRawPath) && false) {								currentRawPath += "."									+ IWOLipsPluginConstants.EXT_SRC;							} else if (false) {								// source path must be folder to create								// non-nested source path folder for subprojects								currentRawPath =									parentResource.getName()										+ "."										+ IWOLipsPluginConstants.EXT_SRC;							}							IPath sourcePath;							// is path project name depending							if (currentRawPath.indexOf("${project.name}")								!= -1) {								while ((index =									currentRawPath.indexOf("${project.name}"))									!= -1) {									StringBuffer resolvedOutputPath =										new StringBuffer(currentRawPath);									resolvedOutputPath.replace(										index,										index + "${project.name}".length(),										parentResource.getName());									currentRawPath =										resolvedOutputPath.toString();								}							}							sourcePath = new Path(currentRawPath);							IFolder sourceFolder;							sourceFolder =								newProjectHandle.getFolder(sourcePath);							if (!sourceFolder.exists()) {								// create source folder								try {									sourceFolder.create(true, true, monitor);								} catch (CoreException e) {									throw new InvocationTargetException(e);								}							}							allClasspathEntriesResolved.add(								JavaCore.newSourceEntry(									sourceFolder.getFullPath()));						}						////////////////// kind "lib"						if ("lib".equals(classpathKind)) {							currentResolvedClassPath =								new StringBuffer(currentRawPath);							for (int j = 0; j < variableList().size(); j++) {								variableToExpand =									(String) variableList().get(j);								// replace all occurences of "${" + variableToExpand + "}"								while ((index =									currentRawPath.indexOf(										"${" + variableToExpand + "}"))									!= -1) {									currentResolvedClassPath.replace(										index,										index + variableToExpand.length() + 3,										expandVariable(variableToExpand));									currentRawPath =										currentResolvedClassPath.toString();								}							}							newClasspath =								new Path(currentResolvedClassPath.toString());							allClasspathEntriesResolved.add(								JavaCore.newLibraryEntry(									newClasspath,									null,									null));						}						////////////////// kind "var"						else if ("var".equals(classpathKind)) {							newClasspath = new Path(currentRawPath);							if (currentRawSourcePath != null) {								newSourcepath = new Path(currentRawSourcePath);							}							if (currentRawRootPath != null) {								newRootpath = new Path(currentRawRootPath);							}							allClasspathEntriesResolved.add(								JavaCore.newVariableEntry(									newClasspath,									newSourcepath,									newRootpath));						}						////////////////// kind "output						else if ("output".equals(classpathKind)) {							IPath absoluteOutputPath = null;							// is path project name depending							if (currentRawPath.indexOf("${project.name}")								!= -1) {								while ((index =									currentRawPath.indexOf("${project.name}"))									!= -1) {									StringBuffer resolvedOutputPath =										new StringBuffer(currentRawPath);									resolvedOutputPath.replace(										index,										index + "${project.name}".length(),										parentResource.getName());									currentRawPath =										resolvedOutputPath.toString();								}								absoluteOutputPath =									parentResource.getFullPath().append(										currentRawPath);							} else {								absoluteOutputPath = new Path(currentRawPath);							}							if (absoluteOutputPath.isAbsolute()) {								try {									myJavaProject.setOutputLocation(										absoluteOutputPath,										monitor);								} catch (JavaModelException e) {									throw new InvocationTargetException(e);								}							}						}					}				}				try {					Object[] classPathEntriesAsObjects =						allClasspathEntriesResolved.toArray();					IClasspathEntry[] classPathEntries =						new IClasspathEntry[classPathEntriesAsObjects.length];					for (int i = 0; i < classPathEntries.length; i++) {						classPathEntries[i] =							(IClasspathEntry) classPathEntriesAsObjects[i];					}					myJavaProject.setRawClasspath(classPathEntries, monitor);				} catch (JavaModelException e) {					throw new InvocationTargetException(e);				}				break;			case IResource.FOLDER :				// subproject				IFolder newSubproject = (IFolder) parentResource;				IFolder newSubprojectSourceFolder =					newSubproject.getFolder(						new Path(IWOLipsPluginConstants.EXT_SRC));				try {					if (!parentResource.exists()) {						createResourceFolderInProject(newSubproject, monitor);					}					if (!newSubprojectSourceFolder.exists()) {						newSubprojectSourceFolder.create(false, true, monitor);					}				} catch (CoreException e) {					throw new InvocationTargetException(e);				}				ProjectHelper.addNewSourcefolderToClassPath(					newSubprojectSourceFolder,					monitor);				// subproject				break;			default :				throw new InvocationTargetException(					new Exception("Wrong parent resource - check validation"));		}	}