重新启动自己的eclipse编辑器插件的文本颜色配置

时间:2014-06-11 18:41:38

标签: java eclipse plugins eclipse-plugin editor

我创建了一个新的eclipse编辑器插件并设置了这个页面和代码的颜色: http://www.realsolve.co.uk/site/tech/jface-text.php

public XMLEditor()
{
    super();
    colorManager = new ColorManager();
    setSourceViewerConfiguration(new XMLConfiguration(colorManager));
    setDocumentProvider(new XMLDocumentProvider());
}

现在,我创建了一个新的首选项页面来更改颜色。更改此页面中的颜色后,我为编辑器设置了一个新的SourceViewerConfiguration,但颜色没有变化。

如果我关闭并重新打开编辑器,颜色会发生变化。 有人知道重置或重启编辑器的方法。或者更新SourceViewerConfiguration和颜色的一些方法?

1 个答案:

答案 0 :(得分:0)

我使用此代码管理,但它停止工作一些别名,如“CTRL + Z”:

    configuration = new XMLConfiguration(colorManager);
    setSourceViewerConfiguration(configuration);

    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    try {
        viewer.configure(configuration);
    } catch (java.lang.IllegalStateException e) {
        // Empty
    }