|
Re: Problems integrating a workflow in a plugin [message #650392 is a reply to message #650363] |
Mon, 24 January 2011 17:31   |
Eclipse User |
|
|
|
Hello all,
i quickly made an example workspace where both errors can be reproduced. It can be found here.
The workspace workflow can be executed if you run CMain in dev.test.codegen.invoke. Please be aware of the absolute paths on my filesystem. All files are there but you have to change the locations. The workspace workflow runs on my system.
The UI-plugin project is in dev.test.codegen.ui. Once you run the same as an Eclipse app you'll find "Testbutton" in your ResourceExplorer's popup menu when you do a right-click on an item. Once invoked the log output can be seen in Eclipse's host application in the console.
Maybe it's more understandable in this way. So if someone of you has the time to have a short look into the same, I would be very thankful 
By the way - this can be seen as a simple example for a code generation environment, which I havn't found so far on the internet 
Thanks in advance and bye
Tom
|
|
|
Re: Problems integrating a workflow in a plugin [message #650393 is a reply to message #650363] |
Mon, 24 January 2011 17:33   |
Eclipse User |
|
|
|
Hello Tom,
maybe there different instances of uml packages registered to your epackage reistry at runtime
here is a action that tests this
package terterter.popup.actions;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.mwe.utils.StandaloneSetup;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.xtend.expression.TypeSystemImpl;
import org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel;
import org.eclipse.xtend.typesystem.uml2.Setup;
public class NewAction implements IObjectActionDelegate {
private Shell shell;
/**
* Constructor for Action1.
*/
public NewAction() {
super();
}
/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
shell = targetPart.getSite().getShell();
}
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
StandaloneSetup ss = new StandaloneSetup();
Setup s = new Setup();
s.setStandardUML2Setup(true);
EmfRegistryMetaModel mm = new EmfRegistryMetaModel();
mm.setTypeSystem(new TypeSystemImpl());
for (String name : EPackage.Registry.INSTANCE.keySet()) {
Object o = EPackage.Registry.INSTANCE.get(name);
if (o instanceof EPackage) {
if ("uml".equals(((EPackage)o).getNsPrefix())) {
System.out.println(name + " " + o.hashCode());
}
}
}
}
/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
}
}
an output like
is ok since the instance is the same all the time.
might not be ok since there are different instances bound.
~ Christian
|
|
|
Re: Problems integrating a workflow in a plugin [message #650413 is a reply to message #650393] |
Mon, 24 January 2011 18:26   |
Eclipse User |
|
|
|
Hi,
Regarding your XtendComponent problem.
do not rely on transitive dependencies.
the workflow is executed in the context of the ui plugin, not the dev.test.codegen plugin. so add the transformation plugin to the ui plugins dependencies.
~Christian
|
|
|
Re: Problems integrating a workflow in a plugin [message #650432 is a reply to message #650413] |
Mon, 24 January 2011 20:27   |
Eclipse User |
|
|
|
Hi,
so doing following things finally makes your sample runnable with my eclipse
(1) add dev.test.codegen.generation and dev.test.codegen.transformation to deps of dev.test.codegen.ui
(2) let dev.test.codegen.generation export the dev.test.codegen.generation.generic package dev.test.codegen.generation.generic
(3) set the store location for the dump file in CommandHandler to something where eclipse can write to (not a platform:/plugin/...) uri.
~Christian
|
|
|
Re: Problems integrating a workflow in a plugin [message #650485 is a reply to message #650432] |
Tue, 25 January 2011 08:57   |
Eclipse User |
|
|
|
Hello Christian,
today I made your suggested changes and it works also fine with my real project! Thanks a lot for your spent time!
Somehow I didn't thought of exporting the packages 
Do you remember if you still had the following messages?
Multiple types (2) with name uml::PrimitiveType found!
Multiple types (2) with name uml::Constraint found!
I mean, currently the generation is working and I am really happy with this, but as soon as I use uml::PrimitiveType or uml::Constraint in my xTend scripts I run into troubles. Do you know where these warning/error messages come from?
Thank you very much and bye
Tom
|
|
|
|
|
|
Re: Problems integrating a workflow in a plugin [message #650526 is a reply to message #650525] |
Tue, 25 January 2011 12:37  |
Eclipse User |
|
|
|
Hi,
this seems not be be the problem.
you could try to debug there the duplicate things come from:
org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel.allPac kages()
org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel.getNam edElementRec(ENamedElement[], String)
~Christian
|
|
|
Powered by
FUDForum. Page generated in 0.03440 seconds