Ubuntu 上 Eclipse 窗格中的非常大的选项卡

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11805784/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:13:59  来源:igfitidea点击:

Very large tabs in Eclipse panes on Ubuntu

eclipseubuntuuser-interfacegtk

提问by Andy

My question is very similar to Stack Overflow question Gigantic Tabs in Eclipse on Ubuntu.

我的问题与Ubuntu 上的 Eclipse 中的Stack Overflow 问题Gigantic Tabs非常相似。

I have tried the solutions presented, but they appear to be old. I have found a solutionthat nicely handles the toolbar and menus, but not a solution that reduces the size and padding of the disproportionately large tabs (and label) within the panes (see the tab "Package Explorer" in the screen below).

我已经尝试了提供的解决方案,但它们似乎很旧。我找到了一个可以很好地处理工具栏和菜单的解决方案,但没有一个解决方案可以减少窗格中不成比例的大选项卡(和标签)的大小和填充(请参阅下面屏幕中的选项卡“包资源管理器”)。

I am happy with the way my OS-wide GTK theme is customized and don't want to change that. Is there a quick fix to reduce the tab sizes of the panes in Eclipse?

我对我的操作系统范围 GTK 主题的自定义方式很满意,不想改变它。是否有快速解决方案来减少 Eclipse 中窗格的选项卡大小?

I'm using Eclipse for Mobile Developers (Juno) on Ubuntu 12.04. I'll also mention that I really like the way Eclipse appears out of the box in Windows 7, so something similar to that would be ideal.

我在 Ubuntu 12.04 上使用 Eclipse for Mobile Developers (Juno)。我还要提一下,我真的很喜欢 Eclipse 在 Windows 7 中开箱即用的方式,因此类似的东西将是理想的选择。

Here are the eclipse specific GTK styles I'm using:

以下是我正在使用的特定于 Eclipse 的 GTK 样式:

style "eclin" {
    GtkButton::default_border={1,1,1,1}
    GtkButton::default_outside_border={1,1,1,1}
    GtkButtonBox::child_min_width=0
    GtkButtonBox::child_min_heigth=0
    GtkButtonBox::child_internal_pad_x=0
    GtkButtonBox::child_internal_pad_y=0
    GtkMenu::vertical-padding=1
    GtkMenuBar::internal_padding=1
    GtkMenuItem::horizontal_padding=4
    GtkToolbar::internal-padding=1
    GtkToolbar::space-size=1
    GtkOptionMenu::indicator_size=0
    GtkOptionMenu::indicator_spacing=0
    GtkPaned::handle_size=4
    GtkRange::trough_border=0
    GtkRange::stepper_spacing=0
    GtkScale::value_spacing=0
    GtkScrolledWindow::scrollbar_spacing=0
    GtkExpander::expander_size=10
    GtkExpander::expander_spacing=0
    GtkTreeView::vertical-separator=0
    GtkTreeView::horizontal-separator=0
    GtkTreeView::expander-size=12
    GtkTreeView::fixed-height-mode=TRUE
    GtkWidget::focus_padding=0
    font_name="Liberation Sans,Sans Regular 8"
}

class "GtkWidget" style "eclin"
    style "eclin2" {
    xthickness=1
    ythickness=1
}

class "GtkButton" style "eclin2"
class "GtkToolbar" style "eclin2"
class "GtkPaned" style "eclin2"

Here is a screenshot of what my IDE looks like with the huge tabs:

这是我的 IDE 带有巨大选项卡的屏幕截图:

Eclipse Juno IDE with tabs too big

标签太大的 Eclipse Juno IDE

回答by konradstrack

You can edit Eclipse's CSS instead of messing with the GTK theme.

您可以编辑 Eclipse 的 CSS 而不是搞乱 GTK 主题。

