Author: yzhishko
Date: 2009-11-05 11:48:41 -0500 (Thu, 05 Nov 2009)
New Revision: 18421
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/proxy/VpeProxyUtil.java
Log:
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/proxy/VpeProxyUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/proxy/VpeProxyUtil.java 2009-11-05
16:28:39 UTC (rev 18420)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/proxy/VpeProxyUtil.java 2009-11-05
16:48:41 UTC (rev 18421)
@@ -13,6 +13,9 @@
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
@@ -20,43 +23,59 @@
import org.w3c.dom.Node;
/**
- * Utill Class created for creating proxis for vpe
- * and manipulation them
+ * Utill Class created for creating proxis for vpe and manipulation them
*
* @author mareshkau
*/
+@SuppressWarnings("restriction")
public class VpeProxyUtil {
/**
* Create proxy for source nodes. This function should be called for nodes,
* in which used el expressions which should be replaced
+ *
* @param sourceNode
* @return proxy for node
*/
- public static Node createProxyForELExpressionNode(VpePageContext pageContext,
- Node sourceNode) {
-
+ public static Node createProxyForELExpressionNode(
+ VpePageContext pageContext, Node sourceNode) {
+
Node proxy = null;
List<Class<?>> interfaceses = new ArrayList<Class<?>>();
interfaceses.add(Node.class);
- if(sourceNode instanceof Element) {
- interfaceses.add(Element.class);
- } else if(sourceNode instanceof Attr) {
+ boolean isDOMImpl = false;
+ if (sourceNode instanceof IDOMElement) {
+ interfaceses.add(IDOMElement.class);
+ isDOMImpl = true;
+ } else if (sourceNode instanceof IDOMAttr) {
+ interfaceses.add(IDOMAttr.class);
+ isDOMImpl = true;
+ }
+ if (isDOMImpl) {
+ proxy = (Node) Proxy.newProxyInstance(IDOMNode.class
+ .getClassLoader(), interfaceses.toArray(new Class[0]),
+ new VpeNodeInvocationHandler(pageContext, sourceNode));
+ } else {
+ if (sourceNode instanceof Element) {
+ interfaceses.add(Element.class);
+ } else if (sourceNode instanceof Attr) {
interfaceses.add(Attr.class);
- }
- proxy = (Node) Proxy.newProxyInstance(Node.class.getClassLoader(),
- interfaceses.toArray(new Class[0]),
- new VpeNodeInvocationHandler(pageContext,sourceNode));
-
+ }
+ proxy = (Node) Proxy.newProxyInstance(Node.class.getClassLoader(),
+ interfaceses.toArray(new Class[0]),
+ new VpeNodeInvocationHandler(pageContext, sourceNode));
+ }
return proxy;
}
-
- public static NamedNodeMap createProxyForNamedNodeMap(VpePageContext pageContext,
- NamedNodeMap namedNodeMap) {
- NamedNodeMap proxy
=(NamedNodeMap)Proxy.newProxyInstance(NamedNodeMap.class.getClassLoader(),
- new Class[] {NamedNodeMap.class},
- new VpeNamedNodeMapInvocationHandler(pageContext,namedNodeMap));
+ public static NamedNodeMap createProxyForNamedNodeMap(
+ VpePageContext pageContext, NamedNodeMap namedNodeMap) {
+ NamedNodeMap proxy = (NamedNodeMap) Proxy
+ .newProxyInstance(NamedNodeMap.class.getClassLoader(),
+ new Class[] { NamedNodeMap.class },
+ new VpeNamedNodeMapInvocationHandler(pageContext,
+ namedNodeMap));
+
return proxy;
}
}
Show replies by date