Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Validation
EMF Validation [message #726401] Sat, 17 September 2011 22:07 Go to next message
Volker Schilling is currently offline Volker SchillingFriend
Messages: 14
Registered: July 2009
Junior Member
Hi folks,

I had a little application that runs with an EMF model. Now I'm trying
to validate cross document references using ab project builder and EMF
Valifation Framework. It works perfect in most cases. ...

I have an Eclipse Workspace Resource called: TestCase1.case

1) If I rename this resource to TestCase2.case
EcoreUtil.UnresolvedProxyCrossReferencer.find(...) finds a broken cross
document reference - so far so good.

2) If I rename this resource to
testCase1.caseEcoreUtil.UnresolvedProxyCrossReferencer.find(...) doesent
find a broken cross document reference if I call the Constraint Checker
from the builder.

Is there anyone that can help me?

Thanks,
Volker
Re: EMF Validation [message #726405 is a reply to message #726401] Sat, 17 September 2011 22:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33252
Registered: July 2009
Senior Member
Volker,

Comments below.


On 17/09/2011 3:07 PM, Volker Schilling wrote:
> Hi folks,
>
> I had a little application that runs with an EMF model. Now I'm trying
> to validate cross document references using ab project builder and EMF
> Valifation Framework. It works perfect in most cases. ...
>
> I have an Eclipse Workspace Resource called: TestCase1.case
>
> 1) If I rename this resource to TestCase2.case
> EcoreUtil.UnresolvedProxyCrossReferencer.find(...) finds a broken cross
> document reference - so far so good.
>
> 2) If I rename this resource to
> testCase1.caseEcoreUtil.UnresolvedProxyCrossReferencer.find(...) doesent
> find a broken cross document reference if I call the Constraint Checker
> from the builder.
>
> Is there anyone that can help me?
So you've only changed the case of the file? And you're running on
Windows where the file system isn't case sensitive? That might well
explain it.
>
> Thanks,
> Volker


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Validation [message #726492 is a reply to message #726405] Sun, 18 September 2011 09:34 Go to previous messageGo to next message
Volker Schilling is currently offline Volker SchillingFriend
Messages: 14
Registered: July 2009
Junior Member
Am 18.09.2011 00:22, schrieb Ed Merks:
> Volker,
>
> Comments below.
>
>
> On 17/09/2011 3:07 PM, Volker Schilling wrote:
>> Hi folks,
>>
>> I had a little application that runs with an EMF model. Now I'm trying
>> to validate cross document references using ab project builder and EMF
>> Valifation Framework. It works perfect in most cases. ...
>>
>> I have an Eclipse Workspace Resource called: TestCase1.case
>>
>> 1) If I rename this resource to TestCase2.case
>> EcoreUtil.UnresolvedProxyCrossReferencer.find(...) finds a broken cross
>> document reference - so far so good.
>>
>> 2) If I rename this resource to
>> testCase1.caseEcoreUtil.UnresolvedProxyCrossReferencer.find(...) doesent
>> find a broken cross document reference if I call the Constraint Checker
>> from the builder.
>>
>> Is there anyone that can help me?
> So you've only changed the case of the file? And you're running on
> Windows where the file system isn't case sensitive? That might well
> explain it.
>>
>> Thanks,
>> Volker

Hi Ed,

thanks for your response!

Yes I run on Windows. The problem is, after I load the resource in my
Editor the cross reference is broken and I can't resolve the proxy.

If I run the validation from the editor itself after I load it throught
an editing domain, the validation detetcts the broken reference but not
in the builder.

From the builder I call it like this:

ResourceSet resourceSet = new ResourceSetImpl();
URI fileURI = URI.createFileURI(resource.getLocation().toOSString());

emfResource = resourceSet.getResource(fileURI, true);

if (emfResource != null) {

IStatus status = validator.validate(emfResource.getContents());

try {
MarkerUtil.createMarkers(status);
} catch (CoreException e) {
e.printStackTrace();
}

}


From the Editor I call it like this:

URI resourceURI = EditUIUtil.getURI(getEditorInput());

Resource resource = null;

try {

resource = editingDomain.getResourceSet().getResource(resourceURI, true);

}
catch (Exception e) {

resource = editingDomain.getResourceSet().getResource(resourceURI,
false);

}

IBatchValidator validator =
(IBatchValidator)ModelValidationService.getInstance()
.newValidator(EvaluationMode.BATCH);

validator.setIncludeLiveConstraints(true);

