Eclipse is formatting javadoc tooltips very poorly on Ubuntu

爷,独闯天下 提交于 2019-12-18 11:46:42

问题


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. <code> tags, links, etc. have no effect. Only line chages by b, br or ,pre tags plus bold seems to be rendered. (pre don't change font.). See the first example below.

Are there any tweaks I can do, to get something like the second image?

Extra: A fix to the colors, would be also be awesome, but not as important.

Thanks.


What I see now:

What I'll like to see

Soruce: http://codeblessyou.com/wp-content/uploads/2011/07/2011-07-01_115631.jpg


回答1:


Got the same problem with the rendering of HTML inside the tooltips. After some fiddling around I got the solution:

Install libwebkitgtk-1.0-0 from the official Ubuntu repositories. It'S used by eclipse (and most likely other GTK applications) to render the HTML, but neither pre-installed on Kubuntu nor listed as a dependency in the eclipse packages.




回答2:


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)




回答3:


For the question of background color, the problem certainly comes from the GTK settings.

You should get a solution here https://askubuntu.com/questions/70599/how-to-change-tooltip-background-color-in-unity




回答4:


For Eclipse Mars methods with GTK2 don't work anymore. You should only edit usr/share/themes/Ambiance/gtk-3.0/gtk-main.css section with name /*default color scheme */. Change @define-color tooltip_bg_color and @define-color tooltip_fg_color for your favorite color.



来源:https://stackoverflow.com/questions/12926774/eclipse-is-formatting-javadoc-tooltips-very-poorly-on-ubuntu

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!