Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.ITypedRegion


    super(scanner, ATGPartitions.getLegalContentTypes());
  }

  @Override
  public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) {
    ITypedRegion region = super.getPartition(offset);
    if (preferOpenPartitions) {
      if (region.getOffset() == offset
          && !region.getType().equals(DEFAULT)){         
        if (offset > 0) {
          region = getPartition(offset - 1);
          if (   (region.getType().equals(DEFAULT)) || (region.getType().equals(null))  ) {
            return new TypedRegion(offset, 0, DEFAULT);
          } else {
            return new TypedRegion(offset, 0, getOpenPartition(region.getType()));
          }
        } else {
          return new TypedRegion(offset, 0, ATGPartitions.IMPORTS);
        }
      }
View Full Code Here


     */
    protected int findEndOfWhiteSpace(IDocument document, int offset, int end) throws BadLocationException {
      for (int i = end - 1; i >= offset; i--) {
        char c = document.getChar(i);
        if (c != ' ' && c != '\t') {
          ITypedRegion partition = document.getPartition(i);
          if (ATGPartitions.INLINE_CODE_START.equals(partition.getType())) {
            offset = partition.getOffset() + partition.getLength();
            break;
          } else {
            i -= (i - partition.getOffset());
          }
        }
      }
      while (offset < end) {
        char c = document.getChar(offset);
View Full Code Here

     */
    protected int findEndOfWhiteSpace(IDocument document, int offset, int end) throws BadLocationException {
      done: for (int i = end - 1; i >= offset; i--) {
        char c = document.getChar(i);
        if (c != ' ' && c != '\t') {
          ITypedRegion partition = document.getPartition(i);
          if (ATGPartitions.INLINE_CODE_END.equals(partition.getType())) {
            // determine the start of the inline code block
            int inlineCodeStart;
            while ((inlineCodeStart = partition.getOffset() - 1) >= 0) {
              partition = document.getPartition(inlineCodeStart);
              if (ATGPartitions.INLINE_CODE_START.equals(partition.getType())) {
                end = partition.getOffset();
                offset = document.getLineInformationOfOffset(end).getOffset();
                break done;
              }
            }
          } else {
            i -= (i - partition.getOffset());
          }
        }
      }
    while (offset < end) {
      char c = document.getChar(offset);
View Full Code Here

            try
            {
                LdifParser parser = new LdifParser();
                IDocument document = viewer.getDocument();
                ITypedRegion partition = document.getPartition( cursorPos );

                // now use position relative to partition
                int offset = partition.getOffset();
                int relativePos = cursorPos - offset;

                // parse partition
                String s = document.get( partition.getOffset(), partition.getLength() );
                LdifFile model = parser.parse( s );
                LdifContainer container = LdifFile.getContainer( model, relativePos );
                if ( container != null )
                {
                    LdifPart part = LdifFile.getContainerContent( container, relativePos );
View Full Code Here

      region= new Region(0, getDocument().getLength());

    ITypedRegion[] regions= computePartitioning(region.getOffset(), region.getLength());

    for (int i= 0; i < regions.length; i++) {
      ITypedRegion r= regions[i];
      IReconcilingStrategy s= getReconcilingStrategy(r.getType());
      if (s == null)
        continue;

      if(dirtyRegion != null)
        s.reconcile(dirtyRegion, r);
View Full Code Here

        if (!fType.equals(partitions[partitions.length - 1].getType()))
          partitions[partitions.length - 1]= TextUtilities.getPartition(document, fPartitioning, partitions[partitions.length - 1].getOffset(), false);
      }

      String type= null;
      ITypedRegion partition= null;

      partitioners= TextUtilities.removeDocumentPartitioners(document);

      for (int index= partitions.length - 1; index >= 0; index--) {

        partition= partitions[index];
        type= partition.getType();

        if (!fType.equals(type))
          formatSlave(context, document, partition.getOffset(), partition.getLength(), type);
      }

    } catch (BadLocationException exception) {
      // Should not happen
    } finally {
View Full Code Here

    int offsetTest = region.getOffset() - 1;
    char c;
    if (offsetTest > 0) {
      try {
        ITypedRegion r = ((QVTDocument) viewer.getDocument())
            .getPartition(QVTDocument.QVT_PARTITIONING, region
                .getOffset(), false);
        if (r.getType() == QVTPartitionScanner.MM_COMMENT)
          return null;

        c = viewer.getDocument().getChar(offsetTest);
        fCompletionType = COMPLETION_DEFAULT;
        if (c == '.') {
View Full Code Here

  @SuppressWarnings("unchecked")
  private List<Object> getProposalsForRegion(ITextViewer viewer,
      IRegion region) {
    List<Object> objects = new ArrayList<Object>();
    ITypedRegion r = new TypedRegion(region.getOffset(),
        region.getLength(), QVTPartitionScanner.MM_COMMENT);

    try {
      r = ((QVTDocument) viewer.getDocument()).getPartition(
          QVTDocument.QVT_PARTITIONING, region.getOffset(), false);
    } catch (Exception e) {
      UiPlugin.getDefault().getLogger().log(
          java.util.logging.Level.WARNING, "Unknown error", e);
    }
    if (r.getType() != QVTPartitionScanner.MM_COMMENT) {
      if (prefix.length() > 0) {
        // keywords
        String[] keyword = fr.tm.elibel.smartqvt.qvteditor.editors.scanner.QVTScanner.KEYWORDS;
        for (int i = 0; i < keyword.length; i++)
          objects.add(keyword[i]);
        // types
        objects.addAll(getOclQvtTypes());

        if (r.getType() != QVTPartitionScanner.MM_DECLARATION) {
          objects.add(createHelperProposal(region));
        }
      }
      if (r.getType() == QVTPartitionScanner.MM_DECLARATION) {
        objects.addAll(getProposalsForOperation(region, r));
      }
      objects.addAll(getProposalsForTransformation(r));
    }
    return objects;
View Full Code Here

      boolean multiLineCommentMode = false;
      boolean stringModeA = false;
      boolean stringModeB = false;
      boolean isText = false;
      boolean isComment = false;
      ITypedRegion region = ((QVTDocument) d).getPartition(
          QVTDocument.QVT_PARTITIONING, offset, false);
      int startregion = region.getOffset();
      int endregion = region.getOffset() + region.getLength();
      for (int i = startregion; (i < offset) && (i < endregion); i++) {
        char c = d.getChar(i);
       
        isText = stringModeA || stringModeB;
        isComment = lineCommentMode || multiLineCommentMode;
View Full Code Here

                .getOffset());
            int lineEnd = document.getLineOfOffset(regions[i]
                .getOffset()
                + regions[i].getLength()) - 1;
            if (lineBegin < lineEnd) {
              ITypedRegion r = getCompleteRegion(regions[i]);
              fPositions.add(new Position(r.getOffset(), r
                  .getLength()));
            }
          }
      } catch (Exception e) {
        UiPlugin.getDefault().getLogger().log(
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.ITypedRegion

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.