CSS 我无法在 Eclipse 中更改包资源管理器的字体大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14529727/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I cannot change the font size of package explorer in Eclipse
提问by Mohammed Subhi Sheikh Quroush
I try to change the font size of package explorer in Eclipse from menu Window→ Preferences→ General→ Appearance, and I fail to change the font size. How can I do that? I use Eclipse v4.2 (Juno) on Windows 7.
我尝试从菜单Window→ Preferences→ General→ Appearance更改Eclipse 中包资源管理器的字体大小,但无法更改字体大小。我怎样才能做到这一点?我在 Windows 7 上使用 Eclipse v4.2 (Juno)。
采纳答案by Eugene Kuleshov
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.
Eclipse 使用本机 Windows 小部件,它们的设置只能从显示属性/设置/高级/常规属性选项卡中更改。在那里您可以更改屏幕 DPI 以更改字体大小。
回答by Diego V
On Juno and up you can adjust that font by CSS.
在 Juno 及更高版本上,您可以通过 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:
查找eclipse\plugins\org.eclipse.platform_4.2.x.y\css
当前样式表(可能e4_default_win7.css
)的文件,然后添加以下规则:
#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).
更新:eclipse/plugins/org.eclipse.ui.themes_x.x.x.vxxxxx/css
从 Eclipse 4.4 (Luna) 开始,样式表就在文件夹中。
回答by Li Ying
FYI:
供参考:
From Eclipse v4.4 (Luna):
从 Eclipse v4.4 (Luna):
It looks like the CSS files are no longer in the old folder:
看起来 CSS 文件不再在旧文件夹中:
`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
eclipse/plugins/org.eclipse.ui.themes_x.x.x.vxxxxx/css
And you must select a theme to apply it, in the menu Windows→ Preference→ General→ Appearance.
并且您必须选择一个主题来应用它,在菜单Windows→ Preference→ General→ Appearance。
回答by Paul Bormans
This worked for me:
这对我有用:
.MPart Tree{
font-size: 8;
}
回答by FuePi
These are my settings and a screenshot of the IDE.
这些是我的设置和 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;
}
回答by 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
).
您可以在eclipse/plugins/org.eclipse.platform_4.2.X.vY/css
编辑当前样式(可能e4_default_win7.css
)中查找 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 Spywhich you can open with SHIFT-ALT-F5(after you have installed it).
专业提示:下次您需要为 UI 的一部分查找 CSS Id 时,请使用CSS Spy,您可以使用SHIFT- ALT- F5(安装后)打开它。
回答by harryssuperman
On Ubuntu 14.04(Trusty Tahr) this was the best choice for me:
在Ubuntu 14.04(Trusty Tahr) 上,这对我来说是最好的选择:
.MPart Tree{
font-size: 10;
}
回答by skomisa
This worked for me using version 2019-09 on Windows 10:
在 Windows 10 上使用 2019-09 版对我有用:
- Locate the directory
C:\Users\johndoe\.p2\pool\plugins
in File Explorer, replacing "johndoe"with your own Windows user ID. - Depending on what you have done in the past with Eclipse, you should see one or more directories with names that start with
org.eclipse.ui.themes
. - Select the one with the most recent date modified. In my case its name was
org.eclipse.ui.themes_1.2.700.v20190826-0816
. - Within that directory open the directory named
css
. - Open the file named e4_default_win.cssin a text editor, and append something similar to the following at the end of the file:
C:\Users\johndoe\.p2\pool\plugins
在文件资源管理器中找到该目录,将“johndoe”替换 为您自己的 Windows 用户 ID。- 根据您过去使用 Eclipse 所做的工作,您应该会看到一个或多个名称以
org.eclipse.ui.themes
. - 选择最近修改的日期。就我而言,它的名字是
org.eclipse.ui.themes_1.2.700.v20190826-0816
. - 在该目录中打开名为
css
. - 在文本编辑器中打开名为e4_default_win.css的文件,并在文件末尾附加类似于以下内容的内容:
Tree { font-size: 24px; font: Mistral; }
树 { 字体大小:24px; 字体:Mistral;}
- Don't pick those specific values! You should pick the font and font size you want. I deliberately made poor choices only to make the effect of those settings obvious in the screen shot below.
Save the file and restart Eclipse. You should see that the font has been changed in the Project Explorer and Package Explorer views, and a lot of other places as well:
Just be clear, the name of the file I edited was
C:\Users\johndoe\.p2\pool\plugins\org.eclipse.ui.themes_1.2.700.v20190826-0816\css\e4_default_win.css
. The name of the file you edit won't be exactly that, but it should be similar.
回答by DevCat
In Eclipse 4.7.x the CSS files are under eclipse?/?plugins?/?org.eclipse.ui.themes_1.2.1.v20170809-1435?/?css?/
在 Eclipse 4.7.x 中,CSS 文件位于 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:
就我而言,我为 OSX 使用了深色主题,所以我打开了文件 e4-dark_mac.css 并添加了 font-size 行:
CTabFolder Tree, CTabFolder Canvas {
background-color: #2F2F2F;
color: #CCC;
font-size: 13pt; // new
}
回答by 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,
感谢Veger的回复,我在PHP Perspective(安装了PDT)中成功更改了我的PHP Explorer的字体。下面的CSS代码,
#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.
添加到我的“eclipse-4.3\plugins\org.eclipse.platform_4.3.1.v20130911-1000\css\e4_default_win7.css”文件中。
You may choose a different CSS file, depending on the theme you choose through Preferences→ General→ Appearance: "Theme" drop-down list).
您可以选择不同的 CSS 文件,具体取决于您通过首选项→常规→外观:“主题”下拉列表选择的主题)。