Skip to main content



      Home
Home » Eclipse Projects » Sirius » Load an existing model instance in Java Service Class(Java Service Conditional Style)
Load an existing model instance in Java Service Class [message #1738288] Mon, 18 July 2016 12:25 Go to next message
Eclipse UserFriend
I tried to load an existing model instance in a java service class for conditional style.

I have tried the method in the following link:
https://www.eclipse.org/forums/index.php/t/1078013/

But it doesn't work.

I have also tried the method here:
http://www.vogella.com/tutorials/EclipseEMFPersistence/article.html#javacode_load

It also doesn't work in a java service class.

I have also tried this method in a normal Java Class and it worked.
Could anyone explain why this method doesn't work for java service class?

What is the correct method to load an existing model instance in java service?

[Updated on: Tue, 19 July 2016 04:00] by Moderator

Re: Load an existing model instance in Java Service Class [message #1738344 is a reply to message #1738288] Tue, 19 July 2016 04:10 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

What does not work? Do you have an exception that could give an idea of
what happened?
The proper method to load an existing model is as presented in your link
org.eclipse.sirius.business.api.session.Session.addSemanticResource(URI,
IProgressMonitor).

Regards,
Steve

Le 18/07/2016 à 22:56, Bo Liu a écrit :
> I tried to load an existing model instance in a java service class for
> conditional style.
>
> I have tried the method in the following link:
> https://www.eclipse.org/forums/index.php/t/1078013/
>
> But it doesn't work.
>
> I have also tried this method in a normal Java Class and it worked.
> Could anyone explain why this method doesn't work for java service class?
>
> What is the correct method to load an existing model instance in java
> service?
>
>


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Load an existing model instance in Java Service Class [message #1738347 is a reply to message #1738344] Tue, 19 July 2016 04:19 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thanks for the reply

the method doesn't return and I don't know where I can see the exceptions and debug the method.

If I only write return true in the method, the conditional style will be used.

If I write the code to load a model, then it doesn't work any more.
I guess that there is an exception and the method doesn't return.

But I don't know where I can read the exceptions.

I have also tried this method:
http://www.vogella.com/tutorials/EclipseEMFPersistence/article.html#javacode_load

It worked in a normal java class but not in the java service class.
Re: Load an existing model instance in Java Service Class [message #1738354 is a reply to message #1738347] Tue, 19 July 2016 05:00 Go to previous messageGo to next message
Eclipse UserFriend
Is your "Error Log" view open (Window/Show View/Others...)? If it is not
silently catched, the exception should be available there. Are you sure
you have the proper URI for the model to load?

I am not sure why you want to load a model in the predicate expression
of a conditional style. It seems more performant to have this model
loaded in your session and have the predicate expression only looking
for a specific model in the current session.

Regards,
Steve

Le 19/07/2016 à 10:19, Bo Liu a écrit :
> Hi,
> Thanks for the reply
>
> the method doesn't return and I don't know where I can see the
> exceptions and debug the method.
>
> If I only write return true in the method, the conditional style will be
> used.
>
> If I write the code to load a model, then it doesn't work any more. I
> guess that there is an exception and the method doesn't return.
>
> But I don't know where I can read the exceptions.
>
> I have also tried this method:
> http://www.vogella.com/tutorials/EclipseEMFPersistence/article.html#javacode_load
>
>
> It worked in a normal java class but not in the java service class.


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Load an existing model instance in Java Service Class [message #1738357 is a reply to message #1738354] Tue, 19 July 2016 05:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

There is no exception in the Error Log View.

I want to load the model in the predicate expression because there is information in this model to decide if the conditional style should be applied.

I have tried to catch the exception and write it to a file.
Is there a better way to debug the java service and see the exceptions?

Thanks for the reply!
Re: Load an existing model instance in Java Service Class [message #1738360 is a reply to message #1738357] Tue, 19 July 2016 05:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

You can place a breakpoint in your java service and debug it step by
step where you call
org.eclipse.sirius.business.api.session.Session.addSemanticResource(URI,
IProgressMonitor). Can you provide a sample? I have too limited
information to help you.

Regards,
Steve

Le 19/07/2016 à 11:14, Bo Liu a écrit :
> Hi,
>
> There is no exception in the Error Log View.
>
> I want to load the model in the predicate expression because there is
> information in this model to decide if the conditional style should be
> applied.
>
> I have tried to catch the exception and write it to a file. Is there a
> better way to debug the java service and see the exceptions?
>
> Thanks for the reply!


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Load an existing model instance in Java Service Class [message #1738379 is a reply to message #1738360] Tue, 19 July 2016 06:54 Go to previous message
Eclipse UserFriend
Hi,

I have now figured it out.
There are no Problems with the Resource Loading with addSemanticResource.

The use of an external Class in the Java Service is causing the exception.

Thanks for your help!
Previous Topic:Can't get crosstable working
Next Topic:Update cells in a cross table
Goto Forum:
  


Current Time: Mon Mar 17 04:15:46 EDT 2025

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

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

Back to the top