Java FX HTML Editor in Eclipse!
I did not care about JavaFX, Because It did not support OSX, and there was no legal OSGi bundle for it.
Now, JDK7 shipped with JavaFX, So there is no bundle problem anymore. JDK7 for OSX is also available now. And I heard that Oracle provides Embedding API for SWT.
So I’v tried to make a HTML Editor for Eclipse using JavaFX.
I could make a HTML WYSIWYG Edtior which supports HTML5/CSS3. Codes were unbelievably easy and short.
See in HD to improve readability.
Source codes(part):
</span>
<pre>public class HtmlEditor extends EditorPart {
...
@Override
public void createPartControl(Composite parent) {
canvas = new FXCanvas(parent, SWT.NONE);
editor = new HTMLEditor();
Scene scene = new Scene(editor);
canvas.setScene(scene);
IDocument doc = documentProvider.getDocument(getEditorInput());
editor.setHtmlText(doc.get());
editor.setOnKeyPressed(new EventHandler() {
@Override
public void handle(KeyEvent event) {
setDirty(true);
}
});
}
}
I think we can use JavaFX Scene graph as a view of GEF too. It must be cool! It provides very high quality rendering results with performance. I will challenge this later.
Comments (0)
Trackbacks (0)
Leave a comment
Trackback