简体   繁体   English

Eclipse插件开发编辑器字体

[英]Eclipse plugin development editor font

I am using Eclipse 3.7.0 for plugin development and I am using Xtext 2.9.2. 我正在使用Eclipse 3.7.0进行插件开发,并且正在使用Xtext 2.9.2。 My editor preferences isn't working correctly. 我的编辑器首选项无法正常工作。

On windows 7, 8, 10 this happens: 在Windows 7,8,10出现这种情况:

在此处输入图片说明 .

  • On 64 bit builds, I am not able to change editor font. 在64位版本上,我无法更改编辑器字体。 Hitting the change button does nothing but change the mouse to the busy/sandclock for a second and then back again to normal. 按下更改按钮没有任何作用,只是将鼠标更改为忙/沙钟一秒钟,然后再次恢复为正常。

    • The same 64 bit builds were tested on windows XP and everything works as it should. 在Windows XP上测试了相同的64位版本,并且一切正常。
  • On 32 bit builds, everything works as expected and the windows font picker dialog appears. 在32位版本上,一切都按预期工作,并且出现Windows字体选择器对话框。

在此处输入图片说明

This is how I create the preference page: 这是我创建首选项页面的方式:

@Override
protected void createFieldEditors() {
  // Add show font preference
  fontField = new FontFieldEditor(JFaceResources.TEXT_FONT, EDIT_EDITOR_FONT_LABEL, getFieldEditorParent());
  addField(fontField);

  fontField.setPreferenceStore(getPreferenceStore());

  // initialize the font preference with the default resources font if not initialized
  String defaultFont = getPreferenceStore().getDefaultString(JFaceResources.TEXT_FONT);
  if(defaultFont.isEmpty()) {
     font= JFaceResources.getTextFont();
     if (font != null) {
        FontData[] data= font.getFontData();
        if (data != null && data.length > 0) {
           PreferenceConverter.setDefault(getPreferenceStore(), JFaceResources.TEXT_FONT, data[0]);
        }
     }
  }
}

The .log file is empty and has nothing that is beneficial. .log文件为空,没有任何好处。


While debugging, I went to org.eclipse.swt.widgets.FontDialog.java and found that this line always returns false without the dialog appearing. 调试时,我转到org.eclipse.swt.widgets.FontDialog.java ,发现此行始终返回false,而不会出现对话框。 From what I understand this call should be blocking and will only return when the dialog is closed either by X, OK or Cancel buttons but it returns immediately with false. 据我了解,此调用应该是阻塞的,并且仅在对话框被X,OK或Cancel按钮关闭时才会返回,但它立即返回false。

/* Open the dialog */
boolean success = OS.ChooseFont (lpcf)

I also tried something as minimal as this example and same thing happens. 我还尝试了与本示例一样小的操作,并且发生了相同的事情。

Months passed and I figured out what was causing the issue. 几个月过去了,我弄清楚了导致问题的原因。

Basically we have a JNI layer which loads some dll that requires MSVCR90.dll . 基本上,我们有一个JNI层,该层加载需要MSVCR90.dll某些dll This requires embedding MSVCR90.dll manifest into eclipse.exe used for our RCP , this is done using mt.exe provided by Microsoft Visual Studio . 这需要将MSVCR90.dll清单嵌入到用于RCP eclipse.exe ,这是使用Microsoft Visual Studio提供的mt.exe完成的。

While building I accidentally didn't embed the MSVCR90.dll manifest, this resulted into the error during loading the dll which says that MSVCR90.dll is missing. 在构建时,我不小心没有嵌入MSVCR90.dll清单,这导致在加载dll出错,该错误表明缺少MSVCR90.dll I however noticed that the treeview styling looked correct. 但是,我注意到树视图样式看起来正确。

This was also the answer to my other question Eclipse RCP Jface/SWT TreeViewer on Windows 10 . 这也是我在Windows 10上另一个问题Eclipse RCP Jface / SWT TreeViewer的答案。 The manifest also affected the UI look and feel treeviews and progressbars didn't look like the ones provided by the OS . 清单还影响了UI外观和感觉treeviews外观和progressbars treeviews看起来不像OS提供的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM