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 Fuhrmann
Messages: 324
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 Efftinge
Messages: 1769
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


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) 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 Fuhrmann
Messages: 324
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 Thoms
Messages: 354
Registered: July 2009
Location: Dortmund
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, Xpand, EMF?
Go to: http://xtext.itemis.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 Efftinge
Messages: 1769
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


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) 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: Sun Oct 26 08:04:16 GMT 2014

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

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