Search in sources :

Example 1 with GherkinTableCell

use of org.jetbrains.plugins.cucumber.psi.GherkinTableCell in project intellij-plugins by JetBrains.

the class GherkinTableRowImpl method deleteCell.

public void deleteCell(int columnIndex) {
    final List<GherkinTableCell> cells = getPsiCells();
    if (columnIndex < cells.size()) {
        PsiElement cell = cells.get(columnIndex);
        PsiElement nextPipe = cell.getNextSibling();
        if (nextPipe instanceof PsiWhiteSpace) {
            nextPipe = nextPipe.getNextSibling();
        }
        if (nextPipe != null && nextPipe.getNode().getElementType() == GherkinTokenTypes.PIPE) {
            nextPipe.delete();
        }
        cell.delete();
    }
}
Also used : GherkinTableCell(org.jetbrains.plugins.cucumber.psi.GherkinTableCell) PsiElement(com.intellij.psi.PsiElement) PsiWhiteSpace(com.intellij.psi.PsiWhiteSpace)

Example 2 with GherkinTableCell

use of org.jetbrains.plugins.cucumber.psi.GherkinTableCell in project intellij-plugins by JetBrains.

the class GherkinTableRowImpl method getColumnWidth.

public int getColumnWidth(int columnIndex) {
    final List<GherkinTableCell> cells = getPsiCells();
    if (cells.size() <= columnIndex) {
        return 0;
    }
    final PsiElement cell = cells.get(columnIndex);
    if (cell != null && cell.getText() != null) {
        return cell.getText().trim().length();
    }
    return 0;
}
Also used : GherkinTableCell(org.jetbrains.plugins.cucumber.psi.GherkinTableCell) PsiElement(com.intellij.psi.PsiElement)

Aggregations

PsiElement (com.intellij.psi.PsiElement)2 GherkinTableCell (org.jetbrains.plugins.cucumber.psi.GherkinTableCell)2 PsiWhiteSpace (com.intellij.psi.PsiWhiteSpace)1