129

How can I configure the font size for the tree item in the package explorer/outline in Eclipse?

Which item in Font under Preferences I should change?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
michael
  • 106,540
  • 116
  • 246
  • 346

24 Answers24

102

In 2010, there was no way in Eclipse to change the font used for Package Explorer and other such views. You can only change the font for editor views. This is a policy decision on the part of the Eclipse developers (see, e.g., bugs 49548, 202091). (Grumble.) The font used is the one set by the general look-and-feel for whatever desktop you are using.

On Linux it is possible to override the system font when you invoke Eclipse. An excellent writeup of various possibilities is here, to which I owe this answer. I'll repeat one suggestion from there for posterity. Create a file named, say, gtkrc-eclipse:

style "eclipse" {
  font_name = "Sans Condensed 8"
}
class "GtkWidget" style "eclipse"

Then set a certain environment variable when invoking eclipse:

$ GTK2_RC_FILES=gtkrc-eclipse eclipse
Marco
  • 8,958
  • 1
  • 36
  • 56
Dan Halbert
  • 2,761
  • 3
  • 25
  • 28
  • It did not work in Eclipse Luna; in Eclipse Juno and Aptana Studio 3 it works for me... – jsanmarb Oct 26 '14 at 02:02
  • Works in Luna SR1 for me. – dan carter Nov 30 '14 at 22:51
  • 2
    The "there is now way" clause is no longer applicable/correct for modern versions of eclipse. It must have been a great answer at some point in time, but this site is not a good fit for evolving Q&A for new versions of software. See other answers below, they vary a bit by OS flavor! – matanster Feb 03 '15 at 16:17
  • 1
    everyone reading this please vote up https://bugs.eclipse.org/bugs/show_bug.cgi?id=49548 – morgwai May 02 '18 at 17:46
60

Does your Eclipse .ini file contain a reference to 'smallFonts?' On Mac you might see something like...

-Dorg.eclipse.swt.internal.carbon.smallFonts

If you remove this line, you'll see the font size in various views fatten up.

Rick Winscot
  • 601
  • 5
  • 2
25

On Windows 7, you can affect many of the Eclipse GUI fonts, including the Project Explorer by going to:

Control Panel → PersonalizationWindow Color and AppearanceAdvanced Appearance Settings

Change the font size for "Message Box".

Of course this messes with the appearance of other stuff in your OS, but I've found that tolerable compared to squinting at the project explorer...

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nathan Monteleone
  • 5,430
  • 29
  • 43
  • Be warned that some plugins may override window's settings and have their own font system in Preferences > Colors and Fonts, like EGit. – rveach Feb 18 '16 at 16:22
  • To find these settings in the latest Windows 7: Control Panel -> search for "Window color", click "Change window colors and metrics". – Technophile Apr 20 '16 at 16:07
18

I just found all those answers for changing the tree view font size in Eclipse, tried several and finally got on the CSS class which reads quite more fashionable to me:

The theme I'm using includes the "e4_basestyle.css" in eclipse/opt/plugins/platform/css. There I added

.MPart Tree {
    font-size: 10;
}

which works very fine with me (Eclipse v4.3-SR2 (Kepler) on Ubuntu).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
wambach
  • 341
  • 3
  • 12
  • Worked for me with MARS on Linux Mint as well. **Attn:** the CSS files are now located in the theme-plugin's folder. – Thorsten Laux Feb 13 '16 at 20:03
  • worked fine here too. Mars 4.5.2 on windows 7. Exact location of file /plugins/org.eclipse.ui.themes_1.1.1.v20151026-1355/css/e4_basestyle.css – kr.pradeep Mar 04 '16 at 16:02
  • On my Ubuntu 14.04, when using the default classic theme, the file in eclipse/plugins/org.eclipse.ui.themes_x.x.x.vxxxxx/css to change was e4_classic_winxp.css for some reason. This was confusing, as it is far from obvious that I should use winxp version, and not the win7, or even the default. Finally it worked. – Andy Apr 26 '16 at 23:43
  • Where is this css file located on Mac? I can't find it in the plugins directory within the install location (/Applications/Eclipse\ Mars.app/...) – Andy Apr 21 '17 at 19:08
17

This answer applies to Mac OS X user. Tested with Mavericks (10.9.2) but should work in all versions.

As stated before in previous answers, to change the font size in package explorer you need to change system font size. The problem here is to do exactly this. My solution:

  1. Download the free Tinker Tool utility and adjust font sizes.
  2. Restart Eclipse

enter image description here

The results:

enter image description here

Happy coding!

