Formatting in EmbeddedEditor [message #905025] |
Wed, 29 August 2012 15:09 |
Martin Buchheim Messages: 3 Registered: July 2012 |
Junior Member |
|
|
Hello,
we're currently developing on a new project that uses Xtext, and the new EmbeddedEditor API works pretty well for our purpose. That's why we decided to use it, even though it is new and "discouraged" yet.
So far, everything works pretty well, except the Formatting through the <MyDSL>Formatter extension of AbstractDeclarativeFormatter.
Basically, the way I trigger the formatting from a widget outside the embedded editor is as follows:
formatNowButton.addMouseListener(new org.eclipse.swt.events.MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
XtextSourceViewer viewer = embeddedEditor.getViewer();
if (viewer.canDoOperation(ISourceViewer.FORMAT)) {
viewer.doOperation(ISourceViewer.FORMAT);
}
}
});
The formatting is correctly triggered, but basically all it does is removing all formations that have been done by the user.
The result looks as if a regular WhiteSpaceFormatter has been active with the AutoLineWrap setting from the Formatter-class of my DSL. All other configuration settings(linewraps etc.) don't have any effect -- everything is put together in one huge single block with whitespaces between all elements, and linewraps after the length specified through FormattingConfig.setAutoLinewrap().
Any idea what could be the cause for this problem?
Thank you for your input,
Martin
|
|
|
|
Powered by
FUDForum. Page generated in 0.02362 seconds