Examples of IndexedRegion


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

      if (file == null || !file.exists())
        return;

      // this will be the wrong region if it's Text (instead of Element)
      // we don't know how to validate Text
      IndexedRegion ir = getCoveringNode(dirtyRegion); // model.getIndexedRegion(dirtyRegion.getOffset());
      if (ir instanceof Text) {
        while (ir != null && ir instanceof Text) {
          // it's assumed that this gets the IndexedRegion to
          // the right of the end offset
          ir = model.getIndexedRegion(ir.getEndOffset());
        }
      }

      if (ir instanceof INodeNotifier) {
View Full Code Here

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

    }
  }

  private IndexedRegion getCoveringNode(IRegion dirtyRegion) {

    IndexedRegion largestRegion = null;
    if (fDocument instanceof IStructuredDocument) {
      IStructuredDocumentRegion[] regions = ((IStructuredDocument) fDocument).getStructuredDocumentRegions(dirtyRegion.getOffset(), dirtyRegion.getLength());
      largestRegion = getLargest(regions);
    }
    return largestRegion;
View Full Code Here

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

  private IndexedRegion getLargest(IStructuredDocumentRegion[] sdRegions) {

    if (sdRegions == null || sdRegions.length == 0)
      return null;

    IndexedRegion currentLargest = getCorrespondingNode(sdRegions[0]);
    for (int i = 0; i < sdRegions.length; i++) {
      if (!sdRegions[i].isDeleted()) {
        IndexedRegion corresponding = getCorrespondingNode(sdRegions[i]);

        if (currentLargest instanceof Text)
          currentLargest = corresponding;

        if (corresponding != null) {
          if (!(corresponding instanceof Text)) {
            if (corresponding.getStartOffset() <= currentLargest.getStartOffset() && corresponding.getEndOffset() >= currentLargest.getEndOffset())
              currentLargest = corresponding;
          }
        }

      }
View Full Code Here

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

    return currentLargest;
  }

  protected IndexedRegion getCorrespondingNode(IStructuredDocumentRegion sdRegion) {
    IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(fDocument);
    IndexedRegion indexedRegion = null;
    try {
      if (sModel != null)
        indexedRegion = sModel.getIndexedRegion(sdRegion.getStart());
    }
    finally {
View Full Code Here

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

          else {
            // Defect #241090, the Text Nodes inside of JSP
            // scriptlets, expressions, and declarations are valid
            // breakpoint-able locations
            boolean isCodeNode = false;
            IndexedRegion node = model.getIndexedRegion(regionStartOffset);
            if (node != null && node instanceof Node) {
              Node domNode = (Node) node;
              Node root = domNode.getOwnerDocument().getDocumentElement();
              if (root != null && root.getNodeName().equals(JSP12Namespace.ElementName.ROOT) && domNode.getNodeType() == Node.TEXT_NODE && domNode.getParentNode() != null) {
                String parentName = domNode.getParentNode().getNodeName();
View Full Code Here

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

    IStructuredDocumentRegion currentRegion = document.getRegionAtCharacterOffset(start);
    if (currentRegion != null) {
      int startOffset = currentRegion.getStartOffset();

      // get initial dom node
      IndexedRegion currentIndexedRegion = model.getIndexedRegion(startOffset);
      if (currentIndexedRegion instanceof IDOMNode) {
        // set up domRegion which will contain current region to be
        // formatted
        IDOMNode currentDOMNode = (IDOMNode) currentIndexedRegion;
        DOMRegion domRegion = new DOMRegion();
View Full Code Here

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

       
        // use structured model to determine area to process
        if (sModel != null) {
          int start = dirtyRegion.getOffset();
          int end = start + dirtyRegion.getLength();
          IndexedRegion irStart = sModel.getIndexedRegion(start);
          IndexedRegion irEnd = sModel.getIndexedRegion(end);

          if (irStart != null) {
            start = Math.min(start, irStart.getStartOffset());
          }
          if (irEnd != null) {
            end = Math.max(end, irEnd.getEndOffset());
          }
          super.process(createDirtyRegion(start, end - start, DirtyRegion.INSERT));
        } else {
          super.process(dirtyRegion);
        }
View Full Code Here

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

 
  private Object[] getSelectedObjects(IStructuredModel model,
      ITextSelection selection) {
    Object[] selectedStructures = null;
    if (model != null) {
      IndexedRegion region = model
          .getIndexedRegion(selection.getOffset());
      int end = selection.getOffset() + selection.getLength();
      if (region != null) {
        if (end <= region.getEndOffset()) {
          // single selection
          selectedStructures = new Object[1];
          selectedStructures[0] = region;
        } else {
          // multiple selection
          int maxLength = model.getStructuredDocument().getLength();
          List structures = new ArrayList(2);
          while (region != null && region.getEndOffset() <= end
              && region.getEndOffset() < maxLength) {
            structures.add(region);
            region = model
                .getIndexedRegion(region.getEndOffset() + 1);
          }
          selectedStructures = structures.toArray();
        }
      }
    }
View Full Code Here

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

    }
    unloadPreferences();
  }

  private void processDirective(IReporter reporter, IFile file, IStructuredModel model, IStructuredDocumentRegion documentRegion) {
    IndexedRegion ir = model.getIndexedRegion(documentRegion.getStartOffset());
    if (ir instanceof IDOMElement) {
      IDOMElement element = (IDOMElement) ir;
      ModelQuery query = ModelQueryUtil.getModelQuery(model);
      if (query != null) {
        CMElementDeclaration cmElement = query.getCMElementDeclaration(element);
View Full Code Here

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

      if (selection instanceof ITextSelection && document != null) {
        ITextSelection textSelection = (ITextSelection) selection;

        if (textSelection.getLength() < document.getLength()) {
          // get current indexed region
          IndexedRegion cursorIndexedRegion = getCursorIndexedRegion(document, textSelection);

          // determine new selection based on current indexed region
          Region newSelectionRegion = getNewSelectionRegion(cursorIndexedRegion, textSelection);

          // select new selection
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.