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

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


            try {
                sModel = StructuredModelManager.getModelManager()
                        .getExistingModelForRead(fDocument);
                if (sModel != null) {
                    final int startOffset = 0;
                    final IndexedRegion startNode = sModel
                            .getIndexedRegion(startOffset);
                    if (startNode instanceof Node) {
                        Node nextSibling = (Node) startNode;
                        while (nextSibling != null) {
                            final Node currentNode = nextSibling;
View Full Code Here


        return new TwigDOMModelUpdater(this);
    }
    @Override
    public IndexedRegion getIndexedRegion(int offset)
    {
        IndexedRegion result = super.getIndexedRegion(offset);
        if (result == null && offset == getDocument().getEndOffset()) {
            return (IDOMNode) getDocument().getLastChild();
        }
        return super.getIndexedRegion(offset);
    }
View Full Code Here

  public IFile getFile() {
    return file;
  }

  private IDOMNode getNodeAt(int documentOffset, int length) {
    IndexedRegion node = null;
    if (model != null) {
      // int lastOffset = documentOffset;
      node = model.getIndexedRegion(documentOffset);
      if (node == null) {
        return null;
      }
      if (node.getStartOffset() < documentOffset || node.getStartOffset() >= documentOffset + length) {
        node = null;
      }
      // while ((node == null) && lastOffset >= 0) {
      // lastOffset--;
      // node = model.getIndexedRegion(lastOffset);
View Full Code Here

      // 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

    }
    return null;
  }

  public static final boolean isElementAtOffset(Node node, int offset) {
    IndexedRegion region = ((IndexedRegion) node);
    int nameLength = node.getNodeName().length();
    return (region.getStartOffset() + nameLength) >= offset && region.getStartOffset() <= offset;
  }
View Full Code Here

  public static IndexedRegion getNodeAt(ITextViewer viewer, int documentOffset) {

    if (viewer == null)
      return null;

    IndexedRegion node = null;
    IModelManager mm = StructuredModelManager.getModelManager();
    IStructuredModel model = null;
    if (mm != null)
      model = mm.getExistingModelForRead(viewer.getDocument());
    try {
View Full Code Here

   * @param offset the offset with given document
   * @return Node either element, doctype, text, or null
   */
  public static final Node getNodeByOffset(IDocument document, int offset) {
    // get the node at offset (returns either: element, doctype, text)
    IndexedRegion inode = null;
    IStructuredModel sModel = null;
    try {
      sModel = org.eclipse.wst.sse.core.StructuredModelManager.getModelManager()
          .getExistingModelForRead(document);
      if (sModel == null && document instanceof IStructuredDocument) {
View Full Code Here

      if (prefStore.getBoolean(STS_MARK_OCCURRENCES)) {
        ISelection selection = editor.getTextViewer().getSelection();
        if (selection instanceof ITextSelection) {
          ITextSelection textSelection = (ITextSelection) selection;
          int offset = textSelection.getOffset();
          IndexedRegion node = BeansEditorUtils.getNodeAt(editor.getTextViewer(), offset);

          Set<OccurrenceLocation> locations = findLocations(node, offset);
          updateAnnotations(locations);
        }
      }
View Full Code Here

    catch (BadLocationException e) {
      throw new CoreException(new Status(Status.ERROR, BestPracticesPluginConstants.PLUGIN_ID,
          "Could not read marker offset in document", e));
    }

    IndexedRegion markedXmlRegion = model.getIndexedRegion(offset);
    Node markedXmlNode = (Node) markedXmlRegion;

    if (markedXmlNode.getParentNode() != null
        && "bean".equalsIgnoreCase(markedXmlNode.getParentNode().getNodeName())) {
      markerElement = (Element) markedXmlNode.getParentNode();
View Full Code Here

  void processAction(IDocument document, ITextSelection textSelection) {
    IStructuredModel model = StructuredModelManager.getModelManager()
        .getExistingModelForEdit(document);
    if (model != null) {
      IndexedRegion region = model.getIndexedRegion(textSelection
          .getOffset());
     
      Element elem = null;
      if (region instanceof Element) {
        elem = (Element) region;
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.