Author: sdzmitrovich
Date: 2008-02-26 03:01:17 -0500 (Tue, 26 Feb 2008)
New Revision: 6571
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeProxyUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeProxy.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementProxy.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeProxy.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextProxy.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeAdapterUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeAdapter.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementAdapter.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeAdapter.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextAdapter.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLabelTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputTextTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1718
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLabelTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLabelTemplate.java 2008-02-26
07:39:40 UTC (rev 6570)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLabelTemplate.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -14,7 +14,7 @@
import java.util.List;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeAdapterUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
import org.jboss.tools.vpe.editor.bundle.BundleMap;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
@@ -97,7 +97,7 @@
VpeChildrenInfo spanInfo = new VpeChildrenInfo(span);
- NodeList list = NodeAdapterUtil.reparseAttributeValue(attr);
+ NodeList list = NodeProxyUtil.reparseAttributeValue(attr);
for (int i = 0; i < list.getLength(); i++) {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputTextTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputTextTemplate.java 2008-02-26
07:39:40 UTC (rev 6570)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputTextTemplate.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -14,7 +14,7 @@
import java.util.List;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeAdapterUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
import org.jboss.tools.vpe.editor.bundle.BundleMap;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
@@ -97,7 +97,7 @@
VpeChildrenInfo spanInfo = new VpeChildrenInfo(span);
- NodeList list = NodeAdapterUtil.reparseAttributeValue(attr);
+ NodeList list = NodeProxyUtil.reparseAttributeValue(attr);
for (int i = 0; i < list.getLength(); i++) {
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeAdapterUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeAdapterUtil.java 2008-02-26
07:39:40 UTC (rev 6570)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeAdapterUtil.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.jsf.template.util;
-
-import org.eclipse.jst.jsp.core.internal.domdocument.DOMModelForJSP;
-import org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser;
-import org.eclipse.wst.sse.core.internal.document.StructuredDocumentFactory;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
-import org.jboss.tools.jsf.vpe.jsf.template.util.model.ElementAdapter;
-import org.jboss.tools.jsf.vpe.jsf.template.util.model.NodeAdapter;
-import org.jboss.tools.jsf.vpe.jsf.template.util.model.NodeListImpl;
-import org.jboss.tools.jsf.vpe.jsf.template.util.model.TextAdapter;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class NodeAdapterUtil {
-
- static public NodeList reparseAttributeValue(Attr attr) {
-
- IStructuredDocument newStructuredDocument = StructuredDocumentFactory
- .getNewStructuredDocumentInstance(new JSPSourceParser());
-
- newStructuredDocument.set(attr.getValue());
-
- IDOMModel modelForJSP = new DOMModelForJSP();
- modelForJSP.setStructuredDocument(newStructuredDocument);
-
- IDOMDocument document = modelForJSP.getDocument();
-
- NodeList list = document.getChildNodes();
-
- NodeList adaptersList = getNodeAdapterList(list, ((IDOMAttr) attr)
- .getValueRegionStartOffset());
-
- return adaptersList;
-
- }
-
- static public NodeAdapter getNodeAdapter(Node node, int basicOffset) {
- if (node == null)
- return null;
-
- if (node instanceof IDOMText)
- return new TextAdapter((IDOMText) node, basicOffset);
- else if (node instanceof IDOMElement)
- return new ElementAdapter((IDOMElement) node, basicOffset);
- else
- return new NodeAdapter(node, basicOffset);
- }
-
- static public NodeList getNodeAdapterList(NodeList nodeList, int basicOffset) {
-
- NodeListImpl newNodeList = new NodeListImpl();
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node node = nodeList.item(i);
-
- newNodeList.appendNode(getNodeAdapter(node, basicOffset));
-
- }
-
- return newNodeList;
-
- }
-
-}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeProxyUtil.java
(from rev 6570,
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeAdapterUtil.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeProxyUtil.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeProxyUtil.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template.util;
+
+import org.eclipse.jst.jsp.core.internal.domdocument.DOMModelForJSP;
+import org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser;
+import org.eclipse.wst.sse.core.internal.document.StructuredDocumentFactory;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
+import org.jboss.tools.jsf.vpe.jsf.template.util.model.ElementProxy;
+import org.jboss.tools.jsf.vpe.jsf.template.util.model.NodeProxy;
+import org.jboss.tools.jsf.vpe.jsf.template.util.model.NodeListImpl;
+import org.jboss.tools.jsf.vpe.jsf.template.util.model.TextProxy;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class NodeProxyUtil {
+
+ static public NodeList reparseAttributeValue(Attr attr) {
+
+ IStructuredDocument newStructuredDocument = StructuredDocumentFactory
+ .getNewStructuredDocumentInstance(new JSPSourceParser());
+
+ newStructuredDocument.set(attr.getValue());
+
+ IDOMModel modelForJSP = new DOMModelForJSP();
+ modelForJSP.setStructuredDocument(newStructuredDocument);
+
+ IDOMDocument document = modelForJSP.getDocument();
+
+ NodeList list = document.getChildNodes();
+
+ NodeList adaptersList = getNodeAdapterList(list, ((IDOMAttr) attr)
+ .getValueRegionStartOffset());
+
+ return adaptersList;
+
+ }
+
+ static public NodeProxy getNodeAdapter(Node node, int basicOffset) {
+ if (node == null)
+ return null;
+
+ if (node instanceof IDOMText)
+ return new TextProxy((IDOMText) node, basicOffset);
+ else if (node instanceof IDOMElement)
+ return new ElementProxy((IDOMElement) node, basicOffset);
+ else
+ return new NodeProxy(node, basicOffset);
+ }
+
+ static public NodeList getNodeAdapterList(NodeList nodeList, int basicOffset) {
+
+ NodeListImpl newNodeList = new NodeListImpl();
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+
+ newNodeList.appendNode(getNodeAdapter(node, basicOffset));
+
+ }
+
+ return newNodeList;
+
+ }
+
+}
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeAdapter.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeAdapter.java 2008-02-26
07:39:40 UTC (rev 6570)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeAdapter.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.jsf.template.util.model;
-
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.TypeInfo;
-
-public class AttributeAdapter extends NodeAdapter implements IDOMAttr {
-
- public AttributeAdapter(IDOMAttr basicAttr, int basicOffset) {
- super(basicAttr, basicOffset);
- }
-
- public ITextRegion getEqualRegion() {
-
- return ((IDOMAttr) basicNode).getEqualRegion();
- }
-
- public int getNameRegionEndOffset() {
- return ((IDOMAttr) basicNode).getNameRegionEndOffset() + basicOffset;
- }
-
- public int getNameRegionStartOffset() {
- return ((IDOMAttr) basicNode).getNameRegionStartOffset() + basicOffset;
- }
-
- public String getNameRegionText() {
- return ((IDOMAttr) basicNode).getNameRegionText();
- }
-
- public int getNameRegionTextEndOffset() {
- return ((IDOMAttr) basicNode).getNameRegionTextEndOffset()
- + basicOffset;
- }
-
- public int getValueRegionStartOffset() {
- return ((IDOMAttr) basicNode).getValueRegionStartOffset() + basicOffset;
- }
-
- public String getValueRegionText() {
- return ((IDOMAttr) basicNode).getValueRegionText();
- }
-
- public boolean hasNameOnly() {
- return ((IDOMAttr) basicNode).hasNameOnly();
- }
-
- public boolean hasNestedValue() {
- return ((IDOMAttr) basicNode).hasNestedValue();
- }
-
- public boolean isGlobalAttr() {
- return ((IDOMAttr) basicNode).isGlobalAttr();
- }
-
- public boolean isXMLAttr() {
- return ((IDOMAttr) basicNode).isXMLAttr();
- }
-
- public String getName() {
- return ((IDOMAttr) basicNode).getName();
- }
-
- public Element getOwnerElement() {
- return ((IDOMAttr) basicNode).getOwnerElement();
- }
-
- public TypeInfo getSchemaTypeInfo() {
- return ((IDOMAttr) basicNode).getSchemaTypeInfo();
- }
-
- public boolean getSpecified() {
- return ((IDOMAttr) basicNode).getSpecified();
- }
-
- public String getValue() {
- return ((IDOMAttr) basicNode).getValue();
- }
-
- public void setValue(String value) throws DOMException {
- ((IDOMAttr) basicNode).setValue(value);
-
- }
-
-}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeProxy.java
(from rev 6570,
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeAdapter.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeProxy.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/AttributeProxy.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template.util.model;
+
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.TypeInfo;
+
+public class AttributeProxy extends NodeProxy implements IDOMAttr {
+
+ public AttributeProxy(IDOMAttr basicAttr, int basicOffset) {
+ super(basicAttr, basicOffset);
+ }
+
+ public ITextRegion getEqualRegion() {
+
+ return ((IDOMAttr) basicNode).getEqualRegion();
+ }
+
+ public int getNameRegionEndOffset() {
+ return ((IDOMAttr) basicNode).getNameRegionEndOffset() + basicOffset;
+ }
+
+ public int getNameRegionStartOffset() {
+ return ((IDOMAttr) basicNode).getNameRegionStartOffset() + basicOffset;
+ }
+
+ public String getNameRegionText() {
+ return ((IDOMAttr) basicNode).getNameRegionText();
+ }
+
+ public int getNameRegionTextEndOffset() {
+ return ((IDOMAttr) basicNode).getNameRegionTextEndOffset()
+ + basicOffset;
+ }
+
+ public int getValueRegionStartOffset() {
+ return ((IDOMAttr) basicNode).getValueRegionStartOffset() + basicOffset;
+ }
+
+ public String getValueRegionText() {
+ return ((IDOMAttr) basicNode).getValueRegionText();
+ }
+
+ public boolean hasNameOnly() {
+ return ((IDOMAttr) basicNode).hasNameOnly();
+ }
+
+ public boolean hasNestedValue() {
+ return ((IDOMAttr) basicNode).hasNestedValue();
+ }
+
+ public boolean isGlobalAttr() {
+ return ((IDOMAttr) basicNode).isGlobalAttr();
+ }
+
+ public boolean isXMLAttr() {
+ return ((IDOMAttr) basicNode).isXMLAttr();
+ }
+
+ public String getName() {
+ return ((IDOMAttr) basicNode).getName();
+ }
+
+ public Element getOwnerElement() {
+ return ((IDOMAttr) basicNode).getOwnerElement();
+ }
+
+ public TypeInfo getSchemaTypeInfo() {
+ return ((IDOMAttr) basicNode).getSchemaTypeInfo();
+ }
+
+ public boolean getSpecified() {
+ return ((IDOMAttr) basicNode).getSpecified();
+ }
+
+ public String getValue() {
+ return ((IDOMAttr) basicNode).getValue();
+ }
+
+ public void setValue(String value) throws DOMException {
+ ((IDOMAttr) basicNode).setValue(value);
+
+ }
+
+}
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementAdapter.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementAdapter.java 2008-02-26
07:39:40 UTC (rev 6570)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementAdapter.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.jsf.template.util.model;
-
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.TypeInfo;
-
-public class ElementAdapter extends NodeAdapter implements IDOMElement {
-
- public ElementAdapter(IDOMElement basicElement, int basicOffset) {
- super(basicElement, basicOffset);
- }
-
- public int getEndStartOffset() {
- return ((IDOMElement) basicNode).getEndStartOffset() + basicOffset;
- }
-
- public int getStartEndOffset() {
- return ((IDOMElement) basicNode).getStartEndOffset() + basicOffset;
- }
-
- public boolean hasEndTag() {
- return ((IDOMElement) basicNode).hasEndTag();
- }
-
- public boolean hasStartTag() {
- return ((IDOMElement) basicNode).hasStartTag();
- }
-
- public boolean isCommentTag() {
- return ((IDOMElement) basicNode).isCommentTag();
- }
-
- public boolean isEmptyTag() {
- return ((IDOMElement) basicNode).isEmptyTag();
- }
-
- public boolean isEndTag() {
- return ((IDOMElement) basicNode).isEndTag();
- }
-
- public boolean isGlobalTag() {
- return ((IDOMElement) basicNode).isGlobalTag();
- }
-
- public boolean isImplicitTag() {
- return ((IDOMElement) basicNode).isImplicitTag();
- }
-
- public boolean isJSPTag() {
- return ((IDOMElement) basicNode).isJSPTag();
- }
-
- public boolean isStartTagClosed() {
- return ((IDOMElement) basicNode).isStartTagClosed();
- }
-
- public boolean isXMLTag() {
- return ((IDOMElement) basicNode).isXMLTag();
- }
-
- public void notifyEndTagChanged() {
- ((IDOMElement) basicNode).notifyEndTagChanged();
-
- }
-
- public void notifyStartTagChanged() {
- ((IDOMElement) basicNode).notifyStartTagChanged();
-
- }
-
- public void setCommentTag(boolean isCommentTag) {
- ((IDOMElement) basicNode).setCommentTag(isCommentTag);
-
- }
-
- public void setEmptyTag(boolean isEmptyTag) {
- ((IDOMElement) basicNode).setEmptyTag(isEmptyTag);
-
- }
-
- public void setIdAttribute(String name, boolean isId) {
- ((IDOMElement) basicNode).setIdAttribute(name, isId);
-
- }
-
- public void setIdAttributeNS(String namespaceURI, String localName,
- boolean isId) {
- ((IDOMElement) basicNode).setIdAttributeNS(namespaceURI, localName,
- isId);
-
- }
-
- public void setIdAttributeNode(Attr idAttr, boolean isId)
- throws DOMException {
- ((IDOMElement) basicNode).setIdAttributeNode(idAttr, isId);
-
- }
-
- public void setJSPTag(boolean isJSPTag) {
- ((IDOMElement) basicNode).setJSPTag(isJSPTag);
-
- }
-
- public String getAttribute(String name) {
-
- return ((IDOMElement) basicNode).getAttribute(name);
- }
-
- public String getAttributeNS(String namespaceURI, String localName)
- throws DOMException {
- return ((IDOMElement) basicNode)
- .getAttributeNS(namespaceURI, localName);
- }
-
- public Attr getAttributeNode(String name) {
- return new AttributeAdapter((IDOMAttr) ((IDOMElement) basicNode)
- .getAttributeNode(name), basicOffset);
- }
-
- public Attr getAttributeNodeNS(String namespaceURI, String localName)
- throws DOMException {
- return new AttributeAdapter((IDOMAttr) ((IDOMElement) basicNode)
- .getAttributeNodeNS(namespaceURI, localName), basicOffset);
- }
-
- public NodeList getElementsByTagName(String name) {
- return createNodeAdapterList(((IDOMElement) basicNode)
- .getElementsByTagName(name));
- }
-
- public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
- throws DOMException {
- return createNodeAdapterList(((IDOMElement) basicNode)
- .getElementsByTagNameNS(namespaceURI, localName));
- }
-
- public TypeInfo getSchemaTypeInfo() {
- return ((IDOMElement) basicNode).getSchemaTypeInfo();
- }
-
- public String getTagName() {
- return ((IDOMElement) basicNode).getTagName();
- }
-
- public boolean hasAttribute(String name) {
- return ((IDOMElement) basicNode).hasAttribute(name);
- }
-
- public boolean hasAttributeNS(String namespaceURI, String localName)
- throws DOMException {
- return ((IDOMElement) basicNode)
- .hasAttributeNS(namespaceURI, localName);
- }
-
- public void removeAttribute(String name) throws DOMException {
- ((IDOMElement) basicNode).removeAttribute(name);
- }
-
- public void removeAttributeNS(String namespaceURI, String localName)
- throws DOMException {
-
- ((IDOMElement) basicNode).removeAttributeNS(namespaceURI, localName);
- }
-
- public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
- return new AttributeAdapter((IDOMAttr) ((IDOMElement) basicNode)
- .removeAttributeNode(oldAttr), basicOffset);
- }
-
- public void setAttribute(String name, String value) throws DOMException {
- //((IDOMElement) basicNode).setAttribute(name, value);
-
- }
-
- public void setAttributeNS(String namespaceURI, String qualifiedName,
- String value) throws DOMException {
- // ((IDOMElement) basicNode).setAttributeNS(namespaceURI, qualifiedName,
- // value);
-
- }
-
- public Attr setAttributeNode(Attr newAttr) throws DOMException {
- return new AttributeAdapter((IDOMAttr) ((IDOMElement) basicNode)
- .setAttributeNode(newAttr), basicOffset);
- }
-
- public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
- return new AttributeAdapter((IDOMAttr) ((IDOMElement) basicNode)
- .setAttributeNodeNS(newAttr), basicOffset);
- }
-
-}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementProxy.java
(from rev 6570,
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementAdapter.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementProxy.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/ElementProxy.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template.util.model;
+
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+
+public class ElementProxy extends NodeProxy implements IDOMElement {
+
+ public ElementProxy(IDOMElement basicElement, int basicOffset) {
+ super(basicElement, basicOffset);
+ }
+
+ public int getEndStartOffset() {
+ return ((IDOMElement) basicNode).getEndStartOffset() + basicOffset;
+ }
+
+ public int getStartEndOffset() {
+ return ((IDOMElement) basicNode).getStartEndOffset() + basicOffset;
+ }
+
+ public boolean hasEndTag() {
+ return ((IDOMElement) basicNode).hasEndTag();
+ }
+
+ public boolean hasStartTag() {
+ return ((IDOMElement) basicNode).hasStartTag();
+ }
+
+ public boolean isCommentTag() {
+ return ((IDOMElement) basicNode).isCommentTag();
+ }
+
+ public boolean isEmptyTag() {
+ return ((IDOMElement) basicNode).isEmptyTag();
+ }
+
+ public boolean isEndTag() {
+ return ((IDOMElement) basicNode).isEndTag();
+ }
+
+ public boolean isGlobalTag() {
+ return ((IDOMElement) basicNode).isGlobalTag();
+ }
+
+ public boolean isImplicitTag() {
+ return ((IDOMElement) basicNode).isImplicitTag();
+ }
+
+ public boolean isJSPTag() {
+ return ((IDOMElement) basicNode).isJSPTag();
+ }
+
+ public boolean isStartTagClosed() {
+ return ((IDOMElement) basicNode).isStartTagClosed();
+ }
+
+ public boolean isXMLTag() {
+ return ((IDOMElement) basicNode).isXMLTag();
+ }
+
+ public void notifyEndTagChanged() {
+ ((IDOMElement) basicNode).notifyEndTagChanged();
+
+ }
+
+ public void notifyStartTagChanged() {
+ ((IDOMElement) basicNode).notifyStartTagChanged();
+
+ }
+
+ public void setCommentTag(boolean isCommentTag) {
+ ((IDOMElement) basicNode).setCommentTag(isCommentTag);
+
+ }
+
+ public void setEmptyTag(boolean isEmptyTag) {
+ ((IDOMElement) basicNode).setEmptyTag(isEmptyTag);
+
+ }
+
+ public void setIdAttribute(String name, boolean isId) {
+ ((IDOMElement) basicNode).setIdAttribute(name, isId);
+
+ }
+
+ public void setIdAttributeNS(String namespaceURI, String localName,
+ boolean isId) {
+ ((IDOMElement) basicNode).setIdAttributeNS(namespaceURI, localName,
+ isId);
+
+ }
+
+ public void setIdAttributeNode(Attr idAttr, boolean isId)
+ throws DOMException {
+ ((IDOMElement) basicNode).setIdAttributeNode(idAttr, isId);
+
+ }
+
+ public void setJSPTag(boolean isJSPTag) {
+ ((IDOMElement) basicNode).setJSPTag(isJSPTag);
+
+ }
+
+ public String getAttribute(String name) {
+
+ return ((IDOMElement) basicNode).getAttribute(name);
+ }
+
+ public String getAttributeNS(String namespaceURI, String localName)
+ throws DOMException {
+ return ((IDOMElement) basicNode)
+ .getAttributeNS(namespaceURI, localName);
+ }
+
+ public Attr getAttributeNode(String name) {
+ return new AttributeProxy((IDOMAttr) ((IDOMElement) basicNode)
+ .getAttributeNode(name), basicOffset);
+ }
+
+ public Attr getAttributeNodeNS(String namespaceURI, String localName)
+ throws DOMException {
+ return new AttributeProxy((IDOMAttr) ((IDOMElement) basicNode)
+ .getAttributeNodeNS(namespaceURI, localName), basicOffset);
+ }
+
+ public NodeList getElementsByTagName(String name) {
+ return createNodeAdapterList(((IDOMElement) basicNode)
+ .getElementsByTagName(name));
+ }
+
+ public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
+ throws DOMException {
+ return createNodeAdapterList(((IDOMElement) basicNode)
+ .getElementsByTagNameNS(namespaceURI, localName));
+ }
+
+ public TypeInfo getSchemaTypeInfo() {
+ return ((IDOMElement) basicNode).getSchemaTypeInfo();
+ }
+
+ public String getTagName() {
+ return ((IDOMElement) basicNode).getTagName();
+ }
+
+ public boolean hasAttribute(String name) {
+ return ((IDOMElement) basicNode).hasAttribute(name);
+ }
+
+ public boolean hasAttributeNS(String namespaceURI, String localName)
+ throws DOMException {
+ return ((IDOMElement) basicNode)
+ .hasAttributeNS(namespaceURI, localName);
+ }
+
+ public void removeAttribute(String name) throws DOMException {
+ ((IDOMElement) basicNode).removeAttribute(name);
+ }
+
+ public void removeAttributeNS(String namespaceURI, String localName)
+ throws DOMException {
+
+ ((IDOMElement) basicNode).removeAttributeNS(namespaceURI, localName);
+ }
+
+ public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
+ return new AttributeProxy((IDOMAttr) ((IDOMElement) basicNode)
+ .removeAttributeNode(oldAttr), basicOffset);
+ }
+
+ public void setAttribute(String name, String value) throws DOMException {
+ //((IDOMElement) basicNode).setAttribute(name, value);
+
+ }
+
+ public void setAttributeNS(String namespaceURI, String qualifiedName,
+ String value) throws DOMException {
+ // ((IDOMElement) basicNode).setAttributeNS(namespaceURI, qualifiedName,
+ // value);
+
+ }
+
+ public Attr setAttributeNode(Attr newAttr) throws DOMException {
+ return new AttributeProxy((IDOMAttr) ((IDOMElement) basicNode)
+ .setAttributeNode(newAttr), basicOffset);
+ }
+
+ public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
+ return new AttributeProxy((IDOMAttr) ((IDOMElement) basicNode)
+ .setAttributeNodeNS(newAttr), basicOffset);
+ }
+
+}
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeAdapter.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeAdapter.java 2008-02-26
07:39:40 UTC (rev 6570)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeAdapter.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.jsf.template.util.model;
-
-import java.util.Collection;
-
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.xml.core.internal.document.InvalidCharacterException;
-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.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.TypeInfo;
-import org.w3c.dom.UserDataHandler;
-
-public class NodeAdapter implements IDOMNode {
-
- protected Node basicNode;
-
- protected Node parentNode;
-
- protected int basicOffset;
-
- public NodeAdapter(Node basicNode, int basicOffset) {
-
- this.basicNode = basicNode;
- this.basicOffset = basicOffset;
-
- }
-
- // implementation of Node interface methods
- public Node appendChild(Node newChild) throws DOMException {
- return basicNode.appendChild(newChild);
- }
-
- public Node cloneNode(boolean deep) {
- return basicNode.cloneNode(deep);
- }
-
- public short compareDocumentPosition(Node other) throws DOMException {
- return basicNode.compareDocumentPosition(other);
- }
-
- public NamedNodeMap getAttributes() {
-
- NamedNodeMap basicAttributes = basicNode.getAttributes();
- NamedNodeMap newAttributes = new NamedNodeMapImpl();
-
- for (int i = 0; i < basicAttributes.getLength(); i++) {
-
- IDOMAttr attr = (IDOMAttr) basicAttributes.item(0);
-
- newAttributes.setNamedItem(new AttributeAdapter(attr, basicOffset));
-
- }
-
- return newAttributes;
- }
-
- public String getBaseURI() {
- return basicNode.getBaseURI();
- }
-
- public NodeList getChildNodes() {
-
- return createNodeAdapterList(basicNode.getChildNodes());
-
- }
-
- public Object getFeature(String feature, String version) {
- return basicNode.getFeature(feature, version);
- }
-
- public Node getFirstChild() {
-
- return getNodeAdapter(basicNode.getFirstChild());
-
- }
-
- public Node getLastChild() {
-
- return getNodeAdapter(basicNode.getLastChild());
-
- }
-
- public String getLocalName() {
- return basicNode.getLocalName();
- }
-
- public String getNamespaceURI() {
- return basicNode.getNamespaceURI();
- }
-
- public Node getNextSibling() {
-
- return getNodeAdapter(basicNode.getNextSibling());
-
- }
-
- public String getNodeName() {
- return basicNode.getNodeName();
- }
-
- public short getNodeType() {
- return basicNode.getNodeType();
- }
-
- public String getNodeValue() throws DOMException {
- return basicNode.getNodeValue();
- }
-
- public Document getOwnerDocument() {
- return basicNode.getOwnerDocument();
- }
-
- public Node getParentNode() {
- return basicNode.getParentNode();
- }
-
- public String getPrefix() {
- return basicNode.getPrefix();
- }
-
- public Node getPreviousSibling() {
- return getNodeAdapter(basicNode.getPreviousSibling());
- }
-
- public String getTextContent() throws DOMException {
- return basicNode.getTextContent();
- }
-
- public Object getUserData(String key) {
- return basicNode.getUserData(key);
- }
-
- public boolean hasAttributes() {
- return basicNode.hasAttributes();
- }
-
- public boolean hasChildNodes() {
- return basicNode.hasChildNodes();
- }
-
- public Node insertBefore(Node newChild, Node refChild) throws DOMException {
- return insertBefore(newChild, refChild);
- }
-
- public boolean isDefaultNamespace(String namespaceURI) {
- return false;
- }
-
- public boolean isEqualNode(Node arg) {
- return basicNode.isEqualNode(arg);
- }
-
- public boolean isSameNode(Node other) {
- return basicNode.isSameNode(other);
- }
-
- public boolean isSupported(String feature, String version) {
- return basicNode.isSupported(feature, version);
- }
-
- public String lookupNamespaceURI(String prefix) {
- return basicNode.lookupNamespaceURI(prefix);
- }
-
- public String lookupPrefix(String namespaceURI) {
- return basicNode.lookupPrefix(namespaceURI);
- }
-
- public void normalize() {
-
- basicNode.normalize();
- }
-
- public Node removeChild(Node oldChild) throws DOMException {
- return basicNode.removeChild(oldChild);
- }
-
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
- return basicNode.replaceChild(newChild, oldChild);
- }
-
- public void setNodeValue(String nodeValue) throws DOMException {
- basicNode.setNodeValue(nodeValue);
- }
-
- public void setPrefix(String prefix) throws DOMException {
- basicNode.setPrefix(prefix);
- }
-
- public void setTextContent(String textContent) throws DOMException {
- basicNode.setTextContent(textContent);
- }
-
- public Object setUserData(String key, Object data, UserDataHandler handler) {
- return basicNode.setUserData(key, data, handler);
- }
-
- // implementation of IDOMNode interface methods
-
- public IStructuredDocumentRegion getEndStructuredDocumentRegion() {
- return ((IDOMNode) basicNode).getEndStructuredDocumentRegion();
- }
-
- public IStructuredDocumentRegion getFirstStructuredDocumentRegion() {
- return ((IDOMNode) basicNode).getFirstStructuredDocumentRegion();
- }
-
- public IStructuredDocumentRegion getLastStructuredDocumentRegion() {
- return ((IDOMNode) basicNode).getLastStructuredDocumentRegion();
- }
-
- public IDOMModel getModel() {
- return ((IDOMNode) basicNode).getModel();
- }
-
- public ITextRegion getNameRegion() {
- return ((IDOMNode) basicNode).getNameRegion();
- }
-
- public String getSource() {
- return ((IDOMNode) basicNode).getSource();
- }
-
- public IStructuredDocumentRegion getStartStructuredDocumentRegion() {
- return ((IDOMNode) basicNode).getStartStructuredDocumentRegion();
- }
-
- public IStructuredDocument getStructuredDocument() {
- return getStructuredDocument();
- }
-
- public ITextRegion getValueRegion() {
- return ((IDOMNode) basicNode).getValueRegion();
- }
-
- public String getValueSource() {
- return ((IDOMNode) basicNode).getValueSource();
- }
-
- public boolean isChildEditable() {
- return ((IDOMNode) basicNode).isChildEditable();
- }
-
- public boolean isClosed() {
- return ((IDOMNode) basicNode).isClosed();
- }
-
- public boolean isContainer() {
- return ((IDOMNode) basicNode).isContainer();
- }
-
- public boolean isDataEditable() {
- return ((IDOMNode) basicNode).isDataEditable();
- }
-
- public boolean isId() {
- return ((IDOMNode) basicNode).isId();
- }
-
- public void setChildEditable(boolean editable) {
- ((IDOMNode) basicNode).setChildEditable(editable);
- }
-
- public void setDataEditable(boolean editable) {
- ((IDOMNode) basicNode).setDataEditable(editable);
- }
-
- public void setEditable(boolean editable, boolean deep) {
- ((IDOMNode) basicNode).setEditable(editable, deep);
-
- }
-
- public void setSource(String source) throws InvalidCharacterException {
-
- ((IDOMNode) basicNode).setSource(source);
- }
-
- public void setValueSource(String source) {
- ((IDOMNode) basicNode).setValueSource(source);
-
- }
-
- public boolean contains(int testPosition) {
- return ((IDOMNode) basicNode).contains(testPosition);
- }
-
- public int getEndOffset() {
- return ((IDOMNode) basicNode).getEndOffset() + basicOffset;
- }
-
- public int getLength() {
- return ((IDOMNode) basicNode).getLength();
- }
-
- public int getStartOffset() {
- return ((IDOMNode) basicNode).getStartOffset()+ basicOffset;
- }
-
- public void addAdapter(INodeAdapter adapter) {
- ((IDOMNode) basicNode).addAdapter(adapter);
- }
-
- public INodeAdapter getAdapterFor(Object type) {
- return ((IDOMNode) basicNode).getAdapterFor(type);
- }
-
- public Collection getAdapters() {
- return ((IDOMNode) basicNode).getAdapters();
- }
-
- public INodeAdapter getExistingAdapter(Object type) {
- return ((IDOMNode) basicNode).getExistingAdapter(type);
- }
-
- public void notify(int eventType, Object changedFeature, Object oldValue,
- Object newValue, int pos) {
- ((IDOMNode) basicNode).notify();
-
- }
-
- public void removeAdapter(INodeAdapter adapter) {
- ((IDOMNode) basicNode).removeAdapter(adapter);
- }
-
- protected NodeAdapter getNodeAdapter(Node node) {
- if (node == null)
- return null;
-
- if (node instanceof IDOMText)
- return new TextAdapter((IDOMText) node, basicOffset);
- else if (node instanceof IDOMElement)
- return new ElementAdapter((IDOMElement) node, basicOffset);
- else
- return new NodeAdapter(node, basicOffset);
- }
-
- protected NodeList createNodeAdapterList(NodeList nodeList) {
-
- NodeListImpl newNodeList = new NodeListImpl();
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node node = nodeList.item(i);
-
- newNodeList.appendNode(getNodeAdapter(node));
-
- }
-
- return newNodeList;
-
- }
-
-}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeProxy.java
(from rev 6570,
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeAdapter.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeProxy.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/NodeProxy.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -0,0 +1,373 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template.util.model;
+
+import java.util.Collection;
+
+import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.xml.core.internal.document.InvalidCharacterException;
+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.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+import org.w3c.dom.UserDataHandler;
+
+public class NodeProxy implements IDOMNode {
+
+ protected Node basicNode;
+
+ protected Node parentNode;
+
+ protected int basicOffset;
+
+ public NodeProxy(Node basicNode, int basicOffset) {
+
+ this.basicNode = basicNode;
+ this.basicOffset = basicOffset;
+
+ }
+
+ // implementation of Node interface methods
+ public Node appendChild(Node newChild) throws DOMException {
+ return basicNode.appendChild(newChild);
+ }
+
+ public Node cloneNode(boolean deep) {
+ return basicNode.cloneNode(deep);
+ }
+
+ public short compareDocumentPosition(Node other) throws DOMException {
+ return basicNode.compareDocumentPosition(other);
+ }
+
+ public NamedNodeMap getAttributes() {
+
+ NamedNodeMap basicAttributes = basicNode.getAttributes();
+ NamedNodeMap newAttributes = new NamedNodeMapImpl();
+
+ for (int i = 0; i < basicAttributes.getLength(); i++) {
+
+ IDOMAttr attr = (IDOMAttr) basicAttributes.item(0);
+
+ newAttributes.setNamedItem(new AttributeProxy(attr, basicOffset));
+
+ }
+
+ return newAttributes;
+ }
+
+ public String getBaseURI() {
+ return basicNode.getBaseURI();
+ }
+
+ public NodeList getChildNodes() {
+
+ return createNodeAdapterList(basicNode.getChildNodes());
+
+ }
+
+ public Object getFeature(String feature, String version) {
+ return basicNode.getFeature(feature, version);
+ }
+
+ public Node getFirstChild() {
+
+ return getNodeAdapter(basicNode.getFirstChild());
+
+ }
+
+ public Node getLastChild() {
+
+ return getNodeAdapter(basicNode.getLastChild());
+
+ }
+
+ public String getLocalName() {
+ return basicNode.getLocalName();
+ }
+
+ public String getNamespaceURI() {
+ return basicNode.getNamespaceURI();
+ }
+
+ public Node getNextSibling() {
+
+ return getNodeAdapter(basicNode.getNextSibling());
+
+ }
+
+ public String getNodeName() {
+ return basicNode.getNodeName();
+ }
+
+ public short getNodeType() {
+ return basicNode.getNodeType();
+ }
+
+ public String getNodeValue() throws DOMException {
+ return basicNode.getNodeValue();
+ }
+
+ public Document getOwnerDocument() {
+ return basicNode.getOwnerDocument();
+ }
+
+ public Node getParentNode() {
+ return basicNode.getParentNode();
+ }
+
+ public String getPrefix() {
+ return basicNode.getPrefix();
+ }
+
+ public Node getPreviousSibling() {
+ return getNodeAdapter(basicNode.getPreviousSibling());
+ }
+
+ public String getTextContent() throws DOMException {
+ return basicNode.getTextContent();
+ }
+
+ public Object getUserData(String key) {
+ return basicNode.getUserData(key);
+ }
+
+ public boolean hasAttributes() {
+ return basicNode.hasAttributes();
+ }
+
+ public boolean hasChildNodes() {
+ return basicNode.hasChildNodes();
+ }
+
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+ return insertBefore(newChild, refChild);
+ }
+
+ public boolean isDefaultNamespace(String namespaceURI) {
+ return false;
+ }
+
+ public boolean isEqualNode(Node arg) {
+ return basicNode.isEqualNode(arg);
+ }
+
+ public boolean isSameNode(Node other) {
+ return basicNode.isSameNode(other);
+ }
+
+ public boolean isSupported(String feature, String version) {
+ return basicNode.isSupported(feature, version);
+ }
+
+ public String lookupNamespaceURI(String prefix) {
+ return basicNode.lookupNamespaceURI(prefix);
+ }
+
+ public String lookupPrefix(String namespaceURI) {
+ return basicNode.lookupPrefix(namespaceURI);
+ }
+
+ public void normalize() {
+
+ basicNode.normalize();
+ }
+
+ public Node removeChild(Node oldChild) throws DOMException {
+ return basicNode.removeChild(oldChild);
+ }
+
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+ return basicNode.replaceChild(newChild, oldChild);
+ }
+
+ public void setNodeValue(String nodeValue) throws DOMException {
+ basicNode.setNodeValue(nodeValue);
+ }
+
+ public void setPrefix(String prefix) throws DOMException {
+ basicNode.setPrefix(prefix);
+ }
+
+ public void setTextContent(String textContent) throws DOMException {
+ basicNode.setTextContent(textContent);
+ }
+
+ public Object setUserData(String key, Object data, UserDataHandler handler) {
+ return basicNode.setUserData(key, data, handler);
+ }
+
+ // implementation of IDOMNode interface methods
+
+ public IStructuredDocumentRegion getEndStructuredDocumentRegion() {
+ return ((IDOMNode) basicNode).getEndStructuredDocumentRegion();
+ }
+
+ public IStructuredDocumentRegion getFirstStructuredDocumentRegion() {
+ return ((IDOMNode) basicNode).getFirstStructuredDocumentRegion();
+ }
+
+ public IStructuredDocumentRegion getLastStructuredDocumentRegion() {
+ return ((IDOMNode) basicNode).getLastStructuredDocumentRegion();
+ }
+
+ public IDOMModel getModel() {
+ return ((IDOMNode) basicNode).getModel();
+ }
+
+ public ITextRegion getNameRegion() {
+ return ((IDOMNode) basicNode).getNameRegion();
+ }
+
+ public String getSource() {
+ return ((IDOMNode) basicNode).getSource();
+ }
+
+ public IStructuredDocumentRegion getStartStructuredDocumentRegion() {
+ return ((IDOMNode) basicNode).getStartStructuredDocumentRegion();
+ }
+
+ public IStructuredDocument getStructuredDocument() {
+ return getStructuredDocument();
+ }
+
+ public ITextRegion getValueRegion() {
+ return ((IDOMNode) basicNode).getValueRegion();
+ }
+
+ public String getValueSource() {
+ return ((IDOMNode) basicNode).getValueSource();
+ }
+
+ public boolean isChildEditable() {
+ return ((IDOMNode) basicNode).isChildEditable();
+ }
+
+ public boolean isClosed() {
+ return ((IDOMNode) basicNode).isClosed();
+ }
+
+ public boolean isContainer() {
+ return ((IDOMNode) basicNode).isContainer();
+ }
+
+ public boolean isDataEditable() {
+ return ((IDOMNode) basicNode).isDataEditable();
+ }
+
+ public boolean isId() {
+ return ((IDOMNode) basicNode).isId();
+ }
+
+ public void setChildEditable(boolean editable) {
+ ((IDOMNode) basicNode).setChildEditable(editable);
+ }
+
+ public void setDataEditable(boolean editable) {
+ ((IDOMNode) basicNode).setDataEditable(editable);
+ }
+
+ public void setEditable(boolean editable, boolean deep) {
+ ((IDOMNode) basicNode).setEditable(editable, deep);
+
+ }
+
+ public void setSource(String source) throws InvalidCharacterException {
+
+ ((IDOMNode) basicNode).setSource(source);
+ }
+
+ public void setValueSource(String source) {
+ ((IDOMNode) basicNode).setValueSource(source);
+
+ }
+
+ public boolean contains(int testPosition) {
+ return ((IDOMNode) basicNode).contains(testPosition);
+ }
+
+ public int getEndOffset() {
+ return ((IDOMNode) basicNode).getEndOffset() + basicOffset;
+ }
+
+ public int getLength() {
+ return ((IDOMNode) basicNode).getLength();
+ }
+
+ public int getStartOffset() {
+ return ((IDOMNode) basicNode).getStartOffset()+ basicOffset;
+ }
+
+ public void addAdapter(INodeAdapter adapter) {
+ ((IDOMNode) basicNode).addAdapter(adapter);
+ }
+
+ public INodeAdapter getAdapterFor(Object type) {
+ return ((IDOMNode) basicNode).getAdapterFor(type);
+ }
+
+ public Collection getAdapters() {
+ return ((IDOMNode) basicNode).getAdapters();
+ }
+
+ public INodeAdapter getExistingAdapter(Object type) {
+ return ((IDOMNode) basicNode).getExistingAdapter(type);
+ }
+
+ public void notify(int eventType, Object changedFeature, Object oldValue,
+ Object newValue, int pos) {
+ ((IDOMNode) basicNode).notify();
+
+ }
+
+ public void removeAdapter(INodeAdapter adapter) {
+ ((IDOMNode) basicNode).removeAdapter(adapter);
+ }
+
+ protected NodeProxy getNodeAdapter(Node node) {
+ if (node == null)
+ return null;
+
+ if (node instanceof IDOMText)
+ return new TextProxy((IDOMText) node, basicOffset);
+ else if (node instanceof IDOMElement)
+ return new ElementProxy((IDOMElement) node, basicOffset);
+ else
+ return new NodeProxy(node, basicOffset);
+ }
+
+ protected NodeList createNodeAdapterList(NodeList nodeList) {
+
+ NodeListImpl newNodeList = new NodeListImpl();
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+
+ newNodeList.appendNode(getNodeAdapter(node));
+
+ }
+
+ return newNodeList;
+
+ }
+
+}
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextAdapter.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextAdapter.java 2008-02-26
07:39:40 UTC (rev 6570)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextAdapter.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.jsf.template.util.model;
-
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Text;
-
-public class TextAdapter extends NodeAdapter implements IDOMText {
-
- public TextAdapter(IDOMText basicText, int basicOffset) {
- super(basicText, basicOffset);
- // TODO Auto-generated constructor stub
- }
-
- public void appendText(Text text) {
- ((IDOMText) basicNode).appendText(text);
-
- }
-
- public String getWholeText() {
- return ((IDOMText) basicNode).getWholeText();
- }
-
- public boolean isElementContentWhitespace() {
- return ((IDOMText) basicNode).isElementContentWhitespace();
- }
-
- public boolean isInvalid() {
- return ((IDOMText) basicNode).isInvalid();
- }
-
- public Text replaceWholeText(String content) throws DOMException {
- return ((IDOMText) basicNode).replaceWholeText(content);
- }
-
- public Text splitText(int offset) throws DOMException {
- return ((IDOMText) basicNode).splitText(offset);
- }
-
- public void appendData(String arg) throws DOMException {
- ((IDOMText) basicNode).appendData(arg);
-
- }
-
- public void deleteData(int offset, int count) throws DOMException {
- ((IDOMText) basicNode).deleteData(offset, count);
-
- }
-
- public String getData() throws DOMException {
- return ((IDOMText) basicNode).getData();
- }
-
- public void insertData(int offset, String arg) throws DOMException {
- ((IDOMText) basicNode).insertData(offset, arg);
-
- }
-
- public void replaceData(int offset, int count, String arg)
- throws DOMException {
- ((IDOMText)basicNode).replaceData(offset, count, arg);
-
- }
-
- public void setData(String data) throws DOMException {
- ((IDOMText)basicNode).setData(data);
-
- }
-
- public String substringData(int offset, int count) throws DOMException {
- return ((IDOMText) basicNode).substringData(offset, count);
- }
-
-}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextProxy.java
(from rev 6570,
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextAdapter.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextProxy.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/TextProxy.java 2008-02-26
08:01:17 UTC (rev 6571)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template.util.model;
+
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Text;
+
+public class TextProxy extends NodeProxy implements IDOMText {
+
+ public TextProxy(IDOMText basicText, int basicOffset) {
+ super(basicText, basicOffset);
+ // TODO Auto-generated constructor stub
+ }
+
+ public void appendText(Text text) {
+ ((IDOMText) basicNode).appendText(text);
+
+ }
+
+ public String getWholeText() {
+ return ((IDOMText) basicNode).getWholeText();
+ }
+
+ public boolean isElementContentWhitespace() {
+ return ((IDOMText) basicNode).isElementContentWhitespace();
+ }
+
+ public boolean isInvalid() {
+ return ((IDOMText) basicNode).isInvalid();
+ }
+
+ public Text replaceWholeText(String content) throws DOMException {
+ return ((IDOMText) basicNode).replaceWholeText(content);
+ }
+
+ public Text splitText(int offset) throws DOMException {
+ return ((IDOMText) basicNode).splitText(offset);
+ }
+
+ public void appendData(String arg) throws DOMException {
+ ((IDOMText) basicNode).appendData(arg);
+
+ }
+
+ public void deleteData(int offset, int count) throws DOMException {
+ ((IDOMText) basicNode).deleteData(offset, count);
+
+ }
+
+ public String getData() throws DOMException {
+ return ((IDOMText) basicNode).getData();
+ }
+
+ public void insertData(int offset, String arg) throws DOMException {
+ ((IDOMText) basicNode).insertData(offset, arg);
+
+ }
+
+ public void replaceData(int offset, int count, String arg)
+ throws DOMException {
+ ((IDOMText)basicNode).replaceData(offset, count, arg);
+
+ }
+
+ public void setData(String data) throws DOMException {
+ ((IDOMText)basicNode).setData(data);
+
+ }
+
+ public String substringData(int offset, int count) throws DOMException {
+ return ((IDOMText) basicNode).substringData(offset, count);
+ }
+
+}