if (resource != null) {

IStatus status = validator.validate(resource.getContents());

try {
MarkerUtil.createMarkers(status);
} catch (CoreException e) {
e.printStackTrace();
}

}

Is there a mistake in the way I call it, and why is there a difference.
I can life with the fact, that windows fs don't care about the case,
but only if the editor can handle the corss reference correct in that case.

Thanks,
Volker
Re: EMF Validation [message #726529 is a reply to message #726492] Sun, 18 September 2011 14:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33252
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Volker,<br>
<br>
Comments below.<br>
<br>
On 18/09/2011 2:34 AM, Volker Schilling wrote:
<blockquote cite="mid:j54da6$d3c$1@news.eclipse.org" type="cite">
<pre wrap="">Am 18.09.2011 00:22, schrieb Ed Merks:
</pre>
<blockquote type="cite">
<pre wrap="">Volker,

Comments below.


On 17/09/2011 3:07 PM, Volker Schilling wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi folks,

I had a little application that runs with an EMF model. Now I'm trying
to validate cross document references using ab project builder and EMF
Valifation Framework. It works perfect in most cases. ...

I have an Eclipse Workspace Resource called: TestCase1.case

1) If I rename this resource to TestCase2.case
EcoreUtil.UnresolvedProxyCrossReferencer.find(...) finds a broken cross
document reference - so far so good.

2) If I rename this resource to
testCase1.caseEcoreUtil.UnresolvedProxyCrossReferencer.find(...) doesent
find a broken cross document reference if I call the Constraint Checker
from the builder.

Is there anyone that can help me?
</pre>
</blockquote>
<pre wrap="">So you've only changed the case of the file? And you're running on
Windows where the file system isn't case sensitive? That might well
explain it.
</pre>
<blockquote type="cite">
<pre wrap="">
Thanks,
Volker
</pre>
</blockquote>
</blockquote>
<pre wrap="">
Hi Ed,

thanks for your response!

Yes I run on Windows. The problem is, after I load the resource in my
Editor the cross reference is broken and I can't resolve the proxy.</pre>
</blockquote>
I believe the workspace itself isn't case insensitive, even if the
file system is...<br>
<blockquote cite="mid:j54da6$d3c$1@news.eclipse.org" type="cite">
<pre wrap="">

If I run the validation from the editor itself after I load it throught
an editing domain, the validation detetcts the broken reference but not
in the builder.

From the builder I call it like this:

ResourceSet resourceSet = new ResourceSetImpl();
URI fileURI = URI.createFileURI(resource.getLocation().toOSString()); </pre>
</blockquote>
You're not accessing it via the workspace.  Is there a reason for
not using platform:/resource?<br>
<ul>
<li class="toclevel-2"><a
href="http://wiki.eclipse.org/index.php/EMF/FAQ#How_do_I_map_between_an_EMF_Resource_and_an_Eclipse_IFile.3F"><span
class="tocnumber">2.44</span> <span class="toctext">How do
I map between an EMF Resource and an Eclipse IFile?</span></a><br>
</li>
</ul>
<br>
<blockquote cite="mid:j54da6$d3c$1@news.eclipse.org" type="cite">
<pre wrap="">

emfResource = resourceSet.getResource(fileURI, true);

if (emfResource != null) {

IStatus status = validator.validate(emfResource.getContents());

try {
MarkerUtil.createMarkers(status);
} catch (CoreException e) {
e.printStackTrace();
}

}


From the Editor I call it like this:

URI resourceURI = EditUIUtil.getURI(getEditorInput());

Resource resource = null;

try {

resource = editingDomain.getResourceSet().getResource(resourceURI, true);

}
catch (Exception e) {

resource = editingDomain.getResourceSet().getResource(resourceURI,
false);

}

IBatchValidator validator =
(IBatchValidator)ModelValidationService.getInstance()
.newValidator(EvaluationMode.BATCH);

validator.setIncludeLiveConstraints(true);

if (resource != null) {

IStatus status = validator.validate(resource.getContents());

try {
MarkerUtil.createMarkers(status);
} catch (CoreException e) {
e.printStackTrace();
}

}

Is there a mistake in the way I call it, and why is there a difference.</pre>
</blockquote>
In one case you're accessing the file system directly and in the
other you're using the workspace.<br>
<blockquote cite="mid:j54da6$d3c$1@news.eclipse.org" type="cite">
<pre wrap="">
I can life with the fact, that windows fs don't care about the case,
but only if the editor can handle the corss reference correct in that case.

Thanks,
Volker