In your Eclipse directory find the file plugins/org.eclipse.platform_4.2.*/css/e4_default_gtk.css(there's an *in there, because I guess that the version may change in the future or may be different already). In this file there's a CSS class:

在您的 Eclipse 目录中找到该文件plugins/org.eclipse.platform_4.2.*/css/e4_default_gtk.css(里面有一个*,因为我猜版本将来可能会更改或可能已经不同)。在这个文件中有一个 CSS 类:

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

And you have two possible solutions:

您有两种可能的解决方案:

  1. change font-sizeto something smaller
  2. just comment out or remove font-sizefrom this class (works well for me)
  1. 改成font-size更小的东西
  2. 只需注释掉或font-size从这个类中删除(对我来说效果很好)

And that should do the trick.

这应该可以解决问题。

回答by Stanislav Mamontov

Style of tabs can be changed in Eclipse 4.2 by editing CSS. You can change styles directly in Eclipse Preferences window after installing the E4 CSS editor plug-in.

可以通过编辑 CSS 在 Eclipse 4.2 中更改选项卡的样式。安装 E4 CSS 编辑器插件后,您可以直接在 Eclipse Preferences 窗口中更改样式。

Go to menu Help > Install new software, then install E4 CSS editor (Incubation)plug-in using Eclipse 4 update site (add this link: http://download.eclipse.org/e4/updates/0.12).

转到菜单 Help > Install new software,然后E4 CSS editor (Incubation)使用 Eclipse 4 更新站点安装插件(添加此链接:http: //download.eclipse.org/e4/updates/0.12)。

After restart, go to Window > Preferences, General > Appearance and now you can edit styles here for any selected theme.

重新启动后,转到“窗口”>“首选项”、“常规”>“外观”,现在您可以在此处编辑任何选定主题的样式。

I am using this style for tabs:

我在标签中使用这种样式:

.MPartStack {
  font-size: 9;
  font-family: Liberation Sans;
  swt-tab-renderer: null;
  swt-tab-height: 22px;
  swt-selected-tabs-background: #FFFFFF #ECE9D8 100%;
  swt-simple: false;
  swt-mru-visible: false;
}

You can specify tabs height using the swt-tab-heightoption. It's value sets tab height ignoring the font size.

您可以使用该swt-tab-height选项指定选项卡高度。它的值设置选项卡高度而忽略字体大小。

回答by Carl

I also wanted to reduce especially the horizontal space in order to fit more tabs, as Eclipse lacks multi-row tabs.

我还特别想减少水平空间以容纳更多选项卡,因为 Eclipse 缺少多行选项卡。

These instructions will go for any platform (not limited to e.g. Ubuntu/GTK).

这些说明适用于任何平台(不限于例如 Ubuntu/GTK)。

What I did was:

我所做的是:

  • Reduced the font size
  • Changed font to something horizontal-compact
  • Removed the X (close tab) button
  • 减小了字体大小
  • 将字体更改为水平紧凑
  • 删除了 X(关闭选项卡)按钮

...yielding the following result on my system (Win 7):

...在我的系统(Win 7)上产生以下结果:

Screenshot with modified tabs

带有修改选项卡的屏幕截图

...and this is how it's done:

...这是它的完成方式:

  1. Check what CSS layout you're using: Preferences->General->Appearance-> check value of 'Theme:' listbox

  2. Open the corresponding file in <eclipse folder>\plugins\org.eclipse.platform_<your version>\css, e.g. e4_default_win7.css

  3. Modify .MPartStackentries to set font size and font, e.g.:

    .MPartStack {
        font-size: 8;
        font-family: 'Arial Narrow';
        swt-simple: true;
        swt-mru-visible: false;
    }
    
  4. Add the following entry to remove the X (close icon):

    CTabItem {
        swt-show-close: false !important;   
    }
    
  1. 检查您使用的 CSS 布局:Preferences->General->Appearance-> check value of 'Theme:' 列表框

  2. 中打开相应的文件<eclipse folder>\plugins\org.eclipse.platform_<your version>\css,例如e4_default_win7.css

  3. 修改.MPartStack条目以设置字体大小和字体,例如:

    .MPartStack {
        font-size: 8;
        font-family: 'Arial Narrow';
        swt-simple: true;
        swt-mru-visible: false;
    }
    
  4. 添加以下条目以删除 X(关闭图标):

    CTabItem {
        swt-show-close: false !important;   
    }
    

That's it!

就是这样!

回答by marioosh

Eclipse is now (4.5 Mars) defaulting to GTK3 on Linux. For 4.6 a fix seems to be alredy merged.

Eclipse 现在 (4.5 Mars) 在 Linux 上默认为 GTK3。对于 4.6,似乎已经合并了一个修复程序。

Changing SWT_GTK3environment variable works for Eclipse Mars:

更改SWT_GTK3环境变量适用于 Eclipse Mars:

$ export SWT_GTK3=0

or set that variable inline with running eclipse

或在运行 eclipse 时内联设置该变量

$ SWT_GTK3=0 /path/to/eclipse/eclipse

To kill it dead just drop this in the root as eclipse.sh:

要杀死它,只需将其作为 eclipse.sh 放在根目录中:

#!/bin/bash
SWT_GTK3=0 exec env "${0%.sh}"

回答by phil

You may try the theme from https://github.com/jeeeyul/eclipse-themes.

您可以从https://github.com/jeeeyul/eclipse-themes尝试主题。

After install this theme, apply it by choosing the theme in Window > Preferences > General > Appearence > Jeeeyul's themes.

安装此主题后,通过在“窗口”>“首选项”>“常规”>“外观”>“Jeeeyul 的主题”中选择主题来应用它。

And to solve the large tab problem, please refer to https://github.com/jeeeyul/eclipse-themes/wiki/Linux-Huge-Toolbar-Problem.

并解决大标签问题,请参考https://github.com/jeeeyul/eclipse-themes/wiki/Linux-Huge-Toolbar-Problem

It's easy and beatiful. Enjoy it!

这很容易而且很漂亮。好好享受!

回答by ayhanakbulut

An alternative way is to select:

另一种方法是选择:

System settings > Universal access > Text size as small.

回答by ayhanakbulut

You can edit all small details about tab size here:

您可以在此处编辑有关标签大小的所有小细节:

image

图片