Examples of ITypedRegion


Examples of org.eclipse.jface.text.ITypedRegion

          boolean skipCommentLines, boolean skipStrings) throws BadLocationException {
    int deep = 0;
    int i = offset;
    if (forward) {
      while (i < d.getLength()) {
        ITypedRegion region = TextUtilities.getPartition(d, fPartitioning, i, true);
        if (region.getType() == RutaPartitions.RUTA_COMMENT && skipCommentLines) {
          i = region.getOffset() + region.getLength();
          continue;
        }
        if (region.getType() == RutaPartitions.RUTA_STRING && skipStrings) {
          i = region.getOffset() + region.getLength();
          continue;
        }
        char c = d.getChar(i);
        if (c == opening)
          deep++;
        if (c == closing) {
          if (deep == 0)
            return i;
          deep--;
        }
        i++;
        if (i - offset > maxCharsAway)
          return -1;
      }
    } else {
      while (i >= 0) {
        ITypedRegion region = TextUtilities.getPartition(d, fPartitioning, i, true);
        if (region.getType() == RutaPartitions.RUTA_COMMENT && skipCommentLines) {
          i = region.getOffset() - 1;
          continue;
        }
        if (region.getType() == RutaPartitions.RUTA_STRING && skipStrings) {
          i = region.getOffset() - 1;
          continue;
        }
        char c = d.getChar(i);
        if (c == closing)
          deep++;
View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

      // This is the first non-empty line, use zero indent.
      return "";
    }

    // first check, if we not inside string, if yes, jump to start
    ITypedRegion region = TextUtilities.getPartition(d, fPartitioning,
            d.getLineOffset(lastNonEmptyLine), true);
    if (region.getType() == RutaPartitions.RUTA_STRING) {
      lastNonEmptyLine = d.getLineOfOffset(region.getOffset());
    }

    // If the previous line is inside parenthesis, use the indent of the
    // starting line.
    int plnumstart;
View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

  }

  @Override
  public void caretMoved(CaretEvent event) {
    try {
      ITypedRegion region = fDocumentProvider.getDocument(fInput).getPartition(event.caretOffset);

      if (getTreeViewer()!=null) {
        getTreeViewer().setSelection(new StructuredSelection(region));
        getTreeViewer().reveal(region);
        getTreeViewer().expandToLevel(region, TreeViewer.ALL_LEVELS);
View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

      final IDocument document = getSourceViewer().getDocument();
      if (document != null) {
        try {
          final Point selection = viewer.getSelectedRange();
          final int offset = selection.x;
          final ITypedRegion partition = document.getPartition(offset);
          if (partitions.contains(partition.getType())) {
            // Don't modify if the editor input cannot be changed
            if (!validateEditorInputState())
              return false;
            event.doit = !inserter.pair(viewer, event.character);
            return true;
View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

    if (textViewer != null && region != null) {
      IDocument doc = textViewer.getDocument();
      if (doc != null) {
        try {
          // check if jsp tag/directive first
          ITypedRegion partition = TextUtilities.getPartition(doc, IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, region.getOffset(), false);
          if (partition != null && partition.getType() == IJSPPartitions.JSP_DIRECTIVE) {
            IStructuredModel sModel = null;
            try {
              sModel = StructuredModelManager.getModelManager().getExistingModelForRead(doc);
              // check if jsp taglib directive
              Node currentNode = getCurrentNode(sModel, region.getOffset());
View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

      displayText = null;
    }
    else {
      int offset = hoverRegion.getOffset();

      ITypedRegion region;
      try {
        region = viewer.getDocument().getPartition(offset);
        if (region != null) {
          displayText = region.getType();
        }
        else {
          displayText = "Null Region was returned?!"; //$NON-NLS-1$
        }
      }
View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

   *         whitespace. otherwise, returns <code>null</code>
   *
   * @see org.eclipse.jface.text.ITextHover#getHoverRegion(ITextViewer, int)
   */
  public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
    ITypedRegion region = null;
    if ((textViewer == null) || (textViewer.getDocument() == null)) {
      region = null;
    }
    else {

View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

      TextPresentation presentation= new TextPresentation(damage, 1000);

      ITypedRegion[] partitions= TextUtilities.computePartitioning(document, getDocumentPartitioning(), damage.getOffset(), validLength, false);
      for (int i= 0; i < partitions.length; i++) {
        ITypedRegion r= partitions[i];
        IPresentationRepairer repairer= getRepairer(r.getType());
        if (repairer != null)
          repairer.createPresentation(presentation, r);
      }

      return presentation;
View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

    IRegion damage= null;
    try {
      int offset= e.getOffset();
      if (isDeletion)
        offset= Math.max(0, offset - 1);
      ITypedRegion partition= getPartition(e.getDocument(), offset);
      IPresentationDamager damager= getDamager(partition.getType());
      if (damager == null)
        return null;

      IRegion r= damager.getDamageRegion(partition, e, fDocumentPartitioningChanged);
View Full Code Here

Examples of org.eclipse.jface.text.ITypedRegion

      length= e.getText().length();
      if (length > 0)
        -- length;
    }

    ITypedRegion partition= getPartition(d, e.getOffset() + length);
    int endOffset= partition.getOffset() + partition.getLength();
    if (endOffset == e.getOffset())
      return -1;

    int end= fRememberedPosition == null ? -1 : fRememberedPosition.getOffset() + fRememberedPosition.getLength();
    if (endOffset < end && end < d.getLength())
      partition= getPartition(d, end);

    //if there is not damager for the partition then use the endOffset of the partition
    IPresentationDamager damager= getDamager(partition.getType());
    if (damager != null) {
      IRegion r= damager.getDamageRegion(partition, e, fDocumentPartitioningChanged);
      endOffset = r.getOffset() + r.getLength();
    }
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.