Diego Freniche
  • 5,225
  • 3
  • 32
  • 45
16

Here is an option that works on my Windows7 machine suggested by Diego V: https://stackoverflow.com/a/15011440/1713920

On Juno you can adjust that font by CSS.

Lookup the files in eclipse\plugins\org.eclipse.platform_4.2.x.y\css for your current style sheet (probably e4_default_win7.css), and then just add the following rule:

#org-eclipse-jdt-ui-PackageExplorer Tree,
#org-eclipse-ui-navigator-ProjectExplorer Tree {
    font-size: 10px; /* <-- Desired font size */
}
Community
  • 1
  • 1
vir us
  • 9,920
  • 6
  • 57
  • 66
  • 2
    Unfortunately, this doesn't behave correctly when the project is added to a repo (which means the little icons of version control appears beside each file). I am saying behave, not working, because some of the files appears with correct font and some don't! and they keep on changing every a couple of seconds! Looks weird. – Abdalrahman Shatou Apr 08 '14 at 16:15
  • @AbdalrahmanShatou: I have experienced this "flashing" also, font gets big, font gets small, and vice-versa all the time, when clicking on the elements. I am using Eclipse Mars 4.5.1. and - like You I am also using a (.git) repository. I guess this is the trigger. – Hartmut Pfarr Dec 08 '15 at 18:42
  • 2
    You need to also change the font for the git plugin to match this setting. Windows-> preferences->General->Appearance->Colors and Fonts Change the font in 2 git entries to 12 also • Ignored Resource (Font) • Uncommitted Change Font Then restart eclipse – Steve Adams Nov 29 '18 at 11:04
9

Go into eclipse/plugins/org.eclipse.ui.themes_1.1.0.v{HERE_SOME_DIGITS}\css.

Here you see your installed theme CSS files. Choose you theme, and add at the end of file (for example, e4_default_win7.css):

#org-eclipse-jdt-ui-PackageExplorer Tree,
#org-eclipse-ui-navigator-ProjectExplorer Tree {
    font-size: 10px; /* <-- Desired font size */
    font: Consolas;  /* <-- Font you want to have */
}

It was tested with Eclipse v4.4 (Luna) and Eclipse v4.5 (Mars) on Windows 7.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vitalij
  • 91
  • 1
  • 3
  • 1
    Thanks! Works great on Mars 4.5.1 on Windows 8.1 - I have a Lenovo X1 Carbon with a WQHD+ (2560 x 1440) screen and the default font size was impossible. This fixed it nicely. Someone needs to nudge the core Eclipse team and make them aware that these sorts of very high-res screens are becoming more common and some simple user control is needed...Thanks! – Dave in Austin Oct 29 '15 at 01:35
  • 1
    works in Eclipse kepler linux with the file e4_default_gtk.css – cdarwin Jul 27 '17 at 18:05
7

FYI:

From Eclipse v4.4 (Luna):

It looks like the CSS files are no longer in the old folder:

eclipse/plugins/org.eclipse.platform_4.x.x.vy/css

They are moved to the new folder:

 eclipse/plugins/org.eclipse.ui.themes_x.x.x.vxxxxx/css

And you must select a theme to apply it, in the menu

WindowsPreferencesGeneralAppearance

Sean Mickey
  • 7,618
  • 2
  • 32
  • 58
Li Ying
  • 2,261
  • 27
  • 17
7

Eclipse v4.5 (Mars) using the built-in dark theme on Linux.

eclipse/plugins/org.eclipse.ui.themes_1.1.0.v20150511-0913/css/dark/e4-dark_globalstyle.css

Around line 204, you can add your chosen font size:

background-color: #2F2F2F;
color: #CCC;
font-size: 8;
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Dylan
  • 868
  • 12
  • 21
  • 1
    Works great with Mars on OS/X. If you wonder, the CSS path where these values are is `Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > * > Tree` – David Dossot Sep 17 '15 at 21:21
  • Confirmed. quick tip, search for "tree" as of today, its the only grouping with text = "tree". DONT search for font-size, this is what you have to add. Recommending 14 pt for 1080p – Nick Mar 29 '16 at 18:27
  • Worked fine for Eclipse Oxygen Release (4.7.0), under Cent-OS with Gnome 3.14.2. Thanks! – Volodymyr Krupach Sep 04 '17 at 15:36
6

As someone has already mentioned previously, modifying the "e4_basestyle.css" file worked for me on Eclipse v4.3 (Kepler) and Windows 8.

Also, I find that you must also change the text size/style under

PreferencesTeamGitLabelDecorations

