Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » no output from workflow called by java - action - debug action calls?
no output from workflow called by java - action - debug action calls? [message #138446] Sun, 12 July 2009 19:21 Go to next message
Bill HingeFriend
Messages: 156
Registered: July 2009
Senior Member
Hi

I'm on the last leg - packaging my plugin

I have a plugin which is trying to run a mwe workflow
(the workflow runs in project explorer right click as expected)

When I export my plugin and load it, then run my action, the action
is called as evidenced by org.eclipse.jface.dialogs placed in my code.

I have checked that the workflow urls I am using point to resources
actually exist but I don't seem to be getting any output. Normally it
takes about 11 to 23 secs to run the workflow but through java it just
skips through

I'm selecting a gmf output file as my model file.

This is how I am calling my action (no exceptions thrown)

ngossModel is my GMF model file

Is there any better way of getting debug info from something called
from an action. The only way I can check things is via placing jface
dialogs in my code. Not sure how to use debugger on an action if
possible? (no debug or console)

regards
Steve
============================================================ =============

public void run(IAction action) {
try {
EObject source = getInput();
if (source == null) {
String title = Messages.RunTransformationAction_title;
String message = Messages.RunTransformationAction_message;

MessageDialog.openInformation(getShell(), title, NLS.bind(message,
file.getFullPath()));
} else {

URL url2 = new
URL(" platform:/plugin/org.tmf.businessService.ui/templates/busine ssServiceDemoWorkflow.mwe ");
org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
"Debug", "Running workflow := " + url2.toString() );

URL url = FileLocator.toFileURL(url2);

URL url3 = new URL("platform:/plugin/org.tmf.businessService.ui");
URL url4 = FileLocator.toFileURL(url3);


org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
"Step2", "url := " + url4.toString() );

Map<String, String> properties = new HashMap<String, String>();
Map<String, String> slotcontents = new HashMap<String, String>();

properties.put("ngossModel",
URI.createPlatformResourceURI(file.getFullPath().toString(),
true).toString());
properties.put("src-gen", Platform.getLocation().toOSString() +
file.getParent().getFullPath());
properties.put("project_home", url4.toString());

new WorkflowRunner().run(url.getPath(), new NullProgressMonitor(),
properties, slotcontents);


file.getParent().refreshLocal(IResource.DEPTH_ONE, new
org.eclipse.core.runtime.NullProgressMonitor());

org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
"Done", "Transform run on := " + file.getName()
+ " output produced in location : " +
Platform.getLocation().toOSString() + file.getParent().getFullPath() );
}
} catch (Exception ex) {
handleError(ex);
}
}



Here is my workflow - it works if run on the workbench using 'run as'
I'm not seeing any console output


<?xml version="1.0" encoding="utf-8" ?>
<workflow>
<property name="workspace_loc" value="./" />
<property name="project_home" value="../org.tmf.businessService.ui" />
<property name="ngossModel" value="templates/default16.ngoss" />
<property name="src-gen" value="../org.tmf.businessService.ui/src-gen"/>
<property name="out" value="out" />

<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
<platformUri value="../" />
<RegisterEcoreFile value="${project_home}/model/contract.ecore"/>
<RegisterEcoreFile value="${project_home}/model/sla.ecore"/>
<RegisterEcoreFile value="${project_home}/model/informationModel.ecore"/>
<RegisterEcoreFile value="${project_home}/model/ngoss.ecore"/>
<RegisterEcoreFile value="${project_home}/model/tam.ecore"/>
<RegisterEcoreFile value="${project_home}/model/sbvr.ecore"/>
<registerGeneratedEPackage value="org.eclipse.uml2.uml.UMLPackage"/>
<registerGeneratedEPackage
value="org.eclipse.gmf.runtime.notation.NotationPackage"/>

</bean>

<component class="org.eclipse.emf.mwe.utils.DirectoryCleaner"
directory="${project_home}/src-gen"/>

<component class="org.eclipse.emf.mwe.utils.Reader">
<firstElementOnly value="true" />
<modelSlot value="ngossModel"/>
<uri value="${ngossModel}"/>

</component>

<component class="org.eclipse.xpand2.Generator" id="ngossGenerate">
<metaModel id="mm"
class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>

<fileEncoding value="UTF-8"/>
<expand value="Demos::Main FOR ngossModel" />
<outlet path="${src-gen}">

<!-- postprocessor output configuration -->


</outlet>
</component>


</workflow>
Re: no output from workflow called by java - action - debug action calls? [message #138459 is a reply to message #138446] Sun, 12 July 2009 20:59 Go to previous messageGo to next message
Krzysztof Kowalczyk is currently offline Krzysztof KowalczykFriend
Messages: 113
Registered: July 2009
Senior Member
> I have a plugin which is trying to run a mwe workflow

And now the fun begins. I don't know is there any new solution for old
problems with "running workflow from code" in Eclipse Xpand.
There are workarounds for oAW version so I will point to them.

> Is there any better way of getting debug info from something called
> from an action.

Firstly, console is quite important to know what is happening. So you
need to set it up and running. It would be interesting to know what is
the error on the console.

I guess that you will have some errors connected with UML plugin on you
console or another errors that are caused by different handling of
execution context in workflow runned externally and from code (normal
classpath or equinox managed classpath and resources).

Both problems can be solved and you can start looking for solution here:
https://opensource.luminis.net/wiki/display/SITE/oAW+Workflo w+from+Eclipse+Plugin
(check the links, there too)

But as I said before, maybe new solution is available. So you can also
ask specific question (In a new topic) on this news group.

> Not sure how to use debugger on an action if
> possible? (no debug or console)

You can debug only Java code in your setting, you just need to run you
eclipse application in debug mode, from the eclipse instance where you
develop you plugin. You will not be able to debug Xpand/Xtend if you
running it form code.

Regards,
Krzysztof Kowalczyk
Re: no output from workflow called by java - action - debug action calls? [message #138471 is a reply to message #138446] Mon, 13 July 2009 13:06 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Bill,

you're saying that you don't get any feedback (exceptions, or the like)?
This really is strange.

Looking at the code I noticed, that given you're running in an OSGi
environment you'll have to configure the ResourceLoader before running
the Workflow like this:

ResourceLoaderFactory.setCurrentThreadResourceLoader(new
ResourceLoaderImpl(getClass().getClassLoader());

But you should at least get some ClassNotFouncExceptions.

Sven

Bill Hinge schrieb:
>
> Hi
>
> I'm on the last leg - packaging my plugin
>
> I have a plugin which is trying to run a mwe workflow
> (the workflow runs in project explorer right click as expected)
>
> When I export my plugin and load it, then run my action, the action
> is called as evidenced by org.eclipse.jface.dialogs placed in my code.
>
> I have checked that the workflow urls I am using point to resources
> actually exist but I don't seem to be getting any output. Normally it
> takes about 11 to 23 secs to run the workflow but through java it just
> skips through
>
> I'm selecting a gmf output file as my model file.
>
> This is how I am calling my action (no exceptions thrown)
>
> ngossModel is my GMF model file
>
> Is there any better way of getting debug info from something called
> from an action. The only way I can check things is via placing jface
> dialogs in my code. Not sure how to use debugger on an action if
> possible? (no debug or console)
>
> regards
> Steve
> ============================================================ =============
>
> public void run(IAction action) {
> try {
> EObject source = getInput();
> if (source == null) {
> String title = Messages.RunTransformationAction_title;
> String message = Messages.RunTransformationAction_message;
>
> MessageDialog.openInformation(getShell(), title,
> NLS.bind(message, file.getFullPath()));
> } else {
>
> URL url2 = new
> URL(" platform:/plugin/org.tmf.businessService.ui/templates/busine ssServiceDemoWorkflow.mwe ");
>
>
> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
> "Debug", "Running workflow := " + url2.toString() );
>
> URL url = FileLocator.toFileURL(url2);
>
> URL url3 = new
> URL("platform:/plugin/org.tmf.businessService.ui");
> URL url4 = FileLocator.toFileURL(url3);
>
>
>
> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
> "Step2", "url := " + url4.toString() );
>
> Map<String, String> properties = new HashMap<String,
> String>();
> Map<String, String> slotcontents = new HashMap<String,
> String>();
>
> properties.put("ngossModel",
> URI.createPlatformResourceURI(file.getFullPath().toString(),
> true).toString());
> properties.put("src-gen",
> Platform.getLocation().toOSString() + file.getParent().getFullPath());
> properties.put("project_home", url4.toString());
>
> new WorkflowRunner().run(url.getPath(), new
> NullProgressMonitor(), properties, slotcontents);
>
>
> file.getParent().refreshLocal(IResource.DEPTH_ONE, new
> org.eclipse.core.runtime.NullProgressMonitor());
>
>
> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
> "Done", "Transform run on := " + file.getName()
> + " output produced in location : " +
> Platform.getLocation().toOSString() +
> file.getParent().getFullPath() );
> }
> } catch (Exception ex) {
> handleError(ex);
> }
> }
>
>
>
> Here is my workflow - it works if run on the workbench using 'run as'
> I'm not seeing any console output
>
>
> <?xml version="1.0" encoding="utf-8" ?>
> <workflow>
> <property name="workspace_loc" value="./" />
> <property name="project_home" value="../org.tmf.businessService.ui" />
> <property name="ngossModel" value="templates/default16.ngoss" />
> <property name="src-gen"
> value="../org.tmf.businessService.ui/src-gen"/>
> <property name="out" value="out" />
>
> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
> <platformUri value="../" />
> <RegisterEcoreFile value="${project_home}/model/contract.ecore"/>
> <RegisterEcoreFile value="${project_home}/model/sla.ecore"/>
> <RegisterEcoreFile
> value="${project_home}/model/informationModel.ecore"/>
> <RegisterEcoreFile value="${project_home}/model/ngoss.ecore"/>
> <RegisterEcoreFile value="${project_home}/model/tam.ecore"/>
> <RegisterEcoreFile value="${project_home}/model/sbvr.ecore"/>
> <registerGeneratedEPackage
> value="org.eclipse.uml2.uml.UMLPackage"/>
> <registerGeneratedEPackage
> value="org.eclipse.gmf.runtime.notation.NotationPackage"/>
>
> </bean>
>
> <component class="org.eclipse.emf.mwe.utils.DirectoryCleaner"
> directory="${project_home}/src-gen"/>
>
> <component class="org.eclipse.emf.mwe.utils.Reader">
> <firstElementOnly value="true" />
> <modelSlot value="ngossModel"/>
> <uri value="${ngossModel}"/>
>
> </component>
>
> <component class="org.eclipse.xpand2.Generator" id="ngossGenerate">
> <metaModel id="mm"
> class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>
>
> <fileEncoding value="UTF-8"/>
> <expand value="Demos::Main FOR ngossModel" />
> <outlet path="${src-gen}">
>
> <!-- postprocessor output configuration -->
>
>
> </outlet>
> </component>
>
>
> </workflow>
Re: no output from workflow called by java - action - debug action calls? [message #138483 is a reply to message #138471] Mon, 13 July 2009 13:40 Go to previous messageGo to next message
Bill HingeFriend
Messages: 156
Registered: July 2009
Senior Member
Hi Sven

I don't know if you saw one of my other posts. I'm running on mac env.
There was a previous issue with a missing plugin com.ibm.icu when I was
testing in the workbench mode with runtime config. Without this plugin
I was getting the generator terminating with no output. This almost
drove me mad until out of curiosity I tried running in windows. On doing
this I received an error in the console about the missing the above
plugin, so there can be some funny things happening with different OS's!
(not suggesting that's the issue here - checked my dependencies)

may test on a pc though to see what happens!

I did look at some of the code in cvs re
WorkflowFacade(string.mwe).run()


I tried running that, I found that it was validating my model file (I
got validation errors in a pop up jface dialog against an old invalid
model, when I ran on correct model I got an error in a dialog saying
illegalArgumentException - couldn't load my mwe file

(I got the same error when I ran against a corrected version of my model
file - just an enum format change). This implies that the error is
occurring after the Reader ?

There doesn't appear to be a way to pass in user selected model files
and slots using this method though.

Just to clarify, the reason I'm running as an action from eclipse is
that if a user is creating models in a project of their choice, I want
to be run my workflow on that file and put the output in their local
project folder

Thanks again for the feedback, I'll try some of your suggestions

regards
Steve



Sven Efftinge wrote:
> Hi Bill,
>
> you're saying that you don't get any feedback (exceptions, or the like)?
> This really is strange.
>
> Looking at the code I noticed, that given you're running in an OSGi
> environment you'll have to configure the ResourceLoader before running
> the Workflow like this:
>
> ResourceLoaderFactory.setCurrentThreadResourceLoader(new
> ResourceLoaderImpl(getClass().getClassLoader());
>
> But you should at least get some ClassNotFouncExceptions.
>
> Sven
>
> Bill Hinge schrieb:
>>
>> Hi
>>
>> I'm on the last leg - packaging my plugin
>>
>> I have a plugin which is trying to run a mwe workflow
>> (the workflow runs in project explorer right click as expected)
>>
>> When I export my plugin and load it, then run my action, the action
>> is called as evidenced by org.eclipse.jface.dialogs placed in my code.
>>
>> I have checked that the workflow urls I am using point to resources
>> actually exist but I don't seem to be getting any output. Normally it
>> takes about 11 to 23 secs to run the workflow but through java it just
>> skips through
>>
>> I'm selecting a gmf output file as my model file.
>>
>> This is how I am calling my action (no exceptions thrown)
>>
>> ngossModel is my GMF model file
>>
>> Is there any better way of getting debug info from something called
>> from an action. The only way I can check things is via placing jface
>> dialogs in my code. Not sure how to use debugger on an action if
>> possible? (no debug or console)
>>
>> regards
>> Steve
>> ============================================================ =============
>>
>> public void run(IAction action) {
>> try {
>> EObject source = getInput();
>> if (source == null) {
>> String title = Messages.RunTransformationAction_title;
>> String message =
>> Messages.RunTransformationAction_message;
>>
>> MessageDialog.openInformation(getShell(), title,
>> NLS.bind(message, file.getFullPath()));
>> } else {
>> URL url2 = new
>> URL(" platform:/plugin/org.tmf.businessService.ui/templates/busine ssServiceDemoWorkflow.mwe ");
>>
>>
>> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
>> "Debug", "Running workflow := " + url2.toString() );
>> URL url = FileLocator.toFileURL(url2);
>> URL url3 = new
>> URL("platform:/plugin/org.tmf.businessService.ui");
>> URL url4 = FileLocator.toFileURL(url3);
>>
>> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
>> "Step2", "url := " + url4.toString() );
>> Map<String, String> properties = new
>> HashMap<String, String>();
>> Map<String, String> slotcontents = new HashMap<String,
>> String>();
>>
>> properties.put("ngossModel",
>> URI.createPlatformResourceURI(file.getFullPath().toString(),
>> true).toString());
>> properties.put("src-gen",
>> Platform.getLocation().toOSString() + file.getParent().getFullPath());
>> properties.put("project_home", url4.toString());
>> new WorkflowRunner().run(url.getPath(),
>> new NullProgressMonitor(), properties, slotcontents);
>>
>> file.getParent().refreshLocal(IResource.DEPTH_ONE, new
>> org.eclipse.core.runtime.NullProgressMonitor());
>>
>> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
>> "Done", "Transform run on := " + file.getName()
>> + " output produced in location : " +
>> Platform.getLocation().toOSString() +
>> file.getParent().getFullPath() );
>> }
>> } catch (Exception ex) {
>> handleError(ex);
>> }
>> }
>>
>>
>>
>> Here is my workflow - it works if run on the workbench using 'run as'
>> I'm not seeing any console output
>>
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <workflow>
>> <property name="workspace_loc" value="./" />
>> <property name="project_home"
>> value="../org.tmf.businessService.ui" />
>> <property name="ngossModel" value="templates/default16.ngoss" />
>> <property name="src-gen"
>> value="../org.tmf.businessService.ui/src-gen"/>
>> <property name="out" value="out" />
>>
>> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
>> <platformUri value="../" />
>> <RegisterEcoreFile value="${project_home}/model/contract.ecore"/>
>> <RegisterEcoreFile value="${project_home}/model/sla.ecore"/>
>> <RegisterEcoreFile
>> value="${project_home}/model/informationModel.ecore"/>
>> <RegisterEcoreFile value="${project_home}/model/ngoss.ecore"/>
>> <RegisterEcoreFile value="${project_home}/model/tam.ecore"/>
>> <RegisterEcoreFile value="${project_home}/model/sbvr.ecore"/>
>> <registerGeneratedEPackage
>> value="org.eclipse.uml2.uml.UMLPackage"/>
>> <registerGeneratedEPackage
>> value="org.eclipse.gmf.runtime.notation.NotationPackage"/>
>>
>> </bean>
>> <component class="org.eclipse.emf.mwe.utils.DirectoryCleaner"
>> directory="${project_home}/src-gen"/>
>>
>> <component class="org.eclipse.emf.mwe.utils.Reader">
>> <firstElementOnly value="true" />
>> <modelSlot value="ngossModel"/>
>> <uri value="${ngossModel}"/>
>> </component>
>>
>> <component class="org.eclipse.xpand2.Generator" id="ngossGenerate">
>> <metaModel id="mm"
>> class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>
>> <fileEncoding value="UTF-8"/>
>> <expand value="Demos::Main FOR ngossModel" />
>> <outlet path="${src-gen}">
>> <!-- postprocessor output configuration -->
>>
>> </outlet>
>> </component>
>>
>> </workflow>
Re: no output from workflow called by java - action - debug action calls? [message #138495 is a reply to message #138471] Mon, 13 July 2009 15:19 Go to previous messageGo to next message
Bill HingeFriend
Messages: 156
Registered: July 2009
Senior Member
Sven Efftinge wrote:
> Hi Bill,
>
> you're saying that you don't get any feedback (exceptions, or the like)?
> This really is strange.
>
> Looking at the code I noticed, that given you're running in an OSGi
> environment you'll have to configure the ResourceLoader before running
> the Workflow like this:
>
> ResourceLoaderFactory.setCurrentThreadResourceLoader(new
> ResourceLoaderImpl(getClass().getClassLoader());
>
> But you should at least get some ClassNotFouncExceptions.
>
> Sven
>


I previously had my gmf diagram and my ui containing my workflow
contained in a single plugin feature which I exported to my local host
eclipse.

I got no output, if I remove it, restart, just install the ui component
directly, restart then I get an error

DiagnosticWrappedErrorException
org.eclipse.emf.ecore.xmi.PackageNotFoundException
package with uri 'http://www...blah' not found

ie it can't find the ecore files referenced in my workflow?




regards
Steve
Re: no output from workflow called by java - action - working now! [message #138507 is a reply to message #138495] Mon, 13 July 2009 18:15 Go to previous messageGo to next message
Bill HingeFriend
Messages: 156
Registered: July 2009
Senior Member
Bill Hinge wrote:
> Sven Efftinge wrote:
>> Hi Bill,
>>
>> you're saying that you don't get any feedback (exceptions, or the like)?
>> This really is strange.
>>
>> Looking at the code I noticed, that given you're running in an OSGi
>> environment you'll have to configure the ResourceLoader before running
>> the Workflow like this:
>>
>> ResourceLoaderFactory.setCurrentThreadResourceLoader(new
>> ResourceLoaderImpl(getClass().getClassLoader());
>>
>> But you should at least get some ClassNotFouncExceptions.
>>
>> Sven
>>
>
>
> I previously had my gmf diagram and my ui containing my workflow
> contained in a single plugin feature which I exported to my local host
> eclipse.
>
> I got no output, if I remove it, restart, just install the ui component
> directly, restart then I get an error
>
> DiagnosticWrappedErrorException
> org.eclipse.emf.ecore.xmi.PackageNotFoundException
> package with uri 'http://www...blah' not found
>
> ie it can't find the ecore files referenced in my workflow?
>
>
>
>
> regards
> Steve


Thanks all

I rewrote the ui plugin without OSGi gubbins and it works, phew!


regards
Steve
Re: no output from workflow called by java - action - debug action calls? [message #138519 is a reply to message #138483] Mon, 13 July 2009 18:21 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Bill Hinge schrieb:
> Hi Sven
>
> I don't know if you saw one of my other posts. I'm running on mac env.
> There was a previous issue with a missing plugin com.ibm.icu when I was
> testing in the workbench mode with runtime config. Without this plugin
> I was getting the generator terminating with no output. This almost
> drove me mad until out of curiosity I tried running in windows. On doing
> this I received an error in the console about the missing the above
> plugin, so there can be some funny things happening with different OS's!
> (not suggesting that's the issue here - checked my dependencies)

The issue is not the missing classes, but some problems with Java 6 (or
was it 5, I don't remember) on a mac.
It for some reason runs the main code in a new thread (not the main
thread). Any exceptions which are thrown will never end up in the console.
I also found that in these cases, the current thread classloader is
sometimes not set, which as well causes strange errors.

>
> may test on a pc though to see what happens!
>
> I did look at some of the code in cvs re
> WorkflowFacade(string.mwe).run()
>
>
> I tried running that, I found that it was validating my model file (I
> got validation errors in a pop up jface dialog against an old invalid
> model, when I ran on correct model I got an error in a dialog saying
> illegalArgumentException - couldn't load my mwe file
>
> (I got the same error when I ran against a corrected version of my model
> file - just an enum format change). This implies that the error is
> occurring after the Reader ?

If it says 'couldn't load *.mwe file' it is that WorkflowRunner can't
find a *.mwe file for the passed URL.

>
> There doesn't appear to be a way to pass in user selected model files
> and slots using this method though.

But you're passing slotContents.
Why do you think that this is not possible?

It seems like the URL is not right.

Sven
Re: no output from workflow called by java - action - debug action calls? [message #621121 is a reply to message #138446] Sun, 12 July 2009 20:59 Go to previous message
Krzysztof Kowalczyk is currently offline Krzysztof KowalczykFriend
Messages: 113
Registered: July 2009
Senior Member
> I have a plugin which is trying to run a mwe workflow

And now the fun begins. I don't know is there any new solution for old
problems with "running workflow from code" in Eclipse Xpand.
There are workarounds for oAW version so I will point to them.

> Is there any better way of getting debug info from something called
> from an action.

Firstly, console is quite important to know what is happening. So you
need to set it up and running. It would be interesting to know what is
the error on the console.

I guess that you will have some errors connected with UML plugin on you
console or another errors that are caused by different handling of
execution context in workflow runned externally and from code (normal
classpath or equinox managed classpath and resources).

Both problems can be solved and you can start looking for solution here:
https://opensource.luminis.net/wiki/display/SITE/oAW+Workflo w+from+Eclipse+Plugin
(check the links, there too)

But as I said before, maybe new solution is available. So you can also
ask specific question (In a new topic) on this news group.

> Not sure how to use debugger on an action if
> possible? (no debug or console)

You can debug only Java code in your setting, you just need to run you
eclipse application in debug mode, from the eclipse instance where you
develop you plugin. You will not be able to debug Xpand/Xtend if you
running it form code.

Regards,
Krzysztof Kowalczyk
Re: no output from workflow called by java - action - debug action calls? [message #621122 is a reply to message #138446] Mon, 13 July 2009 13:06 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Bill,

you're saying that you don't get any feedback (exceptions, or the like)?
This really is strange.

Looking at the code I noticed, that given you're running in an OSGi
environment you'll have to configure the ResourceLoader before running
the Workflow like this:

ResourceLoaderFactory.setCurrentThreadResourceLoader(new
ResourceLoaderImpl(getClass().getClassLoader());

But you should at least get some ClassNotFouncExceptions.

Sven

Bill Hinge schrieb:
>
> Hi
>
> I'm on the last leg - packaging my plugin
>
> I have a plugin which is trying to run a mwe workflow
> (the workflow runs in project explorer right click as expected)
>
> When I export my plugin and load it, then run my action, the action
> is called as evidenced by org.eclipse.jface.dialogs placed in my code.
>
> I have checked that the workflow urls I am using point to resources
> actually exist but I don't seem to be getting any output. Normally it
> takes about 11 to 23 secs to run the workflow but through java it just
> skips through
>
> I'm selecting a gmf output file as my model file.
>
> This is how I am calling my action (no exceptions thrown)
>
> ngossModel is my GMF model file
>
> Is there any better way of getting debug info from something called
> from an action. The only way I can check things is via placing jface
> dialogs in my code. Not sure how to use debugger on an action if
> possible? (no debug or console)
>
> regards
> Steve
> ============================================================ =============
>
> public void run(IAction action) {
> try {
> EObject source = getInput();
> if (source == null) {
> String title = Messages.RunTransformationAction_title;
> String message = Messages.RunTransformationAction_message;
>
> MessageDialog.openInformation(getShell(), title,
> NLS.bind(message, file.getFullPath()));
> } else {
>
> URL url2 = new
> URL(" platform:/plugin/org.tmf.businessService.ui/templates/busine ssServiceDemoWorkflow.mwe ");
>
>
> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
> "Debug", "Running workflow := " + url2.toString() );
>
> URL url = FileLocator.toFileURL(url2);
>
> URL url3 = new
> URL("platform:/plugin/org.tmf.businessService.ui");
> URL url4 = FileLocator.toFileURL(url3);
>
>
>
> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
> "Step2", "url := " + url4.toString() );
>
> Map<String, String> properties = new HashMap<String,
> String>();
> Map<String, String> slotcontents = new HashMap<String,
> String>();
>
> properties.put("ngossModel",
> URI.createPlatformResourceURI(file.getFullPath().toString(),
> true).toString());
> properties.put("src-gen",
> Platform.getLocation().toOSString() + file.getParent().getFullPath());
> properties.put("project_home", url4.toString());
>
> new WorkflowRunner().run(url.getPath(), new
> NullProgressMonitor(), properties, slotcontents);
>
>
> file.getParent().refreshLocal(IResource.DEPTH_ONE, new
> org.eclipse.core.runtime.NullProgressMonitor());
>
>
> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
> "Done", "Transform run on := " + file.getName()
> + " output produced in location : " +
> Platform.getLocation().toOSString() +
> file.getParent().getFullPath() );
> }
> } catch (Exception ex) {
> handleError(ex);
> }
> }
>
>
>
> Here is my workflow - it works if run on the workbench using 'run as'
> I'm not seeing any console output
>
>
> <?xml version="1.0" encoding="utf-8" ?>
> <workflow>
> <property name="workspace_loc" value="./" />
> <property name="project_home" value="../org.tmf.businessService.ui" />
> <property name="ngossModel" value="templates/default16.ngoss" />
> <property name="src-gen"
> value="../org.tmf.businessService.ui/src-gen"/>
> <property name="out" value="out" />
>
> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
> <platformUri value="../" />
> <RegisterEcoreFile value="${project_home}/model/contract.ecore"/>
> <RegisterEcoreFile value="${project_home}/model/sla.ecore"/>
> <RegisterEcoreFile
> value="${project_home}/model/informationModel.ecore"/>
> <RegisterEcoreFile value="${project_home}/model/ngoss.ecore"/>
> <RegisterEcoreFile value="${project_home}/model/tam.ecore"/>
> <RegisterEcoreFile value="${project_home}/model/sbvr.ecore"/>
> <registerGeneratedEPackage
> value="org.eclipse.uml2.uml.UMLPackage"/>
> <registerGeneratedEPackage
> value="org.eclipse.gmf.runtime.notation.NotationPackage"/>
>
> </bean>
>
> <component class="org.eclipse.emf.mwe.utils.DirectoryCleaner"
> directory="${project_home}/src-gen"/>
>
> <component class="org.eclipse.emf.mwe.utils.Reader">
> <firstElementOnly value="true" />
> <modelSlot value="ngossModel"/>
> <uri value="${ngossModel}"/>
>
> </component>
>
> <component class="org.eclipse.xpand2.Generator" id="ngossGenerate">
> <metaModel id="mm"
> class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>
>
> <fileEncoding value="UTF-8"/>
> <expand value="Demos::Main FOR ngossModel" />
> <outlet path="${src-gen}">
>
> <!-- postprocessor output configuration -->
>
>
> </outlet>
> </component>
>
>
> </workflow>
Re: no output from workflow called by java - action - debug action calls? [message #621123 is a reply to message #138471] Mon, 13 July 2009 13:40 Go to previous message
Bill HingeFriend
Messages: 156
Registered: July 2009
Senior Member
Hi Sven

I don't know if you saw one of my other posts. I'm running on mac env.
There was a previous issue with a missing plugin com.ibm.icu when I was
testing in the workbench mode with runtime config. Without this plugin
I was getting the generator terminating with no output. This almost
drove me mad until out of curiosity I tried running in windows. On doing
this I received an error in the console about the missing the above
plugin, so there can be some funny things happening with different OS's!
(not suggesting that's the issue here - checked my dependencies)

may test on a pc though to see what happens!

I did look at some of the code in cvs re
WorkflowFacade(string.mwe).run()


I tried running that, I found that it was validating my model file (I
got validation errors in a pop up jface dialog against an old invalid
model, when I ran on correct model I got an error in a dialog saying
illegalArgumentException - couldn't load my mwe file

(I got the same error when I ran against a corrected version of my model
file - just an enum format change). This implies that the error is
occurring after the Reader ?

There doesn't appear to be a way to pass in user selected model files
and slots using this method though.

Just to clarify, the reason I'm running as an action from eclipse is
that if a user is creating models in a project of their choice, I want
to be run my workflow on that file and put the output in their local
project folder

Thanks again for the feedback, I'll try some of your suggestions

regards
Steve



Sven Efftinge wrote:
> Hi Bill,
>
> you're saying that you don't get any feedback (exceptions, or the like)?
> This really is strange.
>
> Looking at the code I noticed, that given you're running in an OSGi
> environment you'll have to configure the ResourceLoader before running
> the Workflow like this:
>
> ResourceLoaderFactory.setCurrentThreadResourceLoader(new
> ResourceLoaderImpl(getClass().getClassLoader());
>
> But you should at least get some ClassNotFouncExceptions.
>
> Sven
>
> Bill Hinge schrieb:
>>
>> Hi
>>
>> I'm on the last leg - packaging my plugin
>>
>> I have a plugin which is trying to run a mwe workflow
>> (the workflow runs in project explorer right click as expected)
>>
>> When I export my plugin and load it, then run my action, the action
>> is called as evidenced by org.eclipse.jface.dialogs placed in my code.
>>
>> I have checked that the workflow urls I am using point to resources
>> actually exist but I don't seem to be getting any output. Normally it
>> takes about 11 to 23 secs to run the workflow but through java it just
>> skips through
>>
>> I'm selecting a gmf output file as my model file.
>>
>> This is how I am calling my action (no exceptions thrown)
>>
>> ngossModel is my GMF model file
>>
>> Is there any better way of getting debug info from something called
>> from an action. The only way I can check things is via placing jface
>> dialogs in my code. Not sure how to use debugger on an action if
>> possible? (no debug or console)
>>
>> regards
>> Steve
>> ============================================================ =============
>>
>> public void run(IAction action) {
>> try {
>> EObject source = getInput();
>> if (source == null) {
>> String title = Messages.RunTransformationAction_title;
>> String message =
>> Messages.RunTransformationAction_message;
>>
>> MessageDialog.openInformation(getShell(), title,
>> NLS.bind(message, file.getFullPath()));
>> } else {
>> URL url2 = new
>> URL(" platform:/plugin/org.tmf.businessService.ui/templates/busine ssServiceDemoWorkflow.mwe ");
>>
>>
>> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
>> "Debug", "Running workflow := " + url2.toString() );
>> URL url = FileLocator.toFileURL(url2);
>> URL url3 = new
>> URL("platform:/plugin/org.tmf.businessService.ui");
>> URL url4 = FileLocator.toFileURL(url3);
>>
>> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
>> "Step2", "url := " + url4.toString() );
>> Map<String, String> properties = new
>> HashMap<String, String>();
>> Map<String, String> slotcontents = new HashMap<String,
>> String>();
>>
>> properties.put("ngossModel",
>> URI.createPlatformResourceURI(file.getFullPath().toString(),
>> true).toString());
>> properties.put("src-gen",
>> Platform.getLocation().toOSString() + file.getParent().getFullPath());
>> properties.put("project_home", url4.toString());
>> new WorkflowRunner().run(url.getPath(),
>> new NullProgressMonitor(), properties, slotcontents);
>>
>> file.getParent().refreshLocal(IResource.DEPTH_ONE, new
>> org.eclipse.core.runtime.NullProgressMonitor());
>>
>> org.eclipse.jface.dialogs.MessageDialog.openInformation(getS hell(),
>> "Done", "Transform run on := " + file.getName()
>> + " output produced in location : " +
>> Platform.getLocation().toOSString() +
>> file.getParent().getFullPath() );
>> }
>> } catch (Exception ex) {
>> handleError(ex);
>> }
>> }
>>
>>
>>
>> Here is my workflow - it works if run on the workbench using 'run as'
>> I'm not seeing any console output
>>
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <workflow>
>> <property name="workspace_loc" value="./" />
>> <property name="project_home"
>> value="../org.tmf.businessService.ui" />
>> <property name="ngossModel" value="templates/default16.ngoss" />
>> <property name="src-gen"
>> value="../org.tmf.businessService.ui/src-gen"/>
>> <property name="out" value="out" />
>>
>> <bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
>> <platformUri value="../" />
>> <RegisterEcoreFile value="${project_home}/model/contract.ecore"/>
>> <RegisterEcoreFile value="${project_home}/model/sla.ecore"/>
>> <RegisterEcoreFile
>> value="${project_home}/model/informationModel.ecore"/>
>> <RegisterEcoreFile value="${project_home}/model/ngoss.ecore"/>
>> <RegisterEcoreFile value="${project_home}/model/tam.ecore"/>
>> <RegisterEcoreFile value="${project_home}/model/sbvr.ecore"/>
>> <registerGeneratedEPackage
>> value="org.eclipse.uml2.uml.UMLPackage"/>
>> <registerGeneratedEPackage
>> value="org.eclipse.gmf.runtime.notation.NotationPackage"/>
>>
>> </bean>
>> <component class="org.eclipse.emf.mwe.utils.DirectoryCleaner"
>> directory="${project_home}/src-gen"/>
>>
>> <component class="org.eclipse.emf.mwe.utils.Reader">
>> <firstElementOnly value="true" />
>> <modelSlot value="ngossModel"/>
>> <uri value="${ngossModel}"/>
>> </component>
>>
>> <component class="org.eclipse.xpand2.Generator" id="ngossGenerate">
>> <metaModel id="mm"
>> class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel "/>
>> <fileEncoding value="UTF-8"/>
>> <expand value="Demos::Main FOR ngossModel" />
>> <outlet path="${src-gen}">
>> <!-- postprocessor output configuration -->
>>
>> </outlet>
>> </component>
>>
>> </workflow>
Re: no output from workflow called by java - action - debug action calls? [message #621124 is a reply to message #138471] Mon, 13 July 2009 15:19 Go to previous message
Bill HingeFriend
Messages: 156
Registered: July 2009
Senior Member
Sven Efftinge wrote:
> Hi Bill,
>
> you're saying that you don't get any feedback (exceptions, or the like)?
> This really is strange.
>
> Looking at the code I noticed, that given you're running in an OSGi
> environment you'll have to configure the ResourceLoader before running
> the Workflow like this:
>
> ResourceLoaderFactory.setCurrentThreadResourceLoader(new
> ResourceLoaderImpl(getClass().getClassLoader());
>
> But you should at least get some ClassNotFouncExceptions.
>
> Sven
>


I previously had my gmf diagram and my ui containing my workflow
contained in a single plugin feature which I exported to my local host
eclipse.

I got no output, if I remove it, restart, just install the ui component
directly, restart then I get an error

DiagnosticWrappedErrorException
org.eclipse.emf.ecore.xmi.PackageNotFoundException
package with uri 'http://www...blah' not found

ie it can't find the ecore files referenced in my workflow?




regards
Steve
Re: no output from workflow called by java - action - working now! [message #621125 is a reply to message #138495] Mon, 13 July 2009 18:15 Go to previous message
Bill HingeFriend
Messages: 156
Registered: July 2009
Senior Member
Bill Hinge wrote:
> Sven Efftinge wrote:
>> Hi Bill,
>>
>> you're saying that you don't get any feedback (exceptions, or the like)?
>> This really is strange.
>>
>> Looking at the code I noticed, that given you're running in an OSGi
>> environment you'll have to configure the ResourceLoader before running
>> the Workflow like this:
>>
>> ResourceLoaderFactory.setCurrentThreadResourceLoader(new
>> ResourceLoaderImpl(getClass().getClassLoader());
>>
>> But you should at least get some ClassNotFouncExceptions.
>>
>> Sven
>>
>
>
> I previously had my gmf diagram and my ui containing my workflow
> contained in a single plugin feature which I exported to my local host
> eclipse.
>
> I got no output, if I remove it, restart, just install the ui component
> directly, restart then I get an error
>
> DiagnosticWrappedErrorException
> org.eclipse.emf.ecore.xmi.PackageNotFoundException
> package with uri 'http://www...blah' not found
>
> ie it can't find the ecore files referenced in my workflow?
>
>
>
>
> regards
> Steve


Thanks all

I rewrote the ui plugin without OSGi gubbins and it works, phew!


regards
Steve
Re: no output from workflow called by java - action - debug action calls? [message #621126 is a reply to message #138483] Mon, 13 July 2009 18:21 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Bill Hinge schrieb:
> Hi Sven
>
> I don't know if you saw one of my other posts. I'm running on mac env.
> There was a previous issue with a missing plugin com.ibm.icu when I was
> testing in the workbench mode with runtime config. Without this plugin
> I was getting the generator terminating with no output. This almost
> drove me mad until out of curiosity I tried running in windows. On doing
> this I received an error in the console about the missing the above
> plugin, so there can be some funny things happening with different OS's!
> (not suggesting that's the issue here - checked my dependencies)

The issue is not the missing classes, but some problems with Java 6 (or
was it 5, I don't remember) on a mac.
It for some reason runs the main code in a new thread (not the main
thread). Any exceptions which are thrown will never end up in the console.
I also found that in these cases, the current thread classloader is
sometimes not set, which as well causes strange errors.

>
> may test on a pc though to see what happens!
>
> I did look at some of the code in cvs re
> WorkflowFacade(string.mwe).run()
>
>
> I tried running that, I found that it was validating my model file (I
> got validation errors in a pop up jface dialog against an old invalid
> model, when I ran on correct model I got an error in a dialog saying
> illegalArgumentException - couldn't load my mwe file
>
> (I got the same error when I ran against a corrected version of my model
> file - just an enum format change). This implies that the error is
> occurring after the Reader ?

If it says 'couldn't load *.mwe file' it is that WorkflowRunner can't
find a *.mwe file for the passed URL.

>
> There doesn't appear to be a way to pass in user selected model files
> and slots using this method though.

But you're passing slotContents.
Why do you think that this is not possible?

It seems like the URL is not right.

Sven
Previous Topic:no output from workflow called by java - action - debug action calls?
Next Topic:EMF Compare fails
Goto Forum:
  


Current Time: Sat Nov 09 00:11:29 GMT 2024

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

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

Back to the top