Guy
Guy

Reputation: 111

Eclipse Luna split editor only updates on save with custom editor implementation

Eclipse Luna finally has this great split editor and I am having trouble figuring out how to make our editor work as expected with the new feature. We have our own custom editor and it doesn't behave like the Java editor in Luna when it is split. When editing in half of the split editor in our custom editor, the other part of the split is only updated to match when the document is saved. Whereas with the Java editor the update happens in "real" time with every character. I would like our editor to update with each character without saving like the Java editor does.

I thought I could create a new Eclipse editor plugin to see if that behaved like the Java editor, but unfortunately it acts like our custom editor.

I have done some Google searching, but have not been able to find anything on this specific topic. In fact, I could not find anything that explains exactly how the split editor works. I was able to gather that it creates another instance of the editor, but that's about it.

Does anyone know how to replicate this "real" time document update in a custom editor when using the Eclipse Luna split editor feature?

Edit 6/7/14 : Our editor extends org.eclipse.ui.editors.text.TextEditor

Upvotes: 0

Views: 110

Answers (1)

billfen
billfen

Reputation: 36

The problem can occur when an explicit document provider is used.

For example, the XML editor example code uses this:

    setDocumentProvider(new XMLDocumentProvider());

but in order for the new split editor code to work, the exact same document provider must be returned when the second split editor viewer window is initialized. A work around is to make the document provider instance static. This seems to work:

    private static XMLDocumentProvider provider = new XMLDocumentProvider();
    ...
    setDocumentProvider(provider);

If you are using an explicit document provider and for some reason it can not be static (shared), another work around may be difficult to find.

I filed a bug on this issue, but so far there has been no response or comments.

Upvotes: 2

Related Questions