void updateSystemSelection() {
    if (GraphicsEnvironment.isHeadless() || !Registry.is("editor.caret.update.primary.selection")) return;

    final Clipboard clip = myEditor.getComponent().getToolkit().getSystemSelection();
    if (clip != null) {
      clip.setContents(new StringSelection(myEditor.getSelectionModel().getSelectedText(true)), EmptyClipboardOwner.INSTANCE);
    }
  }
void updateSystemSelection()