Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL in XText Editor
OCL in XText Editor [message #969881] Sat, 03 November 2012 16:53 Go to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

I admit I am new to the Complete OCL.
I'd like to use it as a validation means instead of the XText default validation as described in this very nice presentation http://www.slideshare.net/EdWillink/enrich-your-models-with-ocl.
In this way I could exploit the same OCL to perform validation before further QVT/MOFM2T(ACCELEO) transformations.
To this end I have started with an empty .ocl file and I am trying to define the first import.
The problem is that it depicts this error:

Unresolved import 'http:/...' : White spaces are required between publicId and systemId.

What am I doing wrong?

[Updated on: Sat, 03 November 2012 17:07]

Report message to a moderator

Re: Eclipse in XText Editor [message #969899 is a reply to message #969881] Sat, 03 November 2012 17:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4906
Registered: July 2009
Senior Member
Hi

You don;'t provide much to go on...

An import of http:/... is an import of a registered package using its
nsURI. It would appear that this p[ackage is not registered.

If instead you use a platform:/... import then you can reference your
*.ecore or *.uml file.

Have you tried following the Complete OCL tutorial or examining the
Royal and Loyal example?

Regards

Ed Willink


On 03/11/2012 16:53, Andrea Sindico wrote:
> I admit I am new to Complete OCL. I'd like to use it as a validation
> means instead of the XText default validation as described in this
> very nice presentation
> http://www.slideshare.net/EdWillink/enrich-your-models-with-ocl.
> In this way I could exploit the same OCL to perform validation before
> further QVT/MOFM2T(ACCELEO) transformations.
> To this end I have started with an empty .ocl file and I am trying to
> define the first import. The problem is that it depicts this error:
>
> Unresolved import 'http:/...' : White spaces are required between
> publicId and systemId.
>
> What am I doing wrong?
Re: Eclipse in XText Editor [message #969914 is a reply to message #969899] Sat, 03 November 2012 17:27 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

Hi Ed,
thank for your kind answer.
I have tried the platform:/resource/.. notation importing the Ecore as you suggested and it works.
However I guess I have to import the registered package in order to use it in a secondary Eclipse Application (which also executes the XText editor for the language to validate).
am I right?
Re: Eclipse in XText Editor [message #969974 is a reply to message #969914] Sat, 03 November 2012 18:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4906
Registered: July 2009
Senior Member
Hi

It is certainly important to use consistent references to ensure that
project/plugin usages are respected.

Unfortunately this is not easy in standalone applications, and a variety
of modeling applications have a variety of inconsistently helpful
workarounds.

You may find org.eclipse.ocl.examples.domain.utilities.ProjectMap helpful.

A couple of recent EMF changes suggest that these difficulties may be
much reduced in Kepler.

Regards

Ed Willink


On 03/11/2012 17:27, Andrea Sindico wrote:
> Hi Ed,
> thank for your kind answer. I have tried the platform:/resource/..
> notation importing the Ecore as you suggested and it works. However I
> guess I have to import the registered package in order to use it in a
> secondary Eclipse Application (which also executes the XText editor
> for the language to validate).
> am I right?
Re: Eclipse in XText Editor [message #970195 is a reply to message #969974] Sat, 03 November 2012 22:51 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

Ed, the last line of slide 66 is hidden by a red box.

http://www.slideshare.net/EdWillink/enrich-your-models-with-ocl

what is the code to pass the EValidator to the registar?

Thank you

Regards
Re: Eclipse in XText Editor [message #970200 is a reply to message #970195] Sat, 03 November 2012 22:58 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

OK I guess it was

registrar.register(ePackage, new CompleteOCLEObjectValidator(ePackage,oclUri));

but it says it is deprecated Sad
Re: Eclipse in XText Editor [message #970250 is a reply to message #970200] Sat, 03 November 2012 23:55 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

Although deprecated it works fine. The only thing I don't like is that the whole context, in the wrong dsl, is highlighted as error, not just the wrong token. Is there any way to just highlight it?
Re: Eclipse in XText Editor [message #971024 is a reply to message #970200] Sun, 04 November 2012 14:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4906
Registered: July 2009
Senior Member
On 03/11/2012 22:58, Andrea Sindico wrote:
> OK I guess it was
>
> registrar.register(ePackage, new
> CompleteOCLEObjectValidator(ePackage,oclUri));
>
> but it says it is deprecated :(
If you look at the deprecated implementation, it is

@Deprecated
public CompleteOCLEObjectValidator(@NonNull EPackage ePackage,
@NonNull URI oclURI) {
this(ePackage, oclURI, null);
}

so just add a null to make the message go away. Ideally pass a
pre-existing metaModelManager to avoid loading all your meta-models
redundantly to create another metaModelManager.

Regards

Ed Willink
Re: Eclipse in XText Editor [message #971033 is a reply to message #970195] Sun, 04 November 2012 14:23 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4906
Registered: July 2009
Senior Member
Hi

Seems to be an ODP loading issue. The original is fine at
http://www.eclipse.org/modeling/mdt/ocl/docs/publications/EclipseCon2011Tutorial/EnrichingWithOCL.odp.

Regards

Ed Willink


On 03/11/2012 22:51, Andrea Sindico wrote:
> Ed, the last line of slide 66 is hidden by a red box.
>
> http://www.slideshare.net/EdWillink/enrich-your-models-with-ocl
>
> what is the code to pass the EValidator to the registar?
>
> Thank you
>
> Regards
Re: Eclipse in XText Editor [message #971038 is a reply to message #970250] Sun, 04 November 2012 14:30 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4906
Registered: July 2009
Senior Member
Hi

It's only software; I'm sure it's possible....

Realistically, the API for detecting an error needs to be better. It's
probably possible to get Xtext to show a narrower context. However this
won't happen until I have got all the UML and OCL OCL constraints code
generated and being used live.

I don't understand the "wrong dsl" comment. Perhaps you need to share
some screenshots.

Regards

Ed Willink


On 03/11/2012 23:55, Andrea Sindico wrote:
> Although deprecated it works fine. The only thing I don't like is that
> the whole context, in the wrong dsl, is highlighted as error, not just
> the wrong token. Is there any way to just highlight it?
Previous Topic:Ecore derived attribute's derivation specialization
Next Topic:OCL editor
Goto Forum:
  


Current Time: Wed Sep 28 19:03:52 GMT 2016

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

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