Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » GMF integartion wid oaw(invoking workflow from gmf context menu)
GMF integartion wid oaw [message #651299] Fri, 28 January 2011 18:43 Go to next message
Ravi Kiran is currently offline Ravi KiranFriend
Messages: 41
Registered: December 2010
Member
how do i get access to the model file if i add a handler to execute something from a gmf context menu?



i have a created a menu and command using extensions in gmf and been trying to invoke workflow generator


the code for the command is as shown below

public class customCommand extends AbstractHandler implements IHandler { //command in the menubar

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// TODO Auto-generated method stub

String path="C:\\Documents and Settings\\rtiragat\\runtime-EclipseApplication\\Automation\\ default.mist_diagram ";
Shell s=HandlerUtil.getActiveShell(event);
MessageBox mb=new MessageBox(s,SWT.None); //message box for debugging


WorkflowRunner runner = new WorkflowRunner();
Bundle bundle=Platform.getBundle("MistScriptGenerator"); //bundle symbolic name
URL wfUrl = bundle.getEntry("src/workflow/generator.oaw"); // getting the uri of the generator file
String wfFile = "";



try {

wfFile = FileLocator.toFileURL(wfUrl).getFile(); // file location string

mb.setMessage(wfFile);
mb.open();
Map<String, String> properties = new HashMap<String, String>();

// properties.put("model", $diagramFile$.getLocation().toOSString());
properties.put("model",path); //setting the value for the property in workflow "model"

boolean isSuccess = runner.run(wfFile,new org.openarchitectureware.workflow.monitor.NullProgressMonito r(), properties, null);

if (isSuccess)
{
mb.setMessage("code generation complete successfully");
}
else
{
mb.setMessage("could not intiate the code generation.Try again!!!");
}

mb.open();

}


catch (Exception e)
{
e.printStackTrace();
}


return null;

}

}

When I click on the command message box displays could not intiate the code generation.Try again!!! Which means invoking failed
Can you tell me where I should make changes so as to make it work


Below you can find my workflow file





<?xml version="1.0"?>
<workflow>
<property name="model" value="MistScriptGenerator/src/TestCase.xmi" />
<property name="src-gen" value="src-gen" />

<!-- set up EMF for standalone execution -->
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
<platformUri value=".."/>
<registerGeneratedEPackage value="automation.AutomationPackage"/>
<!-- Load GMF Notation package Don't load from model as it gives errors -->
<registerGeneratedEPackage value="org.eclipse.gmf.runtime.notation.NotationPackage"/>
</bean>

<!-- load model and store it in slot 'model' -->
<component class="org.eclipse.mwe.emf.Reader">
<uri value="platform:/resource/${model}" />
<modelSlot value="model" />
</component>

<!-- check model -->
<component class="oaw.check.CheckComponent">
<metaModel id="mm"
class="org.eclipse.m2t.type.emf.EmfRegistryMetaModel"/>
<checkFile value="metamodel::Checks" />
<emfAllChildrenSlot value="model" />
</component>

<!-- generate code -->
<component class="org.openarchitectureware.xpand2.Generator">
<metaModel idRef="mm"/>
<expand
value="template::Template::main FOR model" />
<outlet path="${src-gen}" >
<postprocessor class="org.openarchitectureware.xpand2.output.JavaBeautifier " />
</outlet>
</component>
</workflow>

i am able succesfully able to get path for the workflow
now while invoking the workflow i will have to input the gmf diagram file to the workflow. but how can i give the path for the file ?

i execute my gmf digram by opening it another workbench
now how do i get the path of gmf diagram file ?


i have registered epackage in my workflow.

can you please guide me the project deadline is very soon
Re: GMF integartion wid oaw [message #651309 is a reply to message #651299] Fri, 28 January 2011 21:20 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

you can find an answer here

http://www.eclipse.org/forums/index.php?t=msg&th=202497& amp;goto=651291#msg_651300

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:avoid format at code generation
Next Topic:Drwaing edges between edges
Goto Forum:
  


Current Time: Fri Apr 26 07:35:25 GMT 2024

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

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

Back to the top