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 12:59 Go to next message
Gaspar Din
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 15:27 Go to previous messageGo to next message
Christian Dietrich is currently online Christian Dietrich
Messages: 6210
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());
		.....
	}

Re: Extended highlighting breaks embedded editor highlighting [message #989997 is a reply to message #989795] Mon, 10 December 2012 06:46 Go to previous message
Gaspar Din
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: Fri Aug 22 08:05:53 EDT 2014

Powered by FUDForum. Page generated in 0.01586 seconds