Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend] access to Issues from JAVA extension
[Xtend] access to Issues from JAVA extension [message #537529] Wed, 02 June 2010 18:53 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Hi there,

can I get access to the Issues object from a Java extension?
I want to report a warning or error from my Java extension without
completely interrupting the workflow. Any Exception I could throw instead?

I got access to the ExecutionContext but am not sure where the Issues are.

Cheers,
Hauke
Re: [Xtend] access to Issues from JAVA extension [message #537630 is a reply to message #537529] Thu, 03 June 2010 06:47 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
They are not directly accessable.
You'll have to pass them in, either by parameter or as a global var.

Sven


Hauke Fuhrmann schrieb:
> Hi there,
>
> can I get access to the Issues object from a Java extension?
> I want to report a warning or error from my Java extension without
> completely interrupting the workflow. Any Exception I could throw instead?
>
> I got access to the ExecutionContext but am not sure where the Issues are.
>
> Cheers,
> Hauke


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xtend] access to Issues from JAVA extension [message #537670 is a reply to message #537630] Thu, 03 June 2010 10:09 Go to previous messageGo to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Sven,
where do I get them from in Xtend? So far I only used the Issues stdlib
in Xtend to use the reportWarning(String) and reportError(String)
functions. How do I get the Issues object itself in Xtend?

Hauke

Sven Efftinge schrieb:
> They are not directly accessable.
> You'll have to pass them in, either by parameter or as a global var.
>
> Sven
>
>
> Hauke Fuhrmann schrieb:
>> Hi there,
>>
>> can I get access to the Issues object from a Java extension?
>> I want to report a warning or error from my Java extension without
>> completely interrupting the workflow. Any Exception I could throw
>> instead?
>>
>> I got access to the ExecutionContext but am not sure where the Issues
>> are.
>>
>> Cheers,
>> Hauke
>
>
Re: [Xtend] access to Issues from JAVA extension [message #537918 is a reply to message #537529] Fri, 04 June 2010 07:45 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

It is not intended to use the Issues object from Xtend, so there is no direct way to do this. What you could do is to write a small WorkflowComponent, or subclass ExtIssueReporter, which gets the Issues object passed. This object must be stored for later access. ExtIssueReporter uses a ThreadLocal, but the getIssues() method is private. You would need a public static method that returns the value of the ThreadLocal. This method could be used from a JAVA extension. Since you are returning the Issues object you would need to use the JavaMetaModel to use the object, this needs to be configured in the project properties and the workflow.

HTH,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: [Xtend] access to Issues from JAVA extension [message #537928 is a reply to message #537670] Fri, 04 June 2010 07:37 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Write a class which implements IWorkflowComponent.

configure it before the Xpand components

component = MyIssuesComponent as issuesComp {}

make issuesComp available as global var to the Xpand component.

Within MyIssuesComponent you simply hold the passed issues object.

Within Xtend you can now access the MyIssueComponent and its contained
Issues object through the means of global var.

Sven


Hauke Fuhrmann schrieb:
> Sven,
> where do I get them from in Xtend? So far I only used the Issues stdlib
> in Xtend to use the reportWarning(String) and reportError(String)
> functions. How do I get the Issues object itself in Xtend?
>
> Hauke
>
> Sven Efftinge schrieb:
>> They are not directly accessable.
>> You'll have to pass them in, either by parameter or as a global var.
>>
>> Sven
>>
>>
>> Hauke Fuhrmann schrieb:
>>> Hi there,
>>>
>>> can I get access to the Issues object from a Java extension?
>>> I want to report a warning or error from my Java extension without
>>> completely interrupting the workflow. Any Exception I could throw
>>> instead?
>>>
>>> I got access to the ExecutionContext but am not sure where the Issues
>>> are.
>>>
>>> Cheers,
>>> Hauke
>>
>>


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Previous Topic:[XTend] something like instanceof?
Next Topic:Xtend/Xpand support in ohloh
Goto Forum:
  


Current Time: Tue Apr 16 04:58:43 GMT 2024

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

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

Back to the top