private void checkSemiColon() {
    fAppendSemiColon = false;

    ITextRegion targetRegion = fContext.getTargetRegion();
    if (targetRegion != null
        && targetRegion.getType() != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
      // find trailing ":" or ";"
      // if ":" before ";" is found, add ";"
      RegionIterator iterator = fContext.getRegionIterator();
      IStructuredDocumentRegion container = iterator.getStructuredDocumentRegion();
      while (iterator.hasNext()) {
        ITextRegion region = iterator.next();
        if (iterator.getStructuredDocumentRegion() != container) {
          break;
        }
        if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
          fAppendSemiColon = true;
          break;
        }
      }
      if (!fAppendSemiColon) {
        // second chance:
        // leading IStructuredDocumentRegion is not ";"
        IStructuredDocumentRegion nextStructuredDocumentRegion =
            CSSUtil.findNextSignificantNode(container);
        if (CSSUtil.getStructuredDocumentRegionType(nextStructuredDocumentRegion)
            != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
          fAppendSemiColon = true;
        }
      }
    }
  }
  private void addSemiColon(List candidates) {
    ICSSNode targetNode = fContext.getTargetNode();
    if (targetNode instanceof ICSSStyleDeclItem) {
      ICSSNode firstChild = targetNode.getFirstChild();
      if (firstChild == null) {
        return;
      }
      if (firstChild instanceof IndexedRegion) {
        int startOffset = ((IndexedRegion) firstChild).getStartOffset();
        if (fContext.getCursorPos() <= startOffset) {
          return;
        }
      }
    }

    boolean bAddCloser = false;

    ITextRegion targetRegion = fContext.getTargetRegion();
    if (targetRegion != null
        && targetRegion.getType() != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
      // find trailing ":" or ";"
      // if ":" before ";" is found, add ";"
      RegionIterator iterator = fContext.getRegionIterator();
      IStructuredDocumentRegion container = iterator.getStructuredDocumentRegion();
      while (iterator.hasNext()) {
        ITextRegion region = iterator.next();
        if (iterator.getStructuredDocumentRegion() != container) {
          break;
        }
        if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
          bAddCloser = true;
          break;
        }
      }
      if (!bAddCloser) {
        // second chance:
        // leading IStructuredDocumentRegion is not ";"
        IStructuredDocumentRegion nextStructuredDocumentRegion =
            CSSUtil.findNextSignificantNode(container);
        if (CSSUtil.getStructuredDocumentRegionType(nextStructuredDocumentRegion)
            != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
          bAddCloser = true;
        }
      }
    }

    if (bAddCloser) {
      CSSCACandidate item = new CSSCACandidate();
      String text = fContext.getTextToReplace() + ";"; // $NON-NLS-1$
      item.setReplacementString(text);
      item.setCursorPosition(text.length());
      item.setDisplayString(";"); // $NON-NLS-1$
      item.setImageType(null);
      candidates.add(item);
    }
  }