Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Launch DiagramGeneration from my own Plugin
Launch DiagramGeneration from my own Plugin [message #186989] Wed, 14 May 2008 10:54 Go to next message
Eclipse UserFriend
Originally posted by: user.domain.invalid

Hi,
i would like to launch the Generation of the Diagram Code from my own
Plugin.
I thought I use the Popup Action
org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTempla tesOperation;
But whe I call the Operation the Generation freeze at the beginning.
What is the problem?
Thank you
Peter



URI gm = URI.createFileURI(path+packageName+".gmfgen");
ExecuteTemplatesOperation op = new ExecuteTemplatesOperation();
op.setName("Generation");
op.setShell(shell);
op.setGenModelURI(gm);
op.run();
Re: Launch DiagramGeneration from my own Plugin [message #187001 is a reply to message #186989] Wed, 14 May 2008 11:16 Go to previous messageGo to next message
Eclipse UserFriend
Hello exquisitus,

Try using URI.createPlatformResourceURI(); like in ExecuteTemplatesAction..

-----------------
Alex Shatalin
Re: Launch DiagramGeneration from my own Plugin [message #187542 is a reply to message #187001] Sat, 17 May 2008 10:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,
the Generation still freeze at the beginning.
i add this Resource
platform:/resource/myproject.uml2gen/output/filename.gmfgen
Is this correct?
Sorry I am new in Programming.
I also tried to use this way.

URI gm = URI.createPlatformResourceURI(path+packageName+".genmodel");
ResourceSet srcResSet = new ResourceSetImpl();
Resource res = srcResSet.getResource(gm, true);
GenEditorGenerator genModel = (GenEditorGenerator) res
.getContents().get(0);
if (genModel != null && genModel.getDomainGenModel() != null) {
genModel.getDomainGenModel().reconcile();
}
org.eclipse.gmf.codegen.util.Generator generator = new Generator(
genModel, CodeGenUIPlugin.getDefault()
.getEmitters(genModel));
generator.run(monitor);


But then I get the Error:

Attempted to beginRule: R/, does not match outer scope rule:
P/myproject.uml2gen
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:62)
at org.eclipse.core.internal.jobs.ThreadJob.illegalPush(ThreadJ ob.java:122)
at org.eclipse.core.internal.jobs.ThreadJob.push(ThreadJob.java :232)
at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJo bs.java:58)
at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManag er.java:225)
......

Thank you
Peter


> Hello exquisitus,
>
> Try using URI.createPlatformResourceURI(); like in ExecuteTemplatesAction..
>
> -----------------
> Alex Shatalin
>
>
Re: Launch DiagramGeneration from my own Plugin [message #188067 is a reply to message #187542] Tue, 20 May 2008 16:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: me.urszeidler.de

For me this works :

ExecuteTemplatesOperation op = new ExecuteTemplatesOperation();
if(shell!=null)
op.setShell(shell);


String strUri =getGenmodelUri();
Path file = new Path(strUri);
IWorkspace wks = ResourcesPlugin.getWorkspace();
IWorkspaceRoot wksroot = wks.getRoot();

IFile currentFile = wksroot.getFile(new Path(strUri));

URI uri =
URI.createPlatformResourceURI(currentFile.getFullPath().toSt ring());
op.setGenModelURI(uri);
try {
op.run();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

-----
Re: Launch DiagramGeneration from my own Plugin [message #188786 is a reply to message #188067] Thu, 22 May 2008 09:49 Go to previous message
Eclipse UserFriend
Thank you!
But the Generation still freeze at the begining.
Any Preconditions for this generation?
Project handling or something?
Sorry im new in programming.


> For me this works :
>
> ExecuteTemplatesOperation op = new ExecuteTemplatesOperation();
> if(shell!=null)
> op.setShell(shell);
>
>
> String strUri =getGenmodelUri();
> Path file = new Path(strUri);
> IWorkspace wks = ResourcesPlugin.getWorkspace();
> IWorkspaceRoot wksroot = wks.getRoot();
>
> IFile currentFile = wksroot.getFile(new Path(strUri));
>
> URI uri =
> URI.createPlatformResourceURI(currentFile.getFullPath().toSt ring());
> op.setGenModelURI(uri);
> try {
> op.run();
> } catch (Exception e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> -----
>
>
Previous Topic:How to switch auto size off?
Next Topic:ClassCastException
Goto Forum:
  


Current Time: Thu Jul 17 22:16:52 EDT 2025

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

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

Back to the top