|
|
|
|
|
Re: GMF integartion wid xpand [message #651300 is a reply to message #651291] |
Fri, 28 January 2011 19:05 |
|
So what about something like
(GMF Stuff / not Xpand stuff)
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
if (currentSelection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection)currentSelection;
if (!ss.isEmpty()) {
Object so = ss.getFirstElement();
if (so instanceof EditPart) {
Object m = ((EditPart)so).getModel();
if (m instanceof EObject) {
System.out.println(((EObject)m).eResource().getURI().toString());
}
}
}
}
And if you have split up graphical and physical storage
System.out.println(((Diagram)m).getElement().eResource().get URI());
~Christian
Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
[Updated on: Fri, 28 January 2011 19:09] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: GMF integartion wid xpand [message #651732 is a reply to message #651722] |
Tue, 01 February 2011 13:12 |
Ravi Kiran Messages: 41 Registered: December 2010 |
Member |
|
|
hi chri
in the workflow
path="C:\\Documents and Settings\\rtiragat\\runtime-EclipseApplication\\Automation\\ default.mist_diagram "
properties.put("model",path);
boolean isSuccess = runner.run(" C:\\Documents and Settings\\rtiragat\\workspace\\MistScriptGenerator\\src\\wor kflow\\generator.oaw ",new org.openarchitectureware.workflow.monitor.NullProgressMonito r(), properties, null);
i m filling the model attribute with the diagram file location
i guess i should edit my workflow like this
<uri value="platform:/resource/${model}" />
to
<uri value="${model}" />
is it not?
i guess i should kept it <uri value="platform:/resource/${model}" />
but what should i fill this model with ?
because i open a new eclipe application to run this gmf plugin i created and new java project and in that i created mist diagram
[Updated on: Tue, 01 February 2011 13:16] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: GMF integartion wid xpand [message #656589 is a reply to message #651945] |
Sun, 27 February 2011 03:15 |
gkr Messages: 13 Registered: March 2010 |
Junior Member |
|
|
Hello Ravi,
Did you successfully complete this project? I have got a similar
project and stuck in similar situation.
If you still have the project with you, can you please send it to me; so that I can have a look?
Thanks
gandharva Kumar
gbondiway [at] gmail [dot] com
[Updated on: Sun, 27 February 2011 03:19] Report message to a moderator
|
|
|
|
|
Re: GMF integartion wid xpand [message #657046 is a reply to message #657024] |
Tue, 01 March 2011 13:00 |
Ravi Kiran Messages: 41 Registered: December 2010 |
Member |
|
|
hi Kumar
propably u know to invoke generator for XMI file
gmf is also a XMI file. it consists of two file one is diagram file other is model file.model file is same as XMI
pass that file to the generator
workflow configuration needs to know that u r going to generate code for gmf files. so u r work flow configuration needs to register the gmf model
that can be done by including a tag in the .oaw file or .mwe file
please find below my oaw file
------------------------------------------------------------ ------------
<?xml version="1.0"?>
<workflow>
<property name="model" value="D:\\mist\\default.mist" />
<!--<property name="model" value="Automation/default.mist_diagram" />-->
<!--<property name="src-gen" value="src-gen" />-->
<property name="src-gen" value="/C:/"/>
<!-- set up EMF for standalone execution -->
<!--<bean class="org.eclipse.mwe.emf.StandaloneSetup" >-->
<bean class="org.eclipse.mwe.emf.StandaloneSetup" >
<platformUri value="../.."/>
<registerGeneratedEPackage value="mist.MistPackage"/> // [B]here u need to give the class name of plugin that contains ecore file (emf) [/B]
<!-- Load GMF Notation package Don't load from model as it gives errors -->
<registerGeneratedEPackage value="org.eclipse.gmf.runtime.notation.NotationPackage"/>
</bean>
<!-- instantiate metamodel -->
<bean id="mm_emf" class="org.eclipse.m2t.type.emf.EmfRegistryMetaModel"/>
<!-- load model and store it in slot 'model' -->
<!--<component class="org.eclipse.mwe.emf.Reader">-->
<component class="org.openarchitectureware.emf.XmiReader">
<modelFile value="${model}"/>
<outputSlot value="model"/>
<firstElementOnly value="true"/>
<!--<model value="${model}"/>-->
<!-- <uri value="platform:/resource/${model}" />-->
<!--<modelSlot value="model" />-->
</component>
<!-- check model -->
<component class="oaw.check.CheckComponent">
<metaModel idRef="mm_emf"/>
<checkFile value="metamodel::Checks" />
<emfAllChildrenSlot value="model" />
</component>
<!-- generate code -->
<component class="org.openarchitectureware.xpand2.Generator">
<metaModel idRef="mm_emf"/>
<expand
value="template::Template::main FOR model" />
<outlet path="${src-gen}" >
<postprocessor class="org.openarchitectureware.xpand2.output.JavaBeautifier" />
<fileEncoding value="UTF-8"/>
</outlet>
</component>
</workflow>
------------------------------------------------------------ ---------
u can add a menu and a command to the eclipse ide through extensions .which on clicking will invoke this work flow
you can refer to the following links
http:// www.openarchitectureware.org/pub/documentation/4.3.1/html/co ntents/core_reference.html#xpand_reference_introduction
follwing code for invoking workflow from any application code :-
Starting from your own code
You can also run the generator from your own application code. Two things to note:
the contents of the properties map override the properties defined in the workflow.
The slotContents map allows you to fill stuff into the workflow from your application. This is a typical use case: you run oAW from within your app because you already have a model in memory.
String wfFile = "somePath\\workflow.oaw";
Map properties = new HashMap();
Map slotContents = new HashMap();
new WorkflowRunner().run(wfFile ,
new NullProgressMonitor(), properties, slotContents)
how to add menu
http:// www.vogella.de/articles/EclipseRCP/article.html#commands_men u
don't forget to add dependency of the generator plugin to gmf plugin
regards
Ravi
[Updated on: Tue, 01 March 2011 13:04] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.06012 seconds