Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356983

Summary: Custom tag hyperlink opens included JSP file.
Product: [WebTools] WTP Source Editing Reporter: Iwao AVE! <harawata>
Component: jst.jspAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: thatnitind
Version: unspecifiedFlags: nsand.dev: review+
Target Milestone: 3.3.2   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Fix hyperlink of custom tag file with include directive nsand.dev: iplog+

Description Iwao AVE! CLA 2011-09-07 13:57:22 EDT
Build Identifier: 20110615-0604

When a custom tag includes other JSP file using the 'include' directive, hyperlink of the custom tag opens the included JSP file instead of the custom tag file.

This happens because the location string of the custom tag is overwritten in the following method during processing the included JSP file.
org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD.loadTagFile(CMElementDeclarationImpl, IFile, boolean, InputStream)


Reproducible: Always

Steps to Reproduce:
1. Create a JSP file 'taglibs.jsp' in the webapp root directory.
<%@ taglib tagdir="/WEB-INF/tags" prefix="tags" %>

2. Create a custom tag file 'myfunc.tag' with the following line and place it into the /WEB-INF/tags directory.
<%@ include file="/taglibs.jsp" %>

3. Create another JSP file with the following line.
<tags:myfunc />

4. Command (or Control) + Click the custom tag to open myfunc.tag.

Expected:
myfunc.tag is opened.

Actual:
taglibs.jsp is opened.
Comment 1 Iwao AVE! CLA 2011-09-07 14:02:54 EDT
Created attachment 202924 [details]
Fix hyperlink of custom tag file with include directive

The patch modifies the following methods (I haven't tested .tagx file, but it seems to be the same).

org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD.loadTagFile(CMElementDeclarationImpl, IFile, boolean, InputStream)

org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD.loadTagXFile(CMElementDeclarationImpl, IFile, boolean, InputStream)
Comment 2 Nick Sandonato CLA 2011-09-07 15:29:12 EDT
Thanks for the patch! I think it looks pretty good. We're pretty late into SR1 right now, so I'll target it for SR2.
Comment 3 Nick Sandonato CLA 2011-11-14 16:46:32 EST
Code checked in. Thanks again!
Comment 4 Iwao AVE! CLA 2011-11-14 19:24:06 EST
Thank you for the review and the commit. :)