I cannot change the font size of package explorer in Eclipse

♀尐吖头ヾ 提交于 2019-11-27 11:41:40

Eclipse is using native Windows widgets and their settings can only be changed from Display Properties / Settings / Advanced / General properties tab. There you can change your screen DPI to alter font sizes.

On Juno and up 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 */
}

Update: stylesheets are in eclipse/plugins/org.eclipse.ui.themes_x.x.x.vxxxxx/css folder since Eclipse 4.4 (Luna).

Li Ying

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 WindowsPreferenceGeneralAppearance.

This worked for me:

.MPart Tree{
  font-size: 8;
}
FuePi

These are my settings and a screenshot of the IDE.

    #org-eclipse-jdt-ui-PackageExplorer Tree,
    #org-eclipse-ui-navigator-ProjectExplorer Tree,
    #org-eclipse-ui-views-ContentOutline Tree,
    #PerspectiveSwitcher ToolBar {
      font-size: 8px;
    }

    .MPartStack {
      font-size: 8;
      swt-simple: false;
      swt-mru-visible: false;
    }

Veger

You can lookup the CSS style files in eclipse/plugins/org.eclipse.platform_4.2.X.vY/css edit your current style (probably e4_default_win7.css).

Add something like this:

    #org-eclipse-ui-jdt-PackageExplorer {
       font-size: 20pt;
    }

and hope you have a nice and large font (I did not check it myself).

Pro tip: Next time you need to find the CSS Id for a part of the UI, use CSS Spy which you can open with SHIFT-ALT-F5 (after you have installed it).

harryssuperman

On Ubuntu 14.04 (Trusty Tahr) this was the best choice for me:

.MPart Tree{
  font-size: 10;
}

In Eclipse 4.7.x the CSS files are under eclipse⁩/⁨plugins⁩/⁨org.eclipse.ui.themes_1.2.1.v20170809-1435⁩/⁨css⁩/

In my case I use the dark theme for OSX, so I opened the file e4-dark_mac.css and added the font-size line:

CTabFolder Tree, CTabFolder Canvas {
    background-color: #2F2F2F;
    color: #CCC;
    font-size: 13pt; // new 
}
jinhr

Thanks to Veger's reply, I successfully changed the font of my PHP Explorer in PHP Perspective (with PDT installed). The following CSS code,

    #org-eclipse-php-ui-explorer Tree {
       font-family: Consolas;
       font-size: 21px;
    }

are added into my "eclipse-4.3\plugins\org.eclipse.platform_4.3.1.v20130911-1000\css\e4_default_win7.css" file.

You may choose a different CSS file, depending on the theme you choose through PreferencesGeneralAppearance: "Theme" drop-down list).

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