or

PreferencesAppearanceColorsAndFonts, under the Git section.

to make sure that text size/colors for uncommitted files are in sync with your changes. This is of course if you initialise your project as a repository.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
indoballer
  • 61
  • 1
  • 1
4

Eclipse uses a system user interface font for Project Explorer, so you can change it with an OS-specific method. Note: Eclipse will have to be restarted even if other apps respond immediately to the font change.

  • On Linux (Gnome), I was able to alter Eclipse's font with Gnome Tweak Tool (Applications → Utilities → Tweak Tool). If it's not already installed, try sudo yum install gnome-tweak-tool or sudo apt-get install gnome-tweak-tool. In the Fonts page, change the Interface font.
  • On Windows 7, go to Control Panel → Personalization → Window Color and Appearance → Advanced Appearance Settings → Change the font size for "Message Box". (credit: Nathan Monteleone)
  • On Mac, unpack the Tinker Tool, run it, go to the Fonts tab and adjust the size of Help tags (tested with Eclipse 2018-12).

Some other parts of Eclipse will also be affected, such as the startup dialog.

Qwertie
  • 16,354
  • 20
  • 105
  • 148
3

Eclipse inherits the font size of the GUI items, from the operating system. For a demo for example you might want to increase the font size of your OS.

Tobias
  • 4,999
  • 7
  • 34
  • 40
2

The following solution works on Mac OS with Eclipse v4.4 (Luna).

Choose Mac appearance: menu WindowPreferencesGeneralAppearancesTheme: Mac.

Add a copy of the following code snippet contained in

plugins/org.eclipse.ui.themes_1.0.1.v20140819-1717/css/dark/e4-dark_globalstyle.css

to the end of the file

plugins/org.eclipse.ui.themes_1.0.1.v20140819-1717/css/e4_default_mac.css.


