Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Extended highlighting breaks embedded editor highlighting
Extended highlighting breaks embedded editor highlighting [message #989782] Fri, 07 December 2012 17:59 Go to next message
Gaspar DinFriend
Messages: 21
Registered: September 2012
Junior Member

I need some help with the embedded editor and syntax highlighting.
Extending the highlighting with this two implementations
public Class<? extends IHighlightingConfiguration> bindIHighlightingConfiguration() {
    return MyDslHighlightingConfiguration.class;

public Class<? extends ISemanticHighlightingCalculator> bindSemanticHighlightingCalculator() {
    return MyDslHighlightingCalculator.class;

ends in no syntax highlighting in the embedded editor (neither the base highlighting nor the extra highlighting) while the "regular" (file based) editor shows the highlighting (including the extra highlighting).

Has anybody some ideas to fix this?

Re: Extended highlighting breaks embedded editor highlighting [message #989795 is a reply to message #989782] Fri, 07 December 2012 20:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13591
Registered: July 2009
Senior Member

did you do something like

	ViewerConfiguration configuration;

	public void createPartControl(Composite parent) {
		embeddedEditor = embeddedEditorFactory.newEditor(editedResourceProvider).withParent(sashForm);
		configuration.getHighlightingHelper().install(getEmbeddedEditor().getConfiguration(), getEmbeddedEditor().getViewer());

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Re: Extended highlighting breaks embedded editor highlighting [message #989997 is a reply to message #989795] Mon, 10 December 2012 11:46 Go to previous message
Gaspar DinFriend
Messages: 21
Registered: September 2012
Junior Member
Hi Christian,

yes there is an own ViewerConfiguration

public class ViewerConfiguration {
    public ViewerConfiguration() {
        Injector injector = MyDslActivator.getInstance().getInjector(MyDslActivator.COM_MYDSL);
        editorFactory = injector.getInstance(EmbeddedEditorFactory.class);
        dialogSettings = injector.getInstance(IDialogSettings.class);
        highlightingHelper = injector.getInstance(HighlightingHelper.class);

    private IDialogSettings dialogSettings;

    private EmbeddedEditorFactory editorFactory;

    private HighlightingHelper highlightingHelper;

    public IDialogSettings getDialogSettings() {
        return dialogSettings;

    public void setDialogSettings(IDialogSettings dialogSettings) {
        this.dialogSettings = dialogSettings;

    public EmbeddedEditorFactory getEmbeddedEditorFactory() {
        return editorFactory;

    public void setEmbeddedEditorFactory(EmbeddedEditorFactory factory) {
        this.editorFactory = factory;

    public HighlightingHelper getHighlightingHelper() {
        return highlightingHelper;

    public void setHighlightingHelper(HighlightingHelper highlightingHelper) {
        this.highlightingHelper = highlightingHelper;

and it is called:

EmbeddedEditorFactory factory = injector.getInstance(EmbeddedEditorFactory.class);
IResourceValidator resourceValidator = injector.getInstance(IResourceValidator.class);
embeddedEditor = factory.newEditor(resourceProvider).showErrorAndWarningAnnotations().withResourceValidator(resourceValidator).withParent(parent);
configuration.getHighlightingHelper().install(embeddedEditor.getConfiguration(), embeddedEditor.getViewer());

One difference: the call is not performed in the method createPartControl(..) as my class does not implement IWorkbenchPart.
But I don't think this is causing the incorrect behaviour?

Previous Topic:Problem with unresolved proxy serialization
Next Topic:[Syntactic predicates] Choosing alternative path 2
Goto Forum:

Current Time: Sat Sep 19 13:23:41 GMT 2020

Powered by FUDForum. Page generated in 0.01617 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top