Author: dmaliarevich
Date: 2009-06-11 13:04:10 -0400 (Thu, 11 Jun 2009)
New Revision: 15887
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4398, check for facelet page was added.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-06-11
17:03:56 UTC (rev 15886)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-06-11
17:04:10 UTC (rev 15887)
@@ -38,6 +38,7 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.dnd.VpeDnD;
@@ -66,6 +67,7 @@
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.jboss.tools.vpe.editor.util.VpeDebugUtil;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.jboss.tools.vpe.editor.util.XmlUtil;
import org.jboss.tools.vpe.resref.core.CSSReferenceList;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerVpeUtils;
@@ -213,8 +215,13 @@
refreshExternalLinks();
// if (isFacelet()) {
+ /*
+ *
https://jira.jboss.org/jira/browse/JBIDE-4398
+ * Additional check for facelet's taglibs should be added
+ * to distinguish it from custom tags and pages without facelets support.
+ */
Element root = FaceletUtil.findComponentElement(sourceDocument.getDocumentElement());
- if (root != null) {
+ if ((root != null) && (isFacelet(root))){
addNode(root, null, getContentArea());
} else {
addChildren(null, sourceDocument, getContentArea());
@@ -415,7 +422,7 @@
*/
protected nsIDOMNode createNode(Node sourceNode,
nsIDOMNode visualOldContainer) {
-
+
boolean registerFlag = isCurrentMainDocument();
//it's check for initialization visualController,
@@ -2222,14 +2229,22 @@
return visualEditor.getDomDocument();
}
-// /**
-// * Check this file is facelet
-// *
-// * @return this if file is facelet, otherwize false
-// */
-// private boolean isFacelet() {
-// boolean isFacelet = false;
-//
+ /**
+ * Check this file is facelet
+ *
+ * @return this if file is facelet, otherwize false
+ */
+ private boolean isFacelet(Node sourceNode) {
+ boolean isFacelet = false;
+ String sourcePrefix = sourceNode.getPrefix();
+ List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode, pageContext);
+ TaglibData sourceNodeTaglib = XmlUtil.getTaglibForPrefix(sourcePrefix, taglibs);
+ if (null != sourceNodeTaglib) {
+ String sourceNodeUri = sourceNodeTaglib.getUri();
+ if (VisualDomUtil.FACELETS_URI.equalsIgnoreCase(sourceNodeUri)) {
+ isFacelet = true;
+ }
+ }
// IEditorInput iEditorInput = pageContext.getEditPart().getEditorInput();
// if (iEditorInput instanceof IFileEditorInput) {
// IFileEditorInput iFileEditorInput = (IFileEditorInput) iEditorInput;
@@ -2252,10 +2267,10 @@
// }
// }
// }
-//
-// return isFacelet;
-// }
+ return isFacelet;
+ }
+
/**
* @return the xulRunnerEditor
*/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java 2009-06-11
17:03:56 UTC (rev 15886)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java 2009-06-11
17:04:10 UTC (rev 15887)
@@ -39,6 +39,13 @@
public class VisualDomUtil {
+
+ public static String JSF_CORE_URI = "http://java.sun.com/jsf/core";
//$NON-NLS-1$
+ public static String JSF_HTML_URI = "http://java.sun.com/jsf/html";
//$NON-NLS-1$
+ public static String RICH_FACES_URI = "http://richfaces.org/rich";
//$NON-NLS-1$
+ public static String A4J_URI = "http://richfaces.org/a4j"; //$NON-NLS-1$
+ public static String FACELETS_URI = "http://java.sun.com/jsf/facelets";
//$NON-NLS-1$
+
private static final String ACCESSIBILITY_SERVICE_CONTRACT_ID =
"(a)mozilla.org/accessibilityService;1";
private static Reference<nsIAccessibilityService> accessibilityServiceCache =
null;