Package org.eclipse.wst.sse.core.internal.provisional

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion


import org.w3c.dom.Node;

public class StructuredSelectEnclosingXMLActionDelegate extends StructuredSelectActionDelegate {

  protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
    IndexedRegion indexedRegion = null;

    indexedRegion = getIndexedRegion(document, textSelection.getOffset());

    return indexedRegion;
  }
View Full Code Here


      if ((cursorNodeRegion.getOffset() >= textSelection.getOffset()) && (cursorNodeRegion.getOffset() <= textSelection.getOffset() + textSelection.getLength()) && (cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= textSelection.getOffset()) && (cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= textSelection.getOffset() + textSelection.getLength())) {
        Node newNode = cursorNode.getParentNode();

        if (newNode instanceof IndexedRegion) {
          IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
          newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
        }
      }
      else {
        newRegion = cursorNodeRegion;
      }
View Full Code Here

import org.w3c.dom.Node;

public class StructuredSelectPreviousXMLActionDelegate extends StructuredSelectActionDelegate {

  protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
    IndexedRegion indexedRegion = null;

    indexedRegion = getIndexedRegion(document, textSelection.getOffset());

    return indexedRegion;
  }
View Full Code Here

        Node newNode = cursorNode.getPreviousSibling();
        if (newNode == null) {
          newNode = cursorNode.getParentNode();

          if (newNode instanceof IndexedRegion) {
            IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
            newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
          }
        }
        else {
          if (newNode instanceof IndexedRegion) {
            IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
            newRegion = new Region(newIndexedRegion.getStartOffset(), textSelection.getOffset() + textSelection.getLength() - newIndexedRegion.getStartOffset());

            if (newNode.getNodeType() == Node.TEXT_NODE) {
              newRegion = getNewSelectionRegion(newIndexedRegion, new TextSelection(newRegion.getOffset(), newRegion.getLength()));
            }
          }
View Full Code Here

    int offset = textSelection.getOffset() + textSelection.getLength() - 1;
    if (offset < 0) {
      offset = 0;
    }

    IndexedRegion indexedRegion = null;

    indexedRegion = getIndexedRegion(document, offset);

    return indexedRegion;
  }
View Full Code Here

      Node newNode = node.getNextSibling();
      if (newNode == null) {
        newNode = node.getParentNode();

        if (newNode instanceof IndexedRegion) {
          IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
          newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
        }
      }
      else {
        if (newNode instanceof IndexedRegion) {
          IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
          newRegion = new Region(textSelection.getOffset(), newIndexedRegion.getEndOffset() - textSelection.getOffset());

          if (newNode.getNodeType() == Node.TEXT_NODE) {
            newRegion = getNewSelectionRegion2(newIndexedRegion, new TextSelection(newRegion.getOffset(), newRegion.getLength()));
          }
        }
View Full Code Here

     * @see org.eclipse.wst.sse.ui.internal.spelling.ISpellcheckDelegate#shouldSpellcheck(org.eclipse.wst.sse.core.internal.provisional.IndexedRegion)
     */
    public boolean shouldSpellcheck(int offset, IStructuredModel model) {
      boolean shouldSpellcheck = true;
     
      IndexedRegion region = model.getIndexedRegion(offset);
      if(region != null) {
        shouldSpellcheck = region instanceof Comment;
        if (!shouldSpellcheck && region instanceof Text) {
          final Node parent = ((Text) (region)).getParentNode();
          if (parent != null && parent.getNodeType() == Node.ELEMENT_NODE) {
View Full Code Here

    int offset = textSelection.getOffset() + textSelection.getLength() - 1;
    if (offset < 0) {
      offset = 0;
    }

    IndexedRegion indexedRegion = null;

    indexedRegion = getIndexedRegion(document, offset);

    return indexedRegion;
  }
View Full Code Here

      Node newNode = node.getNextSibling();
      if (newNode == null) {
        newNode = node.getParentNode();

        if (newNode instanceof IndexedRegion) {
          IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
          newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
        }
      }
      else {
        if (newNode instanceof IndexedRegion) {
          IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
          newRegion = new Region(textSelection.getOffset(), newIndexedRegion.getEndOffset() - textSelection.getOffset());

          if (newNode.getNodeType() == Node.TEXT_NODE) {
            newRegion = getNewSelectionRegion2(newIndexedRegion, new TextSelection(newRegion.getOffset(), newRegion.getLength()));
          }
        }
View Full Code Here

  void processAction(IDocument document, ITextSelection textSelection) {
    IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
    if (model != null) {
      try {
        IndexedRegion selectionStartIndexedRegion = model.getIndexedRegion(textSelection.getOffset());
        IndexedRegion selectionEndIndexedRegion = model.getIndexedRegion(textSelection.getOffset() + textSelection.getLength());

        if (selectionStartIndexedRegion == null) {
          return;
        }
        if ((selectionEndIndexedRegion == null) && (textSelection.getLength() > 0)) {
          selectionEndIndexedRegion = model.getIndexedRegion(textSelection.getOffset() + textSelection.getLength() - 1);
        }
        if (selectionEndIndexedRegion == null) {
          return;
        }

        int openCommentOffset = selectionStartIndexedRegion.getStartOffset();
        int closeCommentOffset = selectionEndIndexedRegion.getEndOffset() + OPEN_COMMENT.length();


        if ((textSelection.getLength() == 0) && (selectionStartIndexedRegion instanceof CommentImpl)) {
          return;
        }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.