Eclipse is formatting javadoc tooltips very poorly on Ubuntu

前端 未结 4 2062
执笔经年
执笔经年 2020-12-29 08:05

I\'ve been using Eclipse on Windows a lot, and recently started using it on Ubuntu for work.

My problem is, that the Javadoc tool til mostly is unformatted, E.g.

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 08:29

    It turns out this is caused by two problems:

    1. Eclipse needs webkitgtk
    2. Eclipse color scheme is messed up on ubuntu.

    The solution is thus two-fold.

    Part 1: Install webkitgtk

    Just run this command in the terminal

    sudo apt-get -y install libwebkitgtk-1.0-0 libwebkitgtk-3.0-0
    

    Thanks to Johannes H. for this bit

    Part 2: Update the color scheme

    First create a new configuration in your home directory.

    gedit ~/.gtkrc-eclipse
    

    And paste this content:

    # Customs color settings for Eclipse.
    # Load Eclipse as follows:
    # GTK2_RC_FILES=~/.gtkrc-eclipse eclipse
    #
    # Sources:
    # http://stackoverflow.com/a/24043778/722929
    # http://askubuntu.com/a/131348/18533
    # http://weblog.avp-ptr.de/20120728/how-to-fix-eclipse-colors-for-autocompletion-and-tooltips/
     
    # Tooltip background color.
    style "eclipse-tooltips" {
    bg[NORMAL] = "#f5f5b5"
    fg[NORMAL] = "#000000"
    }
     
    # Load settings.
    widget "gtk-tooltip*" style "eclipse-tooltips"
    

    Find the eclipse43.desktop file and edit it (If you are using another version of Eclipse than 4.3 update the commands accordingly):

    locate eclipse43.desktop
    # Use the location from above
    sudo gedit /usr/share/applications/eclipse43.desktop
    

    Find the line that starts with Exec=... and change it from something like this:

    Exec=/usr/bin/eclipse43
    

    to something like this

    Exec=/bin/bash -c "GTK2_RC_FILES=~/.gtkrc-eclipse /usr/bin/eclipse43"
    

    Voila, beautiful colors. (or as beautiful as Eclipse gets)

提交回复
热议问题