|
|
Re: Create papyrus model programmatically [message #1160735 is a reply to message #1159564] |
Tue, 29 October 2013 10:13 |
Kostas Triantafyllidis Messages: 15 Registered: November 2012 |
Junior Member |
|
|
Thank you for your instant reply. I have managed to download the tests folder for the Papyrus 0.9. Since that the test folder consists as well a plugin, is there any easy way to execute them? For instance I have implemented a popup menu plugin from where I call the required methods. But this is not the ideal way to debug the code, since that for each change I make I have to export the plugin and then close eclipse and copy the plugin into the plugin folder and then fire the eclipse up again. Is there any easier way to do that?
I have to mention that I have tried to use the debug as an Eclipse application but this does not work, producing an error (The application could not run etc. This is not a problem of the plugin but a problem of the eclipse since that I am facing the same problem even with a template plugin.)
Thank you for your help.
Regards,
Kostas
[Updated on: Wed, 30 October 2013 16:13] Report message to a moderator
|
|
|
|
|
Re: Create papyrus model programmatically [message #1165558 is a reply to message #1162859] |
Fri, 01 November 2013 11:19 |
Kostas Triantafyllidis Messages: 15 Registered: November 2012 |
Junior Member |
|
|
Thanks for your reply. It seems that it works fine, since that I have downloaded a fresh copy of eclipse Juno. Actually this is the first plugin that I am programming and as a result I am not familiar with the IFiles, IProjects etc and I am facing some basic problems.
My problem is the following: I have a project into the workspace called UML_model. I want to create a papyrus model based on this model. So, I think that the appropriate class to use is the "InitModelWizard" and using init method I expect to receive the associated papyrus model. Am I right? If I am wrong please correct me.
So, the arguments that the "init" methods takes are of the types "workbench" and the "IStructuredSelection". In the place of the IStructuredSelection I would like to use a static path (workspace/UML_model/model.uml), but I do not how. The code I am using is :
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("UML_model");
IFile file = project.getFile("/model.uml");
InitModelWizard new_papy = new InitModelWizard();
IStructuredSelection kos = (IStructuredSelection) file;
new_papy.init(PlatformUI.getWorkbench(), kos);
I receive an exception that the casting of the IFile to the IStructuredSelection is not possible.
Do you know any way to cast a model path, file to an IStructuredSelection path?
Regards,
Kostas
[Updated on: Fri, 01 November 2013 12:51] Report message to a moderator
|
|
|
Re: Create papyrus model programmatically [message #1170148 is a reply to message #1165558] |
Mon, 04 November 2013 12:45 |
Camille Letavernier Messages: 952 Registered: February 2011 |
Senior Member |
|
|
Hi Kostas,
First, a Wizard is a graphical element, so it is not designed to be used programmatically. Depending on the implementation, it may or may not work as expected.
Then, for your selection:
IStructuredSelection selection = new StructuredSelection(file);
Regards,
Camille
Camille Letavernier
|
|
|
Powered by
FUDForum. Page generated in 0.03512 seconds