</pre>
</blockquote>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Validation [message #726532 is a reply to message #726529] Sun, 18 September 2011 14:38 Go to previous message
Volker Schilling is currently offline Volker SchillingFriend
Messages: 14
Registered: July 2009
Junior Member
Am 18.09.2011 16:04, schrieb Ed Merks:
> Volker,
>
> Comments below.
>
> On 18/09/2011 2:34 AM, Volker Schilling wrote:
>> Am 18.09.2011 00:22, schrieb Ed Merks:
>>> Volker,
>>>
>>> Comments below.
>>>
>>>
>>> On 17/09/2011 3:07 PM, Volker Schilling wrote:
>>>> Hi folks,
>>>>
>>>> I had a little application that runs with an EMF model. Now I'm trying
>>>> to validate cross document references using ab project builder and EMF
>>>> Valifation Framework. It works perfect in most cases. ...
>>>>
>>>> I have an Eclipse Workspace Resource called: TestCase1.case
>>>>
>>>> 1) If I rename this resource to TestCase2.case
>>>> EcoreUtil.UnresolvedProxyCrossReferencer.find(...) finds a broken cross
>>>> document reference - so far so good.
>>>>
>>>> 2) If I rename this resource to
>>>> testCase1.caseEcoreUtil.UnresolvedProxyCrossReferencer.find(...) doesent
>>>> find a broken cross document reference if I call the Constraint Checker
>>>> from the builder.
>>>>
>>>> Is there anyone that can help me?
>>> So you've only changed the case of the file? And you're running on
>>> Windows where the file system isn't case sensitive? That might well
>>> explain it.
>>>> Thanks,
>>>> Volker
>> Hi Ed,
>>
>> thanks for your response!
>>
>> Yes I run on Windows. The problem is, after I load the resource in my
>> Editor the cross reference is broken and I can't resolve the proxy.
> I believe the workspace itself isn't case insensitive, even if the file
> system is...
>>
>> If I run the validation from the editor itself after I load it throught
>> an editing domain, the validation detetcts the broken reference but not
>> in the builder.
>>
>> From the builder I call it like this:
>>
>> ResourceSet resourceSet = new ResourceSetImpl();
>> URI fileURI = URI.createFileURI(resource.getLocation().toOSString());
> You're not accessing it via the workspace. Is there a reason for not
> using platform:/resource?
>
> * 2.44 How do I map between an EMF Resource and an Eclipse IFile?
> <http://wiki.eclipse.org/index.php/EMF/FAQ#How_do_I_map_between_an_EMF_Resource_and_an_Eclipse_IFile.3F>
>
>
>>
>>
>> emfResource = resourceSet.getResource(fileURI, true);
>>
>> if (emfResource != null) {
>>
>> IStatus status = validator.validate(emfResource.getContents());
>>
>> try {
>> MarkerUtil.createMarkers(status);
>> } catch (CoreException e) {
>> e.printStackTrace();
>> }
>>
>> }
>>
>>
>> From the Editor I call it like this:
>>
>> URI resourceURI = EditUIUtil.getURI(getEditorInput());
>>
>> Resource resource = null;
>>
>> try {
>>
>> resource = editingDomain.getResourceSet().getResource(resourceURI, true);
>>
>> }
>> catch (Exception e) {
>>
>> resource = editingDomain.getResourceSet().getResource(resourceURI,
>> false);
>>
>> }
>>
>> IBatchValidator validator =
>> (IBatchValidator)ModelValidationService.getInstance()
>> .newValidator(EvaluationMode.BATCH);
>>
>> validator.setIncludeLiveConstraints(true);
>>
>> if (resource != null) {
>>
>> IStatus status = validator.validate(resource.getContents());
>>
>> try {
>> MarkerUtil.createMarkers(status);
>> } catch (CoreException e) {
>> e.printStackTrace();
>> }
>>
>> }
>>
>> Is there a mistake in the way I call it, and why is there a difference.
> In one case you're accessing the file system directly and in the other
> you're using the workspace.
>> I can life with the fact, that windows fs don't care about the case,
>> but only if the editor can handle the corss reference correct in that case.
>>
>> Thanks,
>> Volker
>>
>>
>>
Thanks!

now ist is detected as expected!

Greetings,
Volker
Previous Topic:(no subject)
Next Topic:[CDO] Push transactions : Duplicate ID error when loading several changes made on the same element
Goto Forum:
  


Current Time: Sun Nov 10 19:50:35 GMT 2024

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

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

Back to the top