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

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


  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) || (selectionEndIndexedRegion == null)) {
          return;
        }

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

        model.beginRecording(this, XMLUIMessages.RemoveBlockComment_tooltip);
        model.aboutToChangeModel();

        try {
View Full Code Here


    setErrorMessage(null);

    fTextViewer = textViewer;

    IndexedRegion treeNode = ContentAssistUtils.getNodeAt(textViewer, documentPosition);

    Node node = (Node) treeNode;
    while ((node != null) && (node.getNodeType() == Node.TEXT_NODE) && (node.getParentNode() != null)) {
      node = node.getParentNode();
    }
View Full Code Here

      try {
        final IDocument document = getDocument(editor);
        if (document instanceof IStructuredDocument) {
          model = StructuredModelManager.getModelManager().getModelForRead((IStructuredDocument) document);
          if (model != null) {
            final IndexedRegion region = model.getIndexedRegion(fPosition.offset);
            if (region != null) {
              selection = new StructuredSelection(region);
            }
          }
        }
View Full Code Here

      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

      IStructuredModel sModel = null;
      try {
        sModel = StructuredModelManager.getModelManager()
            .getExistingModelForRead(fDocument);
        if (sModel != null) {
          IndexedRegion startNode = sModel.getIndexedRegion(0);
          if (startNode == null) {
            assert sModel instanceof IDOMModel;
            startNode = ((IDOMModel) sModel).getDocument();
          }
View Full Code Here

    if (fAdapterFactory.isNodeProjectable(node)
        && node instanceof IndexedRegion) {
      // IDocument document =
      // fAdapterFactory.getProjectionViewer().getDocument();
      // if (document != null) {
      IndexedRegion inode = (IndexedRegion) node;
      // only want to fold regions of the valid type and with a valid
      // range
      if (inode.getStartOffset() >= 0 && inode.getLength() >= 0) {
        IDOMNode node1 = (IDOMNode) inode;
        IStructuredDocumentRegion startRegion = node1
            .getStartStructuredDocumentRegion();
        IStructuredDocumentRegion endRegion = node1
            .getEndStructuredDocumentRegion();
View Full Code Here

  protected XMLModelUpdater createModelUpdater() {
    return new PHPDOMModelUpdater(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

      // 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 Node either element, doctype, text, or null
   */
  private Node getCurrentNode(IDocument document, int offset) {
    // get the current node at the offset (returns either: element,
    // doctype, text)
    IndexedRegion inode = null;
    IStructuredModel sModel = null;
    try {
      sModel = StructuredModelManager.getModelManager()
          .getExistingModelForRead(document);
      inode = sModel.getIndexedRegion(offset);
View Full Code Here

            IStructuredModel sModel = null;
            try {
                sModel = StructuredModelManager.getModelManager()
                        .getExistingModelForRead(fDocument);
                if (sModel != null) {
                    IndexedRegion startNode = sModel.getIndexedRegion(0);
                    if (startNode == null) {
                        assert sModel instanceof IDOMModel;
                        startNode = ((IDOMModel) sModel).getDocument();
                    }
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.