private static int calculateDisplayedWidth(String string)
    {

        final int tabWidth = getPreferenceStore().getInt(
            AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);

        int column = 0;
        for (int i = 0; i < string.length(); i++) {
            if ('\t' == string.charAt(i)) {
                column += tabWidth - (column % tabWidth);
            } else {
                column++;
            }
        }
        return column;
    }
Returns the displayed width of a string, taking in account the displayed tab width. The result can be compared
against the print margin.
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/indent/SQLCommentAutoIndentStrategy.java