| UI Dependency Problem of emf.Diagnostics (instance models with OCL Pivot constraints) [message #994527] |
Thu, 27 December 2012 10:36  |
Tobias Lutz Messages: 16 Registered: April 2012 |
Junior Member |
|
|
Hello,
im not quite sure if this is an xtext or ocl problem.
I already found a similar problem at http://www.eclipse.org/forums/index.php/t/245264/
but it's from last year.
I also want to run some stuff in an headless junit-plugin-test and check my model if it's valid withing the following method:
//org.eclipse.emf.common.util.Diagnostic
private static boolean modelIsValid(EObject model){
Diagnostic modelValidity = Diagnostician.INSTANCE.validate(model);
if(modelValidity.getSeverity() == Diagnostic.OK){
return true;
}else {
jlog.log(Level.SEVERE, "Loaded Model "+ model +"is invalid!");
return false;
}}
The problem is that there are some errors thrown when calling this at line 1 "Diagnostician.INSTANCE.validate(model);" saying that Guice couldn't create some ui stuff.
Im loading the model like the following way:
registerNecessaryMetaModelPackages(); // all required Packages are registered here
resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
resource = resourceSet.createResource(URI.createPlatformPluginURI("/projectName/folderpath/model.extension", true));
resource.load(null);
EcoreUtil.resolveAll(resource);
EObject model = resource.getContents().get(0);
if(modelIsValid(model)){
I figured out that this error only appears if i load a instance model of a metamodel with ocl constrains (pivot).
Loading a constraint free instancemodel or a metamodel works.
[Updated on: Thu, 27 December 2012 10:38] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: UI Dependency Problem of emf.Diagnostics (instance models with OCL Pivot constraints) [message #996535 is a reply to message #996522] |
Wed, 02 January 2013 05:05  |
Ed Willink Messages: 3185 Registered: July 2009 |
Senior Member |
|
|
Hi
The new Pivot-based OCL has a rich 'invalid' that wraps a Java exception
stack trace so that the recipient of 'invalid' can be more informative.
Regards
Ed Willink
On 02/01/2013 09:25, Tobias Lutz wrote:
> Hi,
>
> I agree. But should in this case not at least be given a warning/error
> message instead of just evaluating the model to be invalid?
> My expectation was just that if there are only dependencies to ui
> undependent plugins there is no ui stuff required that come implicit
> along with the EssentialOCLSetup and the "org.eclipse.sdk.ide".
>
> But for now I choose the way with the "org.eclipse.sdk.ide".
>
> Thanks and regards
|
|
|
Powered by
FUDForum. Page generated in 0.02658 seconds