### Eclipse Workspace Patch 1.0 #P org.jboss.tools.jsf.vpe.jsf Index: templates/vpe-templates-jsf.xml =================================================================== --- templates/vpe-templates-jsf.xml (revision 32289) +++ templates/vpe-templates-jsf.xml (working copy) @@ -8,6 +8,15 @@ prefix="f" /> + + + + + + + @@ -1188,11 +1197,6 @@ - - - - #P org.jboss.tools.vpe.test Index: scheme/scheme.xsd =================================================================== --- scheme/scheme.xsd (revision 32289) +++ scheme/scheme.xsd (working copy) @@ -119,6 +119,7 @@ + @@ -353,6 +354,9 @@ + + + @@ -418,7 +422,7 @@ - + #P org.jboss.tools.vpe Index: src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java =================================================================== --- src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java (revision 32289) +++ src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java (working copy) @@ -10,6 +10,7 @@ ******************************************************************************/ package org.jboss.tools.vpe.editor.template; +import java.io.Console; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -36,6 +37,7 @@ import org.jboss.tools.vpe.editor.context.VpePageContext; import org.jboss.tools.vpe.editor.template.custom.CustomTLDReference; import org.jboss.tools.vpe.editor.template.textformating.TextFormatingData; +import org.jboss.tools.vpe.editor.util.Constants; import org.jboss.tools.vpe.editor.util.HTML; import org.jboss.tools.vpe.editor.util.SourceDomUtil; import org.jboss.tools.vpe.editor.util.XmlUtil; @@ -247,6 +249,9 @@ //added by Denis Vinnichek, for tags which are defined with regexp static final String ATTR_TAG_MATCHING_MODE = "matching-mode"; //$NON-NLS-1$ + + // for taglibs which are defined with regexp + static final String ATTR_TEMPLATE_TAGLIB_MATCHING_MODE = ATTR_TAG_MATCHING_MODE; private static VpeTemplateManager instance = null; private static Object monitor = new Object(); @@ -255,6 +260,7 @@ * Contains Mapping from URI and namespace */ private Map templateTaglibs = new HashMap(); + private Map matchingTemplateTaglibs = new HashMap(); private Map caseSensitiveTags = new HashMap(); private Map ignoreSensitiveTags = new HashMap(); @@ -280,8 +286,6 @@ //mareshkau, contains a name of custom template private static final String CUSTOM_TEMPLATE_NAME="vpeCustomTemplate"; //$NON-NLS-1$ - private static final String JSF2_CUSTOM_TEMPLATE="vpejsf2customTemplate"; //$NON-NLS-1$ - /** * added by Max Areshkau, JBIDE-1494 * Contains default text formating data @@ -439,10 +443,7 @@ && CustomTLDReference.isExistInCustomTlds(pageContext,sourceNodeUri)) { return VpeTemplateManager.CUSTOM_TEMPLATE_NAME; } - if(sourceNodeUri!=null - &&CustomTLDReference.isExistInJsf2CustomComponenets(pageContext,sourceNodeUri,sourceNode.getLocalName()) ) { - return VpeTemplateManager.JSF2_CUSTOM_TEMPLATE; - } + return sourceNode.getNodeName(); default : return null; @@ -451,7 +452,16 @@ } public String getTemplateTaglibPrefix(String sourceUri) { - return (String)templateTaglibs.get(sourceUri); + String result = templateTaglibs.get(sourceUri); + if(result == null){ + for ( Map.Entry entry: matchingTemplateTaglibs.entrySet()) { + if(sourceUri.matches( entry.getKey() )){ + result = entry.getValue(); + break; + } + } + } + return result; } private void load() { @@ -504,7 +514,8 @@ } else if (TAG_TEMPLATE.equals(node.getNodeName())) { setDefTemplate(createTemplate((Element)node,confElement, true)); } else if (TAG_TEMPLATE_TAGLIB.equals(node.getNodeName())) { - setTemplateTaglib((Element)node); + boolean templateTaglibMatchingMode = Constants.YES_STRING.equals(( (Element) node).getAttribute(VpeTemplateManager.ATTR_TEMPLATE_TAGLIB_MATCHING_MODE)); + setTemplateTaglib((Element) node, templateTaglibMatchingMode); } } } @@ -579,12 +590,16 @@ * Register templates taglibs from templates files * @param templateTaglibElement */ - private void setTemplateTaglib(Element templateTaglibElement) { + private void setTemplateTaglib(Element templateTaglibElement, boolean templateTaglibMatchingMode) { String uri = templateTaglibElement.getAttribute(ATTR_DIRECTIVE_TAGLIB_URI); String pefix = templateTaglibElement.getAttribute(ATTR_DIRECTIVE_TAGLIB_PREFIX); if (uri.length() > 0 && pefix.length() > 0) { if (!templateTaglibs.containsKey(uri)) { - templateTaglibs.put(uri, pefix); + if (templateTaglibMatchingMode) { + matchingTemplateTaglibs.put(uri, pefix); + } else { + templateTaglibs.put(uri, pefix); + } } } }