Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2t-dev] Acceleo Builder not supporting projects in subdirectories

Hello again,

On Mon, 2011-03-14 at 21:42 +0100, Didier Villevalois wrote:
> Hello list,
> 
> We are willing to use Acceleo for a project that is in a subdirectory of
> our workspace (in a Maven module to be more precise).
> 
> We are getting a null pointer exception (stack trace follows).
> The problem seems to be [...]

I obviously misunderstood what was going on and forgot some stuff in the
patch. Here is the complete and working patch.

Thanks. Didier Villevalois.
Index: src/org/eclipse/acceleo/ide/ui/resources/AcceleoProject.java
===================================================================
RCS file: /cvsroot/modeling/org.eclipse.m2t/org.eclipse.acceleo/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/resources/AcceleoProject.java,v
retrieving revision 1.30
diff -u -r1.30 AcceleoProject.java
--- src/org/eclipse/acceleo/ide/ui/resources/AcceleoProject.java	10 Mar 2011 09:00:35 -0000	1.30
+++ src/org/eclipse/acceleo/ide/ui/resources/AcceleoProject.java	14 Mar 2011 22:47:43 -0000
@@ -250,11 +250,11 @@
 	 * @return the output file path
 	 */
 	public IPath getOutputFilePath(IFile fileAcceleo) {
-		IPath filePath = fileAcceleo.getFullPath();
+		IPath filePath = fileAcceleo.getRawLocation().makeRelativeTo(project.getRawLocation());
 		IFolder folder = getOutputFolder(project);
 		if (folder != null) {
 			for (Iterator<IPath> itSourceFolders = sourceFolders.iterator(); itSourceFolders.hasNext();) {
-				IPath sourcePath = itSourceFolders.next();
+				IPath sourcePath = itSourceFolders.next().makeRelativeTo(project.getFullPath());
 				if (sourcePath.isPrefixOf(filePath)) {
 					IPath relativePath = filePath.removeFirstSegments(sourcePath.segmentCount());
 					return folder.getFullPath().append(
@@ -323,9 +323,9 @@
 	 * @return the full name of the package, or an empty string if the file is not valid
 	 */
 	public String getPackageName(IFile fileAcceleo) {
-		IPath filePath = fileAcceleo.getFullPath();
+		IPath filePath = fileAcceleo.getRawLocation().makeRelativeTo(project.getRawLocation());
 		for (Iterator<IPath> itSourceFolders = sourceFolders.iterator(); itSourceFolders.hasNext();) {
-			IPath sourcePath = itSourceFolders.next();
+			IPath sourcePath = itSourceFolders.next().makeRelativeTo(project.getFullPath());
 			if (sourcePath.isPrefixOf(filePath)) {
 				StringBuffer name = new StringBuffer();
 				String[] segments = filePath.removeFirstSegments(sourcePath.segmentCount())

Back to the top