diff options
author | rsrinivasan | 2006-11-07 20:10:26 +0000 |
---|---|---|
committer | rsrinivasan | 2006-11-07 20:10:26 +0000 |
commit | 39dfbffede5cb1ba440638da0e1fb6e26f06f901 (patch) | |
tree | dd3429c37927a28519b4f0e5ef1e4f25aad544ae /jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMPosition.java | |
parent | 91f4087e01fe9b54ced4b979d421272cc05de6d9 (diff) | |
download | webtools.jsf-39dfbffede5cb1ba440638da0e1fb6e26f06f901.tar.gz webtools.jsf-39dfbffede5cb1ba440638da0e1fb6e26f06f901.tar.xz webtools.jsf-39dfbffede5cb1ba440638da0e1fb6e26f06f901.zip |
This commit was manufactured by cvs2svn to create tag 'v20061114-20M3'.v20061114-20M3
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMPosition.java')
-rw-r--r-- | jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMPosition.java | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMPosition.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMPosition.java deleted file mode 100644 index 1c340bd2a..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMPosition.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Sybase, Inc. and others. - * - * All rights reserved. This program and the accompanying materials - * are 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.pagedesigner.dom; - -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; - -/** - * @author mengbo - */ -public class DOMPosition implements IDOMPosition { - Node _containerNode; - - int _offset; - - public DOMPosition(Node containerNode, int offset) { - _containerNode = containerNode; - _offset = offset; - } - - /** - * this is the offset in the DOM tree. When parent node is text node, the - * offset if the offset into the actual displayed data of the text node. - * - * when parent is not text node, then the offset is the index in - * getIDOMNode().getChildNodes() - * - * @return - */ - public int getOffset() { - return _offset; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.pagedesigner.range.IDOMPosition#getNextSiblingNode() - */ - public Node getNextSiblingNode() { - if (isText()) - return null; - NodeList children = _containerNode.getChildNodes(); - int length = children.getLength(); - if (_offset >= length || _offset < 0) - return null; - else - return (IDOMNode) children.item(_offset); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.pagedesigner.range.IDOMPosition#getPreviousSiblingNode() - */ - public Node getPreviousSiblingNode() { - if (isText()) - return null; - NodeList children = _containerNode.getChildNodes(); - int length = children.getLength(); - if (_offset > length || _offset <= 0) - return null; - else - return (IDOMNode) children.item(_offset - 1); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.pagedesigner.range.IDOMPosition#getContainerNode() - */ - public Node getContainerNode() { - return _containerNode; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.pagedesigner.range.IDOMPosition#isText() - */ - public boolean isText() { - return _containerNode instanceof Text; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.pagedesigner.range.IDOMPosition#getSibling(boolean) - */ - public Node getSibling(boolean forward) { - if (forward) - return getNextSiblingNode(); - else - return getPreviousSiblingNode(); - } - - public IDOMPosition handleReplacement(Node original, Node replacement) { - if (original == this._containerNode) { - return new DOMPosition(replacement, this._offset); - } else { - return this; - } - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - public String toString() { - return "DOMPosition: (" + _containerNode + " : " + _offset + ")"; - } -} |