@SuppressWarnings("serial")
    public TextComponentContextActionSupport(JTextComponent textComponent) {
        super(textComponent);

        UndoManager um = (UndoManager) textComponent.getClientProperty(
                PropertyKeys.UNDO_MANAGER);
        if (um == null) {
            um = new UndoManager();
            textComponent.putClientProperty(PropertyKeys.UNDO_MANAGER, um);
            textComponent.getDocument().addUndoableEditListener(um);
        }

        install(TextContextAction.UNDO, 0);
        install(TextContextAction.REDO, 0);
        install(TextContextAction.CUT, 1);
        install(TextContextAction.COPY, 1);
        install(TextContextAction.PASTE, 1);
        install(TextContextAction.DELETE, 1);
        install(TextContextAction.SELECT_ALL, 2);
        install(TextContextAction.CUT_ALL, 2);
        install(TextContextAction.COPY_ALL, 2);
        install(TextContextAction.REPLACE_ALL, 2);
        install(TextContextAction.DELETE_ALL, 2);
    }