|To fetch the absolute path of .mdzip file(Magicdraw project) opened in Eclipse editor [message #495492]
||Thu, 05 November 2009 05:34
| Abhinav Mishra
Registered: November 2009
I need to fetch the absolute file path of any .mdzip file opened in Eclipse editor. The MDZIP file corresponds to a Magicdraw project which can be opened in Eclipse after integrating the Magicdraw plugin into Eclipse.|
Normally, the path of opened file in Editor can be fetched by using:
FileStoreEditorInput fipp = (FileStoreEditorInput) page.getActiveEditor().getEditorInput();
path = (new File(fipp.getURI())).getAbsolutePath();
But in case of an MDZIP file, several diagram files are opened in the editor.
I have tried to get path from such a diagram file by using following work-arounds not didn't succeed.
1. Simply using the above code gives typecasting error because these diagram files ar not of type 'FileStoreEditorInput' but are of type 'DiagramEditorInput'. So, getEditorInput() function gives error on typecasting. Actually the Magicdraw plugin uses another Editor (DiagramEditorInput) for these diagrams.
2. So I tried to use the jar file 'md_eclipse_api.jar', which is used by Magicdraw, by making a separate plugin project and use it in my project as dependency. My intension was to make use of its class 'DiagramEditorInput' to typecast the
But in this way I always get an error 'No class Def found error' for DiagramEditorInput class.
I am not able to find out what I am missing in method (2).
Also, is it possible to get such MDZIP file path by using some other method?
Thanks in advance,
[Updated on: Sat, 07 November 2009 18:03]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.03271 seconds