Tree,
RegistryFilteredTree,
/* The following are required due to Bug 419482 (see <1>): */
Composite > Tree,
TabFolder > Composite > Tree,
TabFolder > Composite > * > Tree,
DocCommentOwnerComposite > Group > Tree,
TabFolder > Composite > ScrolledComposite > Tree,
Shell > Composite > Composite > Tree,
Composite > Composite > Composite > Group > Tree,
Shell > Composite > Composite > Composite > Tree,
ScrolledComposite > Composite > Composite > Composite > Tree,
Shell > Composite > Composite > Composite > Composite > Composite > Tree,
Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN']
[style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU']
[style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > Tree, Shell[style~='SWT.RADIO']
[style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][style~='SWT.SHADOW_ETCHED_OUT']
[style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > * > Tree {
    font-size: 13;
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
xndlnk
  • 21
  • 4
2

In Windows 10,

at the left bottom corner click on the Windows symbol, enter "Display settings", then go to "Advanced display settings", then go to "Advanced sizing of text and other items", there You'll find "Change only the text size":

You'll see a list of

  • Title Bars
  • Menus
  • Message Boxes
  • Palette titles
  • Icons
  • Tooltips

Switch at least "Message Boxes" to font size e.g. 13 instead of 9 (for Eclipse Package Explorer Tree).

I would switch "Menus" also to font size 13 (for Eclipse main menu).

Or all of them :-)

Hartmut Pfarr
  • 5,534
  • 5
  • 36
  • 42
1

For Mac users:

In file:

plugins/org.eclipse.ui.themes_1.0.1.v20140819-1717/css/dark/e4-dark_globalstyle.css

Find this code snippet:

Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN']
[style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION']
[style~='SWT.DATE'] > Composite > * > Tree {

    background-color: #2F2F2F;
    color: #CCC;
}

Modify it adding information about the font size:

Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN']
[style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION']
[style~='SWT.DATE'] > Composite > * > Tree {

    background-color: #2F2F2F;
    color: #CCC;
    font-size: 13;
}

This example is for the Dark theme in Eclipse v4.4 (Luna).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

Ubuntu, Eclipse v4.4 (Luna)*

  1. Locate your: eclipse/plugins/org.eclipse.ui.themes_1.0.1.v20140819-1717/css
  2. Pick the CSS file that you are using per PreferencesGeneralAppearance inside the Eclipse UI.
  3. Backup the original and add something like the following, after first closing Eclipse just for safety:

    .MPart Tree { font-size: 14; }

*It was performed on ScalaIDE version of Eclipse v4.4 (Luna) and should be the same for regular Eclipse v4.4 (Luna), I think.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
matanster
  • 15,072
  • 19
  • 88
  • 167
1

On Windows 10, if you got hit by the Creators Update:

The Windows 10 Creators Update apparently removed the ability to "Change only the text size" in "Display settings". In addition the update reset my previous text size setting so that I ended up with small font size in the tree items of the package explorer.

A solution that worked for me is to use a small tool 'A+ System Font Size Changer'. There, increasing the "Message box" setting to 4 (a custom unit defined by the tool) and applying the setting changed the font size in the items of the package explorer.

The tool also allows you to increase the size of "Menu", "Title bar", "Palette title", "Icon" (which worked wonders on the display of folders in windows explorer), and "Tooltip".

P.S.: I would have preferred to comment on the answer from Hartmut, but my reputation score is too low.

Update 2022-06-10: The tool also works with Windows 11. The UI changed a bit (e.g. the size setting unit of measure is different now, a value of 12 on all settings worked for me).

jechterhoff
  • 175
  • 2
  • 9
1

In windows server,

go to control panel-->Display section. Display section If default setting is Smaller like picture,you can change the size for your demand,also you can change only the specific text size by option

Note: It is applied based on system setting ,not only for Eclipse based platform.

K.Andy Wang
  • 401
  • 1
  • 3
  • 14
0

To change fonts in eclipse workspace with ubuntu, I modified system fonts desktop > system > preferences > appearance > fonts also modified eclipse indigo -> windows > preferences > General > Appearances > Colors and fonts. It reflected in eclipse.

Mallik
  • 19
  • 1
0

In Eclipse v4.2 (Juno) you can modify the CSS by going to menu WindowPreferencesGeneralAppearances.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sharif
  • 1,488
  • 17
  • 21
  • I don't see this CSS editor on this page on MacOS: Version: Juno Service Release 2, Build id: 20130225-0426.. Is it anywhere else? – Pavel Dec 13 '13 at 12:50
0

In Windows 8,

  1. go to Control Panel -> Appearance and Personalization -> Display
  2. In the middle of the screen there is a drop down under the heading Change Only the Text Size, select Message bokes.
  3. Change the font size in the adjacent drop down.
SGT Grumpy Pants
  • 4,118
  • 4
  • 42
  • 64
0

In Eclipse v4.4 (Luna) Service Release 2 (4.4.2) under Windows 7:

If you select the "Windows" theme (Eclipse default configuration)

[Window => Preferences => General->Appearance -> Theme: Windows]

You could add the following code snippet into below css file.
[Eclipse root folder]\plugins\org.eclipse.ui.themes_x.x.x.vxxxxxxxx-xxxx\css\e4_default_win7.css

Tree,
RegistryFilteredTree,
/* the following are required due to Bug 419482 (see <1>): */
Composite > Tree,
TabFolder > Composite > Tree,
TabFolder > Composite > * > Tree,
DocCommentOwnerComposite > Group > Tree,
TabFolder > Composite > ScrolledComposite > Tree,
Shell > Composite > Composite > Tree,
Composite > Composite > Composite > Group > Tree,
Shell > Composite > Composite > Composite > Tree,
ScrolledComposite > Composite > Composite > Composite > Tree,
Shell > Composite > Composite > Composite > Composite > Composite > Tree,
Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > Tree,
Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > * > Tree {
    font-size: 13;
}

The value of font-size could be set as wish.

If you install other customized theme packages such as the Eclipse Moonrise UI Theme from Eclipse Marketplace, there will be the JAR file under [Eclipse root folder]\plugins
(Example: com.github.eclipseuitheme.themes.moonrise-ui_0.8.9.201404052318.jar)

Modify below the CSS files in this JAR file
\themes\css\moonrise-ui-standalone.css and moonrise-ui-standalone_WIN.css
There is similar code section in these CSS files starting with:

Tree,
RegistryFilteredTree,

Add the "font-size:13;" like the above code snippet and apply via the below steps.

Menu WindowPreferencesGeneralAppearanceTheme: MoonRise (standalone)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ginuinbu
  • 21
  • 2
0

I have two screens, a small and a large one. Eclipse is using the size settings from the "main screen". In my case that was a small screen with a scaling of 150%.

Switching the main screen to the large screen resolved the size issues for me.

Stefan
  • 10,010
  • 7
  • 61
  • 117
0

In Windows 10 Environements it is not possible to change the text size of the package explorer within Eclipse. he only thing you can do is to change the text size in the OS settings.

Go to Settings (Windows + I) then Ease of Access then Display.

There you can change the text size in the "Make text bigger" section. This applies directly to the package explorer in Eclipse.

M46
  • 923
  • 9
  • 20