Пример #1
0
  @Override
  public void performAction(ActionEvent e) {
    Doc activeDoc = actionContext.get(ActionContextKeys.ACTIVE_DOC);
    Buffer buffer = activeDoc.getActiveBuffer();

    int position = buffer.getInsertionPoint().getPosition();
    Interval selection = buffer.getSelection();
    if (selection != null) {
      position = selection.getEnd();
    }

    buffer.getFinder().forward(position);
  }
  @Override
  public void performAction(ActionEvent e) {
    TabProjectSettings ts = window.getProject().getSettingsManager().get(TabProjectSettings.class);

    Buffer activeBuffer = window.getDocList().getActiveDoc().getActiveBuffer();

    TextInterval selectionOrCurrentLine = activeBuffer.getSelectionOrCurrentLine();
    String text = selectionOrCurrentLine.getText();

    StringBuilder builder = new StringBuilder();
    for (int j = 0; j < ts.getTabSize(); j++) builder.append(" ");

    text = text.replace(builder.toString(), "\t");

    activeBuffer.replaceText(selectionOrCurrentLine, text, null);
  }