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 Go to next message](theme/Solstice/images/down.png) |
Bill Hinge![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=steve.orobec%40gmail.com) 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 #138471 is a reply to message #138446] |
Mon, 13 July 2009 13:06 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Sven Efftinge![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=sven.efftinge%40itemis.de) 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 message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Bill Hinge![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=steve.orobec%40gmail.com) 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 #621122 is a reply to message #138446] |
Mon, 13 July 2009 13:06 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Sven Efftinge![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=sven.efftinge%40itemis.de) 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 Go to previous message](theme/Solstice/images/up.png) |
Bill Hinge![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=steve.orobec%40gmail.com) 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 Go to previous message](theme/Solstice/images/up.png) |
Bill Hinge![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=steve.orobec%40gmail.com) 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 Go to previous message](theme/Solstice/images/up.png) |
Bill Hinge![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=steve.orobec%40gmail.com) 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
|
|
| |
Goto Forum:
Current Time: Sun Sep 01 04:46:54 GMT 2024
Powered by FUDForum. Page generated in 0.04207 seconds
|