Examples of IndexedRegion


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

      IStructuredModel sModel = null;
      try {
        sModel = getStructuredModelForRead(fCurrentDoc);
        if (sModel != null) {
          // now compare nodes
          IndexedRegion rootRegion = sModel.getIndexedRegion(root.getOffset());
          IndexedRegion possRegion = sModel.getIndexedRegion(possible.getOffset());
          if (rootRegion != null && possRegion != null) {
            int rootStart = rootRegion.getStartOffset();
            int possStart = possRegion.getStartOffset();
            // first just check if rootregion starts before
            // possregion
            if (rootStart <= possStart) {
              // check if possregion is inside rootregion
              outer = _getOuterRegion(root, possible, sModel, rootStart, possStart);
View Full Code Here

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

   * @param document
   * @param offset
   * @return
   */
  protected IndexedRegion getIndexedRegion(IDocument document, int offset) {
    IndexedRegion indexedRegion = null;

    int lastOffset = offset;
    IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
    if (model != null) {
      try {
View Full Code Here

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

    DirtyRegion outer = null;
    int region1NodeEnd = -1;
    int region2NodeEnd = -1;
    // then check if region1's end appears after
    // region2's end
    IndexedRegion region1EndNode = sModel.getIndexedRegion(region1.getOffset() + region1.getLength());
    if (region1EndNode == null) {
      // if no end, just assume region spans all the
      // way to the end so it includes other region
      outer = region1;
    }
    else {
      region1NodeEnd = region1EndNode.getEndOffset();
      IndexedRegion region2EndNode = sModel.getIndexedRegion(region2.getOffset() + region2.getLength());
      region2NodeEnd = region2EndNode != null ? region2EndNode.getEndOffset() : getDocument().getLength();
      if (region1NodeEnd >= region2NodeEnd) {
        // root contains or is equal to possible
        outer = region1;
      }
      else if (region1NodeStart == region2NodeStart && region2NodeEnd >= region1NodeEnd) {
View Full Code Here

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

   *
   */
  protected String computeHoverHelp(ITextViewer textViewer, int documentPosition) {
    String result = null;

    IndexedRegion treeNode = ContentAssistUtils.getNodeAt(textViewer, documentPosition);
    if (treeNode == null) {
      return null;
    }
    Node node = (Node) treeNode;

View Full Code Here

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

    TemplateContext context = createContext(viewer, region, offset);
    if (context == null) {
      return new ICompletionProposal[0];
    }

    IndexedRegion treeNode = ContentAssistUtils.getNodeAt(viewer, offset);

    currentTapestryComponent = (Node) treeNode; 
    char preChar=0,preChar2=0;
    //In situation user input <, we should store the char before cursor into preChar and even preChar2
    if(currentTapestryComponent.getNodeValue() != null){
      for(int i=offset-treeNode.getStartOffset()-1; i>=0; i--){
        char temp = currentTapestryComponent.getNodeValue().charAt(i);
        if(temp != 9 && temp != 10 && temp != 32){
          if(preChar == 0)
            preChar = temp;
          else{
View Full Code Here

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

import org.w3c.dom.Node;

public class StructuredSelectPreviousXMLHandler extends AbstractStructuredSelectHandler {

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

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

    return indexedRegion;
  }
View Full Code Here

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

      Node newNode = node.getPreviousSibling();
      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(newIndexedRegion.getStartOffset(), textSelection.getOffset() + textSelection.getLength() - newIndexedRegion.getStartOffset());
 
          if (newNode.getNodeType() == Node.TEXT_NODE) {
            newRegion = getNewSelectionRegion2(newIndexedRegion, new TextSelection(newRegion.getOffset(), newRegion.getLength()));
          }
        }
View Full Code Here

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

import org.eclipse.wst.sse.ui.internal.handlers.AbstractStructuredSelectHandler;
import org.w3c.dom.Node;

public class StructuredSelectEnclosingXMLHandler extends AbstractStructuredSelectHandler {
  protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
    IndexedRegion indexedRegion = null;

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

    return indexedRegion;
  }
View Full Code Here

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

      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

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

      // go through each attribute in node and if attribute contains
      // offset, return that attribute
      for (int i = 0; i < attrs.getLength(); ++i) {
        // assumption that if parent node is of type IndexedRegion,
        // then its attributes will also be of type IndexedRegion
        IndexedRegion attRegion = (IndexedRegion) attrs.item(i);
        if (attRegion.contains(offset)) {
          return (Attr) attrs.item(i);
        }
      }
    }
    return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.