Examples of BlockBalanceResult


Examples of melnorme.lang.ide.ui.text.BlockHeuristicsScannner.BlockBalanceResult

  protected void smartIndentAfterNewLine(IDocument doc, DocumentCommand cmd) throws BadLocationException {
    BlockHeuristicsScannner bhscanner = createBlockHeuristicsScanner(doc);
    // Find block balances of preceding text (line start to edit cursor)
    LineIndentResult nli = determineIndent(doc, bhscanner, doc.getLineOfOffset(cmd.offset), cmd.offset);
    cmd.text += nli.nextLineIndent;
    BlockBalanceResult blockInfo = nli.blockInfo;
   
    if(blockInfo.unbalancedOpens > 0) {
      IRegion lineRegion = doc.getLineInformationOfOffset(cmd.offset);
      int lineEnd = getRegionEnd(lineRegion);
     
View Full Code Here

Examples of melnorme.lang.ide.ui.text.BlockHeuristicsScannner.BlockBalanceResult

   
    ITypedRegion partition = bhscanner.getPartition(lineStart);
    if(partitionIsIgnoredForLineIndentString(editOffset, partition)) {
      if(line == 0) {
        // empty/zero block balance
        return new LineIndentResult("", "", new BlockBalanceResult());
      } else {
        return determineIndent(doc, bhscanner, line-1);
      }
    }
   
    BlockBalanceResult blockInfo = bhscanner.calculateBlockBalances(lineStart, editOffset);
   
    if(blockInfo.unbalancedOpens == 0 && blockInfo.unbalancedCloses > 0) {
      int blockStartOffset = bhscanner.findBlockStart(blockInfo.rightmostUnbalancedBlockCloseOffset);
      int blockStartLine = doc.getLineOfOffset(blockStartOffset);
      IRegion blockStartLineInfo = doc.getLineInformationOfOffset(blockStartOffset);
     
      assertTrue(blockStartLine < doc.getLineOfOffset(lineStart));
      String startLineIndent = getLineIndent(doc, blockStartLineInfo);
     
      // Now calculate the balance for the block start line, before the block start
      int lineOffset = blockStartLineInfo.getOffset();
      BlockBalanceResult blockStartInfo = bhscanner.calculateBlockBalances(lineOffset, blockStartOffset);
     
      // Add the indent of the start line, plus the unbalanced opens there
      String newLineIndent = addIndent(startLineIndent, blockStartInfo.unbalancedOpens);
      return new LineIndentResult(null, newLineIndent, blockInfo);
    }
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.