Changing OCLinEcore editor code formatting [message #919159] |
Fri, 21 September 2012 18:42 |
David Rees Messages: 47 Registered: September 2012 |
Member |
|
|
Is it possible to change some of the OCLinEcore Editor formatting settings like you can for some of the other editors? If not through the GUI then in properties?
In particular I am looking to do the following like you can for some of the other editors. Much of it you will notice has to do with making the code tighter (like EMFatic) so I can see more of it at once.
Opening brackets do NOT have a new line before them:
property dESC : DESCRIPTION { ordered composes !resolve } {
annotation _'http:///org/eclipse/emf/ecore/util/ExtendedMetaData' (
kind = 'element',
name = 'DESC',
namespace = '##targetNamespace'
);
}
Annotations are placed on a single line:
annotation 'http:///org/eclipse/emf/ecore/util/ExtendedMetaData' (kind = 'element', name = 'DESC', namespace = '##targetNamespace' );
Initially fold annotations
And while I am at it, it would be great to have EMFatic's Annotation Labels as well:
annotation @ExtendedMetaData (kind = 'element', name = 'DESC', namespace = '##targetNamespace' );
Thanks,
dave
[Updated on: Fri, 21 September 2012 21:55] Report message to a moderator
|
|
|
Re: Is it possible to change some of the OCLinEcore Editor formatting settings like you can for some [message #919618 is a reply to message #919159] |
Sat, 22 September 2012 06:16 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
The OCLinEcore editor is an Xtext editor and provides standard Xtext
facilities; when Xtext supports custom formatting, OCLinEcore can too.
Xtext Bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=390133 raised.
There are a few auto-text issues that I think I've fixed since Juno
(gratuitous blank lines when entering braces). These were earlier Xtext
bugs that my workarounds turned into different bugs when Xtext improved.
The basic formatting is hand customized by
GIT\org.eclipse.ocl\examples\org.eclipse.ocl.examples.xtext.oclinecore\src\org\eclipse\ocl\examples\xtext\oclinecore\formatting\OCLinEcoreFormatter.java
Xtext has done a great job by annotating EBNF to support the basic
grammar, but has not really tackled Outlines and Formatting. Each of
these would be much improved by custom (Xtext) editors to provide a
tight DSL to define them, and this would of course allow you to redefine
them. They might also be much faster since the custom DSL could provide
directly useable dispatch tables rather than declarative methods for
slow reflective dispatch.
The OCLinEcore editor intent is to support OCL in Ecore, with 100% Ecore
syntax coverage. The annotation syntax is just therefore to support
'irrelevant' facilities. GenModel comments are rescued by the
'documentation' syntax. Perhaps ExtendedMetaData should have a primary
syntax too. How many different annotations sources are you using? Can
you provide an example file so that I can see how horrible it looks?
Perhaps an alias syntax might allow "alias ExtendedMetaData =
'http:///org/eclipse/emf/ecore/util/ExtendedMetaData'" and then
"annotation ExtendedMetaData (...", with a standard aliases file that
can be included to define favourite annotation sources.
Regards
Ed Willink
On 21/09/2012 19:42, David Rees wrote:
> Is it possible to change some of the OCLinEcore Editor formatting
> settings like you can for some of the other editors? If not through
> the GUI then in properties?
>
> In particular I am looking to do the following like you can for some
> of the other editors. Much of it you will notice has to do with making
> the code tighter (like EMFatic) so I can see more of it at once.
>
> Opening brackets do NOT have a new line before them:
> property dESC : DESCRIPTION { ordered composes !resolve } {
> annotation _'http:///org/eclipse/emf/ecore/util/ExtendedMetaData' (
> kind = 'element',
> name = 'DESC',
> namespace = '##targetNamespace'
> );
> }
>
> Annotations are placed on a single line:
> annotation 'http:///org/eclipse/emf/ecore/util/ExtendedMetaData' (kind
> = 'element', name = 'DESC', namespace = '##targetNamespace' );
>
> Initially fold annotations
>
> And while I am at it, it would be great to have EMFatic's Annotation
> Labels as well:
> annotation @ExtendedMetaData (kind = 'element', name = 'DESC',
> namespace = '##targetNamespace' );
>
> Thanks,
> dave
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03929 seconds