@Override
  public Object getHoverInfo2(final ITextViewer textViewer, final IRegion hoverRegion) {
    final ISourceEditor editor = getEditor();
    if (editor != null && ensureHover()) {
      try {
        final String contentType =
            (hoverRegion instanceof TypedRegion)
                ? ((TypedRegion) hoverRegion).getType()
                : TextUtils.getContentType(
                    editor.getViewer().getDocument(),
                    editor.getDocumentContentInfo(),
                    hoverRegion.getOffset(),
                    hoverRegion.getLength() == 0);

        final AssistInvocationContext context =
            createContext(hoverRegion, contentType, new NullProgressMonitor());
        if (context != null) {
          return this.hover.getHoverInfo(context);
        }
      } catch (final Exception e) {
        StatusManager.getManager()
            .handle(
                new Status(
                    IStatus.ERROR,
                    LTKUIPlugin.PLUGIN_ID,
                    NLS.bind(
                        "An error occurred when preparing the information hover ''{0}'' (mouse).",
                        this.descriptor.getName()),
                    e));
      }
    }
    return null;
  }
    @Override
    public void widgetSelected(final SelectionEvent event) {
      final TexCommand command = (TexCommand) event.widget.getData();

      final IEditorPart editor = UIAccess.getActiveWorkbenchPage(true).getActiveEditor();
      if (editor instanceof ILtxEditor) {
        final ILtxEditor texEditor = (ILtxEditor) editor;
        if (!texEditor.isEditable(true)) {
          return;
        }
        final SourceViewer viewer = ((ILtxEditor) editor).getViewer();
        Point selection = viewer.getSelectedRange();
        if (selection == null || selection.x < 0) {
          return;
        }
        try {
          final String contentType =
              TextUtils.getContentType(
                  viewer.getDocument(),
                  texEditor.getDocumentContentInfo(),
                  selection.x,
                  selection.y == 0);

          final LtxAssistInvocationContext context =
              new LtxAssistInvocationContext(
                  texEditor, selection.x, contentType, true, new NullProgressMonitor());
          final LtxCommandCompletionProposal proposal =
              new LtxCommandCompletionProposal(context, context.getInvocationOffset(), command);
          proposal.apply(viewer, (char) 0, 1, context.getInvocationOffset());
          selection = proposal.getSelection(viewer.getDocument());
          if (selection != null) {
            viewer.setSelectedRange(selection.x, selection.y);
            viewer.revealRange(selection.x, selection.y);
          } else {
            viewer.revealRange(context.getInvocationOffset(), 0);
          }
        } catch (final Exception e) {
          StatusManager.getManager()
              .handle(
                  new Status(
                      IStatus.ERROR,
                      TexUI.PLUGIN_ID,
                      0,
                      "An error occurred when inserting LaTeX symbol.",
                      e));
        }
      }
    }