gpt4 book ai didi

css - Eclipse 4.2 朱诺 CSS

转载 作者:技术小花猫 更新时间:2023-10-29 10:55:04 25 4
gpt4 key购买 nike

我正在尝试通过 CSS 样式表简单地更新 Eclipse Juno 4.2 的外观。我看过几个教程,还有一个 stackoverflow 问题:

我已经安装了 CSS spy tool ,但这只能让我进行临时更改。叹。我进入了 org.eclipse.platform_4.2.0.v201206081400 插件文件夹,并使用了 plugin.xml,但我在那里所做的任何更改都没有任何影响(即使重启后)。

如何在不创建、编译和安装整个 eclipse 插件元素到本地环境的情况下创建新主题并应用它?或者,更好的是,我可以只修改现有主题吗?

最佳答案

这是我如何让它工作的。

使用插件

我已经按照描述下载了 Eclipse UI Themes 插件 here (direct link 到存档)。但是我没有将它解压缩到 dropins 目录中,而是将它解压缩到 plugins 中。我还更改了它的权限,允许每个人修改它的文件。

此时你有:

plugins/com.github.eclipsecolortheme.themes_1.0.0.201207121019/├── com│   └── github│       └── eclipsecolortheme│           └── themes│               └── Activator.class├── META-INF│   └── MANIFEST.MF├── plugin.xml└── themes    └── css        └── juno.css

juno.css file is what you want. After launching Eclipse, this theme will be available under Appearance -> Dark Juno.

Without a plugin

After looking into plugin.xml, I had an idea how to create a new theme without using any plugin.

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<theme
basestylesheeturi="themes/css/juno.css"
id="com.github.eclipsecolortheme.themes.darkjuno"
label="Dark Juno">
</theme>
</extension>
</plugin>

可以向现有插件添加 org.eclipse.e4.ui.css.swt.theme 扩展点,比如 org.eclipse.platform_4.2.0.v201206081400 .而且,它的plugin.xml已经有了这个扩展点,你唯一需要做的就是添加一个合适的theme。请注意,它必须具有唯一的 id

      <theme
basestylesheeturi="css/my_theme.css"
id="org.eclipse.e4.ui.css.theme.my_theme"
label="My Theme Name">
</theme>

可以将新的 CSS 文件放入 css 目录,该目录已经包含了默认的主题集。

org.eclipse.platform_4.2.0.v201206081400/├── ...├── css│   ├── e4_basestyle.css│   ├── e4_classic_win7.css│   ├── e4_classic_winxp.css│   ├── e4_default.css│   ├── e4_default_gtk.css│   └── ...├── images│   ├── gtkGrey.png│   ├── gtkHandleDark.png│   ├── gtkHandle.png│   ├── gtkTSFrameDark.png│   ├── gtkTSFrame.png│   └── ...├── META-INF│   ├── eclipse.inf│   ├── ECLIPSE_.RSA│   ├── ECLIPSE_.SF│   └── MANIFEST.MF├── platform.jar├── plugin.properties├── plugin.xml└── ...

After restarting Eclipse with -clean option you will see a newly created item in the list of all themes:The newly registered theme

UPD. 1

For my installation it seems that changes to CSS apply on Eclipse restarting (File -> Restart, or just quitting and starting it manually).

The only weird behavior I have noticed is that CSS files from ~/.e4css directory (if any exists) override thus ones from the plugin directory. I'm not sure where it comes from, but I can safely remove any files from it. I also don't know this directory even exists on non-Linux systems, but if it does, I guess it should be located somewhere in a home directory of the user, or maybe in Documents.

UPD. 2

I just tried to add a new theme from scratch and noticed that there was a small mistake in the XML above. In order to get a new theme properly registered it must have a unique id attribute. Otherwise you will get an error:

java.lang.IllegalArgumentException: A theme with the id 'org.eclipse.e4.ui.css.theme.e4_default' is already registered
at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.registerTheme(ThemeEngine.java:186)
...

而且我说只要重新启动 Eclipse 来注册一个新主题就足够了,这似乎是不对的。但是,eclipse -clean 可以解决问题。

关于css - Eclipse 4.2 朱诺 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11833045/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com