|
Lines 244-249
Link Here
|
| 244 |
* EL Translator ID |
244 |
* EL Translator ID |
| 245 |
*/ |
245 |
*/ |
| 246 |
private String fELTranslatorID; |
246 |
private String fELTranslatorID; |
|
|
247 |
|
| 248 |
/** |
| 249 |
* <code>true</code> if code has been appended to a buffer for the current region, |
| 250 |
* <code>false</code> otherwise |
| 251 |
*/ |
| 252 |
private boolean fCodeAppended; |
| 253 |
|
| 254 |
/** |
| 255 |
* <code>true</code> if code has been found, such as HTML tags, that is not translated |
| 256 |
* <code>false</code> otherwise. Usefull for deciding if a place holder needs to be |
| 257 |
* writen to translation |
| 258 |
*/ |
| 259 |
private boolean fFoundNonTranslatedCode; |
| 247 |
|
260 |
|
| 248 |
/** |
261 |
/** |
| 249 |
* A structure for holding a region collection marker and list of variable |
262 |
* A structure for holding a region collection marker and list of variable |
|
Lines 488-493
Link Here
|
| 488 |
|
501 |
|
| 489 |
fELProblems = new ArrayList(); |
502 |
fELProblems = new ArrayList(); |
| 490 |
|
503 |
|
|
|
504 |
fCodeAppended = false; |
| 505 |
fFoundNonTranslatedCode = false; |
| 491 |
} |
506 |
} |
| 492 |
|
507 |
|
| 493 |
/** |
508 |
/** |
|
Lines 916-922
Link Here
|
| 916 |
setCurrentNode(fStructuredDocument.getFirstStructuredDocumentRegion()); |
931 |
setCurrentNode(fStructuredDocument.getFirstStructuredDocumentRegion()); |
| 917 |
|
932 |
|
| 918 |
while (getCurrentNode() != null && !isCanceled()) { |
933 |
while (getCurrentNode() != null && !isCanceled()) { |
| 919 |
|
934 |
//no code has been append for this region yet |
|
|
935 |
fCodeAppended = false; |
| 936 |
|
| 920 |
// intercept HTML comment flat node |
937 |
// intercept HTML comment flat node |
| 921 |
// also handles UNDEFINED (which is what CDATA comes in as) |
938 |
// also handles UNDEFINED (which is what CDATA comes in as) |
| 922 |
// basically this part will handle any "embedded" JSP containers |
939 |
// basically this part will handle any "embedded" JSP containers |
|
Lines 927-936
Link Here
|
| 927 |
// iterate through each region in the flat node |
944 |
// iterate through each region in the flat node |
| 928 |
translateRegionContainer(getCurrentNode(), STANDARD_JSP); |
945 |
translateRegionContainer(getCurrentNode(), STANDARD_JSP); |
| 929 |
} |
946 |
} |
|
|
947 |
|
| 948 |
/* if no code was appended for this region then we must |
| 949 |
* have found non translated code |
| 950 |
*/ |
| 951 |
if(!fCodeAppended) { |
| 952 |
fFoundNonTranslatedCode = true; |
| 953 |
} |
| 954 |
|
| 930 |
if (getCurrentNode() != null) |
955 |
if (getCurrentNode() != null) |
| 931 |
advanceNextNode(); |
956 |
advanceNextNode(); |
| 932 |
} |
957 |
} |
| 933 |
|
958 |
|
|
|
959 |
/* if previously found non translated code then write an empty expression |
| 960 |
* as a place holder to the user code translation |
| 961 |
*/ |
| 962 |
writePlaceHolderForNonTranslatedCode(); |
| 963 |
|
| 934 |
/* |
964 |
/* |
| 935 |
* Any contents left in the map indicate start tags that never had end |
965 |
* Any contents left in the map indicate start tags that never had end |
| 936 |
* tags. While the '{' that is present without the matching '}' would |
966 |
* tags. While the '{' that is present without the matching '}' would |
|
Lines 2113-2118
Link Here
|
| 2113 |
if (!nonl && !newText.endsWith(ENDL)) |
2143 |
if (!nonl && !newText.endsWith(ENDL)) |
| 2114 |
newText += ENDL; |
2144 |
newText += ENDL; |
| 2115 |
|
2145 |
|
|
|
2146 |
/* if previously found non translated code then write an empty expression |
| 2147 |
* as a place holder to the user code translation |
| 2148 |
*/ |
| 2149 |
writePlaceHolderForNonTranslatedCode(); |
| 2150 |
|
| 2116 |
if (buffer == fUserCode) { |
2151 |
if (buffer == fUserCode) { |
| 2117 |
buffer.append(newText); |
2152 |
buffer.append(newText); |
| 2118 |
if (addToMap) { |
2153 |
if (addToMap) { |
|
Lines 2370-2375
Link Here
|
| 2370 |
} |
2405 |
} |
| 2371 |
|
2406 |
|
| 2372 |
/** |
2407 |
/** |
|
|
2408 |
* Writes an empty expression to {@link #fUserCode} |
| 2409 |
* if previously found non translated code |
| 2410 |
*/ |
| 2411 |
private void writePlaceHolderForNonTranslatedCode() { |
| 2412 |
if(fFoundNonTranslatedCode) { |
| 2413 |
String text = (EXPRESSION_PREFIX + "\"\"" + EXPRESSION_SUFFIX + |
| 2414 |
" //non translated code placeholder"+ ENDL); |
| 2415 |
fUserCode.append(text); |
| 2416 |
fOffsetInUserCode += text.length(); |
| 2417 |
|
| 2418 |
fFoundNonTranslatedCode = false; |
| 2419 |
} |
| 2420 |
} |
| 2421 |
|
| 2422 |
/** |
| 2373 |
* Set the buffer to the current JSPType: STANDARD_JSP, EMBEDDED_JSP, |
2423 |
* Set the buffer to the current JSPType: STANDARD_JSP, EMBEDDED_JSP, |
| 2374 |
* DECLARATION, EXPRESSION, SCRIPTLET (for keepting track of cursor |
2424 |
* DECLARATION, EXPRESSION, SCRIPTLET (for keepting track of cursor |
| 2375 |
* position when the final document is built) |
2425 |
* position when the final document is built) |