Author: scabanovich
Date: 2012-07-31 18:54:18 -0400 (Tue, 31 Jul 2012)
New Revision: 42822
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteTaglibInserter.java
Log:
JBIDE-12304
https://issues.jboss.org/browse/JBIDE-12304
Option is added, to insert namespace for the same uri with different prefix.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java 2012-07-31
22:35:00 UTC (rev 42821)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java 2012-07-31
22:54:18 UTC (rev 42822)
@@ -14,6 +14,12 @@
public static final String PROPOPERTY_TAGLIBRARY_URI = URIConstants.LIBRARY_URI;
public static final String PROPOPERTY_TAGLIBRARY_VERSION =
URIConstants.LIBRARY_VERSION;
public static final String PROPOPERTY_DEFAULT_PREFIX = URIConstants.DEFAULT_PREFIX;
+ /**
+ * If "true", enforces inserting prefix set by PROPOPERTY_DEFAULT_PREFIX,
+ * even if there is another prefix on the page with the same uri.
+ * Default value is "false".
+ */
+ public static final String PROPOPERTY_FORCE_PREFIX = "force prefix";
//$NON-NLS-1$
static JSPPaletteInsertHelper instance = new JSPPaletteInsertHelper();
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteTaglibInserter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteTaglibInserter.java 2012-07-31
22:35:00 UTC (rev 42821)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteTaglibInserter.java 2012-07-31
22:54:18 UTC (rev 42822)
@@ -303,6 +303,7 @@
private static Properties checkTL(Element root, Properties p, IDocument d) {
String uri_p = p.getProperty(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI);
String defaultPrefix_p =
p.getProperty(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX);
+ boolean forcePrefix = "true".equals(
p.getProperty(JSPPaletteInsertHelper.PROPOPERTY_FORCE_PREFIX)); //$NON-NLS-1$
HashMap<String,String> map = new HashMap<String,String>();
NamedNodeMap attrs = root.getAttributes();
@@ -315,7 +316,7 @@
}
}
- if (map.containsKey(uri_p) || checkSelectedElement(map, d, p)) {
+ if (!forcePrefix && (map.containsKey(uri_p) || checkSelectedElement(map, d,
p))) {
if (!map.get(uri_p).equals(defaultPrefix_p)) {
p.setProperty(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, (String)
map.get(uri_p));
}