Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Changing OCLinEcore editor code formatting
Changing OCLinEcore editor code formatting [message #919159] Fri, 21 September 2012 18:42 Go to next message
David Rees is currently offline David ReesFriend
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 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
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
>
Re: Is it possible to change some of the OCLinEcore Editor formatting settings like you can for some [message #921938 is a reply to message #919618] Mon, 24 September 2012 15:15 Go to previous messageGo to next message
David Rees is currently offline David ReesFriend
Messages: 47
Registered: September 2012
Member
Ed Willink wrote on Sat, 22 September 2012 02:16

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


Thanks for the link, I will take a look.

Ed Willink wrote on Sat, 22 September 2012 02:16

Can you provide an example file so that I can see how horrible it looks?


I am using the XSD/Ecore mapper, so I have the annotations that it generates. They all look like the example in my first post. Its creating these for almost every class and attribute because of naming issues (dashes in names).

In terms of the best annotation namespaces to support, probably the ones that EMFatic supports are the best bet since I'm sure they adapted to what they were seeing. See 5.1 at http://www.eclipse.org/modeling/emft/emfatic/.

Thanks!
d
Re: Is it possible to change some of the OCLinEcore Editor formatting settings like you can for some [message #922006 is a reply to message #921938] Mon, 24 September 2012 16:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Seems its just http:///org/eclipse/emf/ecore/util/ExtendedMetaData
that's needed.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=390244 raised.

Regards

Ed Willink


On 24/09/2012 16:15, David Rees wrote:
> Ed Willink wrote on Sat, 22 September 2012 02:16
>> 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
>>
>
>
> Thanks for the link, I will take a look.
> Ed Willink wrote on Sat, 22 September 2012 02:16
>> Can you provide an example file so that I can see how horrible it looks?
>
>
> I am using the XSD/Ecore mapper, so I have the annotations that it
> generates. They all look like the example in my first post. Its
> creating these for almost every class and attribute because of naming
> issues (dashes in names).
>
> In terms of the best annotation namespaces to support, probably the
> ones that EMFatic supports are the best bet since I'm sure they
> adapted to what they were seeing. See 5.1 at
> http://www.eclipse.org/modeling/emft/emfatic/.
>
> Thanks!
> d
Re: Is it possible to change some of the OCLinEcore Editor formatting settings like you can for some [message #923058 is a reply to message #922006] Tue, 25 September 2012 15:12 Go to previous message
David Rees is currently offline David ReesFriend
Messages: 47
Registered: September 2012
Member
Thanks! I don't see a "vote", is not enabled for MDT.OCL somehow? I think I noticed the same thing for Xtext.
Previous Topic:Extend EcoreEnvironment locally
Next Topic:Simplify OCL query
Goto Forum:
  


Current Time: Thu Apr 25 23:33:55 GMT 2024

Powered by FUDForum. Page generated in 0.03050 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top