Good point about having the same HTML file in different packages... I'll 
take a look into that and update the code to handle it.

The problem I was seeing was the under Maven, the HTML file lives in a 
completely separate package (ie src/main/resources/com/foo/Bar.html) 
instead of alongside the Java code (ie src/main/java/com/foo/Bar.java). 
Maven will then deal with merging the resources and java code during 
it's build, so I really don't want to specify an alternative path... 
since during the build it's really in the same folder. I just need to 
adjust the source path where we're doing the lookup...

It shouldn't be a big deal to modify it... I'll get the update in later 
tonight (I hope!).

And I'm not in a big hurry for a merge; I'm running off my locally built 
copy!

Steve

On 04/22/2014 11:17 AM, Christian Sadilek wrote:
>
> In src/org/jboss/errai/idea/plugin/ui/TemplateUtil.java:
>
> > @@ -389,6 +390,15 @@ private static TemplateMetaData getTemplateMetaData(PsiAnnotation annotation, Pr
> >        fileByRelativePath = null;
> >      }
> >
> > +	// if we didn't find the file in the current container,
> > +	// look for it by it's name (ie it might be under resources)
> > +    if (fileByRelativePath == null) {
> > +      PsiFile[] files = FilenameIndex.getFilesByName(project, fileName, projectScope(project));
> > +      if (files.length == 1) {
> > +        fileByRelativePath = files[0].getVirtualFile();
> > +      }
> > +    }
> > +
>
> This seems to find template files regardless of their package. If a 
> class is annotated with @Templated("MyTemplate.html") then 
> MyTemplate.html needs to reside in the same package as the annotated 
> class unless an alternative path was specified (i.e. 
> "../../MyTemplate.html"). I don't know the intellij APIs but 
> FilenameIndex.getFilesByName seems to find MyTemplate.html in any 
> location? This is a problem as it could potentially find a file with 
> the same name in a different package which would cause a failure at 
> rebind time. Can we make this change package sensitive?
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/errai/errai-intellij-idea-plugin/pull/3/files#r11858347>.
>