Home » Modeling » OCL » RE: org.eclipse.emf.validation.examples.ocl example
|
Re: org.eclipse.emf.validation.examples.ocl example [message #64943 is a reply to message #64908] |
Wed, 03 December 2008 21:42 |
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 |
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 |
Adolfo Sanchez-Barbudo Herrera Messages: 260 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 |
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 |
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
>>>>
>>
>>
|
|
|
Goto Forum:
Current Time: Thu Dec 26 20:51:01 GMT 2024
Powered by FUDForum. Page generated in 0.03886 seconds
|