Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » RE: org.eclipse.emf.validation.examples.ocl example
RE: org.eclipse.emf.validation.examples.ocl example [message #64908] Wed, 03 December 2008 15:56 Go to next message
Mark Melia is currently offline Mark Melia
Messages: 142
Registered: July 2009
Senior Member
Hi Christian,

I have a quick question on your OCL example -
org.eclipse.emf.validation.examples.ocl. To get this working there is an
OCL file defined in the workspace - constraints/library.ocl.

How does the runtime OCL validation plugin find the OCL file, when it is
defined in the design time workspace?

Thanks,
Mark
Re: org.eclipse.emf.validation.examples.ocl example [message #64943 is a reply to message #64908] Wed, 03 December 2008 21:42 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Mark,

The OCLConstraintProvider has this method (exception handling and blade
guard removed for clarity):

private void parseConstraints(Category category,
Bundle bundle, String path) {

URL url = bundle.getEntry(path);

if (url != null) {
InputStream input = url.openStream();

parseConstraints(category, bundle.getSymbolicName(), input);

input.close();
}
}

So, we use here the OSGi bundle's facility for loading resources from
its JAR. Just be sure to list your OCL file(s) in the bin.includes in
your build.properties file.

HTH,

Christian

Mark Melia wrote:
> Hi Christian,
>
> I have a quick question on your OCL example -
> org.eclipse.emf.validation.examples.ocl. To get this working there is an
> OCL file defined in the workspace - constraints/library.ocl.
> How does the runtime OCL validation plugin find the OCL file, when it is
> defined in the design time workspace?
> Thanks,
> Mark
>
Re: org.eclipse.emf.validation.examples.ocl example [message #64972 is a reply to message #64943] Thu, 04 December 2008 10:54 Go to previous messageGo to next message
Mark Melia is currently offline Mark Melia
Messages: 142
Registered: July 2009
Senior Member
Hi Christian,

What I want to do is create a simple button so that the user can edit the
OCL in the runtime. To do this I need an IFile for the FileEditorInput. Do
you have any idea how to convert from the URL below to an IFile?

Tried this:
http://www.eclipsezone.com/eclipse/forums/m92221730.html
but because it doesnt work as the IFile is resolved to the runtime
workspace.

Thanks for your help,
Mark


Christian W. Damus wrote:

> Hi, Mark,

> The OCLConstraintProvider has this method (exception handling and blade
> guard removed for clarity):

> private void parseConstraints(Category category,
> Bundle bundle, String path) {

> URL url = bundle.getEntry(path);

> if (url != null) {
> InputStream input = url.openStream();

> parseConstraints(category, bundle.getSymbolicName(), input);

> input.close();
> }
> }

> So, we use here the OSGi bundle's facility for loading resources from
> its JAR. Just be sure to list your OCL file(s) in the bin.includes in
> your build.properties file.

> HTH,

> Christian

> Mark Melia wrote:
>> Hi Christian,
>>
>> I have a quick question on your OCL example -
>> org.eclipse.emf.validation.examples.ocl. To get this working there is an
>> OCL file defined in the workspace - constraints/library.ocl.
>> How does the runtime OCL validation plugin find the OCL file, when it is
>> defined in the design time workspace?
>> Thanks,
>> Mark
>>
Re: org.eclipse.emf.validation.examples.ocl example [message #64984 is a reply to message #64972] Thu, 04 December 2008 19:25 Go to previous messageGo to next message
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo Herrera
Messages: 253
Registered: July 2009
Senior Member
Hi Mark,

Have you tried to open the editor using IDE class?. It has a convenience
method to open a specific editor on file which is represented by its URI:

IDE.openEditor(IWorkbenchPage page, URI uri,String editorId, boolean
activate)

P.D: use url.getURI() to obtain the URI from the URL given by a bundle.

Cheers,
Adolfo.


Mark Melia escribió:
> Hi Christian,
>
> What I want to do is create a simple button so that the user can edit
> the OCL in the runtime. To do this I need an IFile for the
> FileEditorInput. Do you have any idea how to convert from the URL below
> to an IFile?
> Tried this:
> http://www.eclipsezone.com/eclipse/forums/m92221730.html
> but because it doesnt work as the IFile is resolved to the runtime
> workspace.
>
> Thanks for your help,
> Mark
>
>
> Christian W. Damus wrote:
>
>> Hi, Mark,
>
>> The OCLConstraintProvider has this method (exception handling and
>> blade guard removed for clarity):
>
>> private void parseConstraints(Category category,
>> Bundle bundle, String path) {
>
>> URL url = bundle.getEntry(path);
>
>> if (url != null) {
>> InputStream input = url.openStream();
>
>> parseConstraints(category, bundle.getSymbolicName(), input);
>
>> input.close();
>> }
>> }
>
>> So, we use here the OSGi bundle's facility for loading resources from
>> its JAR. Just be sure to list your OCL file(s) in the bin.includes in
>> your build.properties file.
>
>> HTH,
>
>> Christian
>
>> Mark Melia wrote:
>>> Hi Christian,
>>>
>>> I have a quick question on your OCL example -
>>> org.eclipse.emf.validation.examples.ocl. To get this working there is
>>> an OCL file defined in the workspace - constraints/library.ocl.
>>> How does the runtime OCL validation plugin find the OCL file, when it
>>> is defined in the design time workspace?
>>> Thanks,
>>> Mark
>>>
>
>
Re: org.eclipse.emf.validation.examples.ocl example [message #64994 is a reply to message #64972] Thu, 04 December 2008 22:28 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Mark,

In addition to Adolfo's response, I can suggest looking into EMF's
URIEditorInput, which allows an editor to load a resource from any URI.
I don't know, though, whether it works with any other editors than
EMF-generated editors.

The EclipseZone item that you referenced deals with the workspace, but
from the perspective of a user of your workbench, the development
workspace is actually (a part of) the target platform. So, you could
use the FileLocator utility (from Eclipse Platform) to provide a
java.io.File accessing a resource in your plug-in, to edit that.

I'm not sure that I quite understand your scenario, I'm afraid ... is
the resource that you want to edit in a deployed plug-in, or in the
user's workspace?

Cheers,

Christian

Mark Melia wrote:
> Hi Christian,
>
> What I want to do is create a simple button so that the user can edit
> the OCL in the runtime. To do this I need an IFile for the
> FileEditorInput. Do you have any idea how to convert from the URL below
> to an IFile?
> Tried this:
> http://www.eclipsezone.com/eclipse/forums/m92221730.html
> but because it doesnt work as the IFile is resolved to the runtime
> workspace.
>
> Thanks for your help,
> Mark
>
>
> Christian W. Damus wrote:
>
>> Hi, Mark,
>
>> The OCLConstraintProvider has this method (exception handling and
>> blade guard removed for clarity):
>
>> private void parseConstraints(Category category,
>> Bundle bundle, String path) {
>
>> URL url = bundle.getEntry(path);
>
>> if (url != null) {
>> InputStream input = url.openStream();
>
>> parseConstraints(category, bundle.getSymbolicName(), input);
>
>> input.close();
>> }
>> }
>
>> So, we use here the OSGi bundle's facility for loading resources from
>> its JAR. Just be sure to list your OCL file(s) in the bin.includes in
>> your build.properties file.
>
>> HTH,
>
>> Christian
>
>> Mark Melia wrote:
>>> Hi Christian,
>>>
>>> I have a quick question on your OCL example -
>>> org.eclipse.emf.validation.examples.ocl. To get this working there is
>>> an OCL file defined in the workspace - constraints/library.ocl.
>>> How does the runtime OCL validation plugin find the OCL file, when it
>>> is defined in the design time workspace?
>>> Thanks,
>>> Mark
>>>
>
>
Re: org.eclipse.emf.validation.examples.ocl example [message #65062 is a reply to message #64994] Fri, 05 December 2008 10:47 Go to previous message
Mark Melia is currently offline Mark Melia
Messages: 142
Registered: July 2009
Senior Member
Hi Christian, Adolfo,

Thanks for your reply - I was just looking to allow the user to open OCL
constraints file in the development environment (to simply show how
constraints can be integrated).

I have this working, but I really should move the constraints file to the
deployed plugin.

Thanks for all your help,
Mark



Christian W. Damus wrote:

> Hi, Mark,

> In addition to Adolfo's response, I can suggest looking into EMF's
> URIEditorInput, which allows an editor to load a resource from any URI.
> I don't know, though, whether it works with any other editors than
> EMF-generated editors.

> The EclipseZone item that you referenced deals with the workspace, but
> from the perspective of a user of your workbench, the development
> workspace is actually (a part of) the target platform. So, you could
> use the FileLocator utility (from Eclipse Platform) to provide a
> java.io.File accessing a resource in your plug-in, to edit that.

> I'm not sure that I quite understand your scenario, I'm afraid ... is
> the resource that you want to edit in a deployed plug-in, or in the
> user's workspace?

> Cheers,

> Christian

> Mark Melia wrote:
>> Hi Christian,
>>
>> What I want to do is create a simple button so that the user can edit
>> the OCL in the runtime. To do this I need an IFile for the
>> FileEditorInput. Do you have any idea how to convert from the URL below
>> to an IFile?
>> Tried this:
>> http://www.eclipsezone.com/eclipse/forums/m92221730.html
>> but because it doesnt work as the IFile is resolved to the runtime
>> workspace.
>>
>> Thanks for your help,
>> Mark
>>
>>
>> Christian W. Damus wrote:
>>
>>> Hi, Mark,
>>
>>> The OCLConstraintProvider has this method (exception handling and
>>> blade guard removed for clarity):
>>
>>> private void parseConstraints(Category category,
>>> Bundle bundle, String path) {
>>
>>> URL url = bundle.getEntry(path);
>>
>>> if (url != null) {
>>> InputStream input = url.openStream();
>>
>>> parseConstraints(category, bundle.getSymbolicName(), input);
>>
>>> input.close();
>>> }
>>> }
>>
>>> So, we use here the OSGi bundle's facility for loading resources from
>>> its JAR. Just be sure to list your OCL file(s) in the bin.includes in
>>> your build.properties file.
>>
>>> HTH,
>>
>>> Christian
>>
>>> Mark Melia wrote:
>>>> Hi Christian,
>>>>
>>>> I have a quick question on your OCL example -
>>>> org.eclipse.emf.validation.examples.ocl. To get this working there is
>>>> an OCL file defined in the workspace - constraints/library.ocl.
>>>> How does the runtime OCL validation plugin find the OCL file, when it
>>>> is defined in the design time workspace?
>>>> Thanks,
>>>> Mark
>>>>
>>
>>
Previous Topic:Problem defining global variables
Next Topic:[Announce] MDT OCL 1.3.0 I200812091600 is available
Goto Forum:
  


Current Time: Mon Sep 22 20:32:48 GMT 2014

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

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