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
Hello,

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?

Regards,
Gaspar
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: 14661
Registered: July 2009
Senior Member
Hi,

did you do something like

@Inject
	ViewerConfiguration configuration;


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



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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);
    }

    @Inject
    private IDialogSettings dialogSettings;

    @Inject
    private EmbeddedEditorFactory editorFactory;

    @Inject
    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?

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


Current Time: Tue Mar 19 02:11:40 GMT 2024

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

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

Back to the top