Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Executing: OaW Workflow out of Eclipse Plugin(Executing: OaW Workflow out of Eclipse Plugin fails)
icon8.gif  Executing: OaW Workflow out of Eclipse Plugin [message #509608] Sat, 23 January 2010 15:27 Go to next message
No real name is currently offline No real nameFriend
Messages: 7
Registered: January 2010
Junior Member
Hello,

I tried several hours Sad to get a Oaw-Workflow executed out of Java Code.
I want to use the eclipse-extension-point: ..ui.popupMenus in the generator-project
to give a user the possiblity to use mouse + right-click on any file in any project to
generate the code out of the file:

public void run(IAction action) {
try {
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSele ctionService().getSelection();
if(null != selection && selection instanceof StructuredSelection){
StructuredSelection ss = (StructuredSelection) selection;
IFile file = (IFile) ss.getFirstElement();
if(null == file)return;
generate(file);

}
} catch (Exception e) {
MessageDialog.openError(shell, "test.xtext.xtestdsl.generator",e.getMessage());
}
}

private void generate(IFile file) throws MalformedURLException {

String wfFile = "workflow/generator.mwe";
Map<String,String> properties = new HashMap<String,String>();

//Run Workflow:
properties.put("modelFile", file.getLocation().makeAbsolute().toOSString()).toString();
properties.put("targetDir", file.getParent().getFullPath().toPortableString()).toString( );
new WorkflowRunner().run(wfFile, null, properties, new HashMap<String,String>());

}

But the runner never finds my modelFile and target-directory... I tried everyting... . I read already some postings from other people having the same problem. But they used an older version. I use the last itemis version of the eclipse modeling IDE and did not find a solution jet. Can anyone help me?

Thank you!



[Updated on: Sat, 23 January 2010 15:30]

Report message to a moderator

Re: Executing: OaW Workflow out of Eclipse Plugin [message #509657 is a reply to message #509608] Sun, 24 January 2010 11:54 Go to previous messageGo to next message
Joerg Reichert is currently offline Joerg ReichertFriend
Messages: 80
Registered: July 2009
Location: Leipzig
Member
Hello No Real Name,

You have to use this scheme to be passed as model file URI to the workflow runner: "platform:/resource/" + pathToTheModelFileInYourWorkspace.

...
StructuredSelection strSel = (StructuredSelection) sel;
final IFile dslFile = (IFile) strSel.getFirstElement();
final IProject project = dslFile.getProject();
WorkflowRunner runner = new WorkflowRunner();
Map<String, String> params = new HashMap<String, String>();
IProject project = dslFile.getProject();
String projectPath = project.getName() + "/";
params.put("modelFile", "platform:/resource/" + projectPath + dslFile.getProjectRelativePath().toString());
String targetDir = project.getLocation().toPortableString() + "/src-gen";
params.put("targetDir", targetDir);
runner.prepare("workflow/generator.mwe", new NullProgressMonitor(), params);
Issues issues = new IssuesImpl();
runner.executeWorkflow(new HashMap<String, String>(), issues);
...


Hope, that solves your problem,

Joerg


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Re: Executing: OaW Workflow out of Eclipse Plugin [message #509687 is a reply to message #509657] Sun, 24 January 2010 18:38 Go to previous message
No real name is currently offline No real nameFriend
Messages: 7
Registered: January 2010
Junior Member
It works!!!

Thank you very much..... I never tried to
add "resource" before as String, "platform" I tried...


Smile
Previous Topic:[xtend] UML profile stereotypes not recognized
Next Topic:looking for good tutorial or reference work
Goto Forum:
  


Current Time: Wed Oct 09 13:11:48 GMT 2024

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

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

